mlflow/mlflow

The open source AI engineering platform for agents, LLMs, and ML models. MLflow enables teams of all sizes to debug, evaluate, monitor, and optimize production-quality AI applications while controlling costs and managing access to models and data.

25,450 stars Python 10 components

10 hidden assumptions · 8-stage pipeline · 10 components

Like any codebase, this ml training makes assumptions it never checks — most are routine. The ones worth your attention are below.

Manages ML experiments tracking models evaluations and GenAI applications

Data enters MLflow through multiple channels: Python APIs log experiments and models to storage backends, web UI displays stored data, GenAI tracing captures LLM application execution, and the AI Gateway routes LLM requests. The core flow is: create experiment → start run → log parameters/metrics/artifacts → optionally register model → serve or deploy model. For GenAI: execute traced function → capture spans with inputs/outputs → store trace → visualize in UI for debugging.

Under the hood, the system uses 4 feedback loops, 4 data pools, 5 control points to manage its runtime behavior.

A 10-component ml training. 11060 files analyzed. Data flows through 8 distinct pipeline stages.

Hidden Assumptions

Most of what this code assumes is routine. These 3 are the ones most likely to cause trouble here. The rest are minor; they're under "Show everything".

Worth your attention first

Assistant features or security restrictions intended only for local development could be enabled/disabled incorrectly in production environments using localhost proxies or containers, potentially exposing admin features or blocking legitimate usage

Worth your attention first

If system clock jumps backward or multiple users hit exact same millisecond with same random seed, duplicate message IDs could cause message overwrites, lost chat history, or UI state corruption in multi-user scenarios

Worth a check

Multiple concurrent streaming requests could leak memory and cause overlapping message streams, leading to garbled chat responses, duplicate content, or exhausted browser connection limits

Show everything (7 more)
Contract

APIModules JSON object contains all valid module mappings for function names, and function names follow consistent dot notation pattern - but no validation that APIModules is populated or that the longest match is always correct

If this fails: If APIModules is empty/corrupted or function names use unexpected patterns, API documentation links silently fail to generate, leaving broken links that render as plain text instead of clickable documentation

docs/src/components/APILink/index.tsx:getModule
Domain

Streaming message content should be concatenated with double newlines as separators when content doesn't naturally end/start with newlines, but doesn't validate content format or handle edge cases like empty strings or special characters

If this fails: Chat messages could have malformed formatting with missing separators, extra whitespace, or broken markdown rendering if streaming content has unexpected format, making assistant responses hard to read

libs/skinny/mlflow/server/js/src/assistant/AssistantContext.tsx:appendToStreamingMessage
Ordering

The last message in the messages array is always the currently streaming assistant message when updating content, and messages arrive in proper chronological order

If this fails: If messages are reordered by React state updates or multiple streams overlap, streaming content could be appended to wrong message or create duplicate messages, corrupting chat history display

libs/skinny/mlflow/server/js/src/assistant/AssistantContext.tsx:setMessages
Resource

streamingMessageRef.current can accumulate unlimited text content in memory without size limits or cleanup between messages

If this fails: Extremely long assistant responses or runaway streaming could consume all available browser memory, causing page crashes or system freezes, especially in long-running chat sessions

libs/skinny/mlflow/server/js/src/assistant/AssistantContext.tsx:streamingMessageRef
Contract

useBaseUrl() returns properly formatted URL and hash fragments are valid HTML anchors, but doesn't validate URL structure or escape special characters in hash

If this fails: Documentation links could be malformed with invalid URLs or broken anchors, causing 404 errors or navigation to wrong page sections when users click API documentation links

docs/src/components/APILink/index.tsx:docLink
Scale

Chat history can grow indefinitely in browser memory with no pagination, archiving, or memory limits as conversation length increases

If this fails: Very long chat sessions with hundreds of messages could cause performance degradation, slow UI rendering, or browser crashes as message array consumes increasing memory

libs/skinny/mlflow/server/js/src/assistant/AssistantContext.tsx:messages
Temporal

localStorage data persists reliably across browser sessions and version migrations work correctly when localStorage schema changes

If this fails: Assistant panel state could be lost unexpectedly, forcing users to reconfigure their preferred panel visibility, or version migration failures could cause startup errors

libs/skinny/mlflow/server/js/src/assistant/AssistantContext.tsx:useLocalStorage

Open the standalone hidden-assumptions report for mlflow →

How Data Flows Through the System

Data enters MLflow through multiple channels: Python APIs log experiments and models to storage backends, web UI displays stored data, GenAI tracing captures LLM application execution, and the AI Gateway routes LLM requests. The core flow is: create experiment → start run → log parameters/metrics/artifacts → optionally register model → serve or deploy model. For GenAI: execute traced function → capture spans with inputs/outputs → store trace → visualize in UI for debugging.

  1. Initialize tracking context — MlflowClient connects to tracking store (file system or database) via TrackingStoreRegistry based on MLFLOW_TRACKING_URI, establishes database connection and creates necessary tables if using SQL backend
  2. Create experiment — Client calls create_experiment() which validates name uniqueness, generates experiment_id, sets artifact_location, and persists Experiment entity to SqlAlchemyTrackingStore [Experiment request → Experiment]
  3. Start ML run — start_run() generates unique run_id, creates Run entity with RUNNING status, initializes start_time, and creates artifact directory structure for this run [Run configuration → Run]
  4. Log training data — During model training, log_param(), log_metric(), and log_artifacts() calls accumulate in SqlAlchemyTrackingStore — metrics support time series with step values, artifacts get uploaded to configured storage (S3/Azure/local) [Run → Run with metrics/params]
  5. Register model — log_model() or register_model() creates ModelVersion entity linking to run artifacts, generates version number, updates model registry tables, triggers webhooks if configured [Model artifacts → ModelVersion]
  6. Serve web UI — FlaskApp serves React frontend from libs/skinny/mlflow/server/js/build, handles API routes like /ajax-api/2.0/mlflow/experiments/list, and proxies to database via tracking store [HTTP requests → Web UI responses]
  7. Trace GenAI execution — MlflowTracingServer captures function execution via @trace decorator, creates Trace entity with request_id, generates TraceSpan for each LLM call with inputs/outputs, stores spans hierarchically [Function calls → Trace]
  8. Route LLM requests — GatewayClient sends requests to AI Gateway which selects provider based on configuration, applies cost limits and access controls, forwards to OpenAI/Anthropic/etc., tracks usage metrics [LLM requests → LLM responses]

Data Models

The data structures that flow between stages — the contracts that hold the system together.

Experiment mlflow/entities/experiment.py
Entity with experiment_id: str, name: str, artifact_location: str, lifecycle_stage: str, tags: dict[str, str], creation_time: int, last_update_time: int
Created via API or UI, stores experiment metadata and configuration, retrieved for run organization and comparison
Run mlflow/entities/run.py
Entity with run_id: str, experiment_id: str, status: RunStatus, start_time: int, end_time: int, metrics: dict, params: dict, tags: dict, artifact_uri: str
Created when starting ML training, accumulates metrics and parameters during execution, finalized with status and artifacts
ModelVersion mlflow/entities/model_registry/model_version.py
Entity with name: str, version: str, creation_timestamp: int, last_updated_timestamp: int, description: str, user_id: str, stage: str, source: str, run_id: str, status: str, status_message: str, tags: dict
Created when registering model from run, transitions through stages (Staging/Production), used for deployment and serving
Trace mlflow/entities/trace.py
Entity with request_id: str, trace_id: str, timestamp_ms: int, status: TraceStatus, request_metadata: dict, tags: dict, spans: list[TraceSpan]
Created for GenAI application execution, accumulates spans for LLM calls and tool usage, stored for debugging and evaluation
TraceSpan mlflow/entities/trace.py
Entity with span_id: str, name: str, start_time_ns: int, end_time_ns: int, parent_id: str, attributes: dict, events: list, status: SpanStatus, inputs: dict, outputs: dict
Created during traced function execution, captures inputs/outputs and timing for individual operations like LLM calls
ChatMessage libs/skinny/mlflow/server/js/src/assistant/types.ts
Interface with id: string, role: 'user'|'assistant'|'system', content: string, timestamp: Date, isStreaming?: boolean, isInterrupted?: boolean
Created for user queries to AI assistant, streams response content from assistant, stored in chat history for context

System Behavior

How the system operates at runtime — where data accumulates, what loops, what waits, and what controls what.

Data Pools

Experiment Database (database)
SQLAlchemy-managed database storing experiments, runs, metrics, parameters, tags, and model registry data — central persistent state
Artifact Storage (file-store)
File system or cloud storage (S3/Azure/GCS) containing model files, images, datasets, and other run artifacts — organized by run_id
Trace Store (database)
Specialized storage for GenAI traces and spans — optimized for hierarchical span data and real-time ingestion
Assistant Chat State (in-memory)
React state holding chat messages, streaming status, and tool execution results — ephemeral conversation context

Feedback Loops

Delays

Control Points

Technology Stack

Flask (framework)
Web server framework providing REST API endpoints for experiment tracking and model registry
FastAPI (framework)
Async web server for GenAI tracing service handling real-time trace ingestion and querying
React (framework)
Frontend framework building the MLflow web UI with experiment visualization and model management interfaces
SQLAlchemy (database)
ORM managing database schemas and operations for experiments, runs, models, and metrics storage
Protobuf (serialization)
API schema definition and serialization for MLflow REST APIs and cross-language compatibility
PyArrow (compute)
Efficient columnar data processing for large datasets and metrics storage in MLflow
OpenTelemetry (infra)
Distributed tracing instrumentation for GenAI applications and LLM observability
Pydantic (library)
Data validation and serialization for API request/response models and configuration schemas

Key Components

Explore the interactive analysis

See the full architecture map, data flow, and code patterns visualization.

Analyze on CodeSea

Related Ml Training Repositories

Frequently Asked Questions

What is mlflow used for?

Manages ML experiments tracking models evaluations and GenAI applications mlflow/mlflow is a 10-component ml training written in Python. Data flows through 8 distinct pipeline stages. The codebase contains 11060 files.

How is mlflow architected?

mlflow is organized into 6 architecture layers: Web Server Layer, Frontend UI, Tracking & Storage, Model Management, and 2 more. Data flows through 8 distinct pipeline stages. This layered structure keeps concerns separated and modules independent.

How does data flow through mlflow?

Data moves through 8 stages: Initialize tracking context → Create experiment → Start ML run → Log training data → Register model → .... Data enters MLflow through multiple channels: Python APIs log experiments and models to storage backends, web UI displays stored data, GenAI tracing captures LLM application execution, and the AI Gateway routes LLM requests. The core flow is: create experiment → start run → log parameters/metrics/artifacts → optionally register model → serve or deploy model. For GenAI: execute traced function → capture spans with inputs/outputs → store trace → visualize in UI for debugging. This pipeline design reflects a complex multi-stage processing system.

What technologies does mlflow use?

The core stack includes Flask (Web server framework providing REST API endpoints for experiment tracking and model registry), FastAPI (Async web server for GenAI tracing service handling real-time trace ingestion and querying), React (Frontend framework building the MLflow web UI with experiment visualization and model management interfaces), SQLAlchemy (ORM managing database schemas and operations for experiments, runs, models, and metrics storage), Protobuf (API schema definition and serialization for MLflow REST APIs and cross-language compatibility), PyArrow (Efficient columnar data processing for large datasets and metrics storage in MLflow), and 2 more. A focused set of dependencies that keeps the build manageable.

What system dynamics does mlflow have?

mlflow exhibits 4 data pools (Experiment Database, Artifact Storage), 4 feedback loops, 5 control points, 4 delays. The feedback loops handle training-loop and recursive. These runtime behaviors shape how the system responds to load, failures, and configuration changes.

What design patterns does mlflow use?

5 design patterns detected: Plugin Architecture, Fluent API, Event-Driven Autologging, Universal Model Interface, React Context State Management.

Analyzed on April 20, 2026 by CodeSea. Written by .