All projects

MLOps / AI Platform

ModelOps Control Plane

Canary rollouts for ML models, decided by statistics. Each traffic step is tested against the stable version on latency, errors, prediction quality and drift with confidence intervals, and the rollout is promoted, rolled back or frozen for a human on its own.

Locust on the real stack, about 100 req/s5 / 5
Benchmark scenarios as expectedBaseline, latency failure, error failure, quality failure and success: two rollbacks, one freeze for a human and one promotion, each matching the expected outcome.
+400 ms injected on the canary30.9 s
Latency regression to rollbackFrom the rollout starting to the worker's rollback, with the worker's production 15 s poll interval. The 50% error fault was rolled back in 30.7 s.
Plus 395 backend tests8
Real-stack CI scenariosCI boots the real stack and runs promotion, rollbacks on latency, recall and drift, and router restarts against the real worker, then the observability check and Playwright.

A model can be up and still be wrong.

A new model version starts, answers requests and passes its health check. None of that says whether its predictions are as good as the version it replaces, or whether it is slower on real traffic. Deploying it to everyone at once turns that question into an incident.

ModelOps Control Plane makes a new version earn production traffic one step at a time. Each step is tested against the stable version on latency, errors, prediction quality and drift, with confidence intervals, so the decision rests on evidence instead of a dashboard glance.

A worker promotes, rolls back or freezes the rollout for a human on its own, and explains every decision in plain English. It all runs with one docker compose up on a 16 GB laptop.

Built for the person shipping the model.

Start a rollout from the dashboard or the API, then let the control loop do the watching.

Ramp traffic gradually

A canary climbs 10%, 25%, then 50%, one tested step at a time, and a pass at 50% promotes it. Traffic goes through a real gateway with sticky routing, a circuit breaker per version and rate limits.

A bad version reaches a small share of requests before anyone has to notice it.

Decide with statistics

Error rate, p95 latency and recall each come with a confidence interval and a p-value. A check fails only when the whole interval is past the limit, and the error budget is spent across a rollout's repeated evaluations.

Two unlucky requests cannot roll back a good model, and re-checking every cycle cannot add up to a false rollback.

Judge quality, not just uptime

Ground-truth labels arrive late and incomplete through a real ingestion API. Quality checks wait for a matured window and enough positive examples. Before any label arrives, drift checks compare the canary's inputs and scores with its training data.

A model that answers fast but predicts badly is caught too.

Act on its own, explain itself

A worker promotes, rolls back or freezes the rollout for a human. Every check writes a sentence saying why, the timeline tells the whole story, and each decision sends a signed webhook.

An operator reads why a rollout ended instead of reconstructing it from graphs.

Heal routing drift

The database holds the desired traffic split, the router holds the observed one. A reconciler repairs any difference, even after the router restarts and forgets everything.

A restart or a failed push never leaves traffic on the wrong version.

From 10% to promoted.

The Gateway page during a live rollout: beam width is each version's share of traffic, speed is its request rate. Below it, the control loop that moves the split.

Live requests flowing from clients through the gateway to the stable and canary versions, and the control loop that moves the split
  1. Start. A rollout sends 10% of a model's traffic to the canary. The worker reads its state from the control plane every cycle and acts through the same API an operator uses.
  2. Measure. Reliability checks read the most recent window. Quality checks read an older, matured window, because labels arrive late.
  3. Decide. Each check compares the canary with stable and stores the interval it measured. One FAIL rolls the canary back; one INCONCLUSIVE holds it where it is.
  4. Step up. A PASS moves the canary to 25%, then 50%. A pass at 50%, while both sides still serve real traffic, promotes it.
  5. Freeze. A rollout that stays undecided after its retries is frozen for a human, who promotes or rolls it back from the dashboard.
  6. Explain. Every state change, worker action and policy result lands on one timeline, marked automatic or manual with the operator's name.

Fail on the interval, not the estimate.

A check passes when its estimate is within the limit, fails when the whole interval is past it, and is inconclusive when the interval still reaches back across. The overall verdict is FAIL over INCONCLUSIVE over PASS.

CheckMeasuresStatistics
max_error_rateCanary 5xx shareWilson score interval, exact binomial test
latency_p95_increaseCanary p95 vs stable p95Bootstrap interval of the p95 ratio, one-sided Mann-Whitney U
minimum_recallRecall over matured labelsWilson score interval, exact binomial test
feature_driftCanary inputs vs training data, no labels neededPSI corrected for sample size, chi-square with Bonferroni
prediction_driftCanary scores vs validation scores, no labels neededPSI corrected for sample size, chi-square test
Evidence gatesEnough requests, labels, label coverage and positive labelsGates: INCONCLUSIVE until met

Thresholds and the confidence level, 95% by default, are set per rollout. The level covers the whole rollout: the first look is held to 97.5%, later looks to more.

The control plane never touches a model.

The gateway serves predictions and reports one metric per request. The control plane decides and pushes revisioned traffic splits back. The router only ever receives version-to-weight maps, so each side can be restarted, replaced or scaled without the other noticing.

The control plane holds each model's desired traffic split with a monotonic revision and pushes it to the gateway, which only ever receives version-to-weight maps, never a host. The gateway applies a rate limit, sticky routing and a circuit breaker per version, forwards each prediction with a prediction_id, and reports one metric per request. A stateless worker evaluates the policy checks with confidence intervals over a fresh reliability window and an older, matured quality window, then steps, promotes, rolls back or freezes the rollout through the same API an operator uses, and reconciles the router's observed split back to the desired one.

Prediction / traffic path

A failed request is answered 503 and recorded against the version it was meant for, never sent to another version.

Client Traffic requests Gateway. Gateway routes Stable Model (current version). Gateway routes Canary Model (candidate version, never failed over). Stable Model and Canary Model emits Control Plane.

  1. ClientClient Trafficprediction request
  2. ServiceGatewayrate limit, sticky routing, circuit breaker per version
  3. ServiceStable Modelcurrent version
    ServiceCanary Modelcandidate version, never failed over
  1. ControlControl Planeone prediction_id-tagged metric per request

Delayed ground-truth / quality path

Label and metric writes are independent; a GroundTruthLabel is durable even before its matching PredictionMetric arrives.

Delayed Label Source ingests GroundTruthLabel. GroundTruthLabel join by prediction_id Quality Aggregation. Quality Aggregation summarizes Quality Summary.

  1. BoundaryDelayed Label Sourcesynthetic ground truth, via POST /api/labels(/batch)
  2. PersistenceGroundTruthLabelwritten unconditionally, durable
  1. AnalyzerQuality Aggregationjoined against PredictionMetric at read time
  2. OutputQuality Summaryrecall over matured window

Policy / automated rollout loop

A separate stateless worker acts only through the same Control Plane endpoints available to an operator.

Automation Worker evaluates Two Evaluation Windows. Two Evaluation Windows feeds Policy Engine. Policy Engine verdict PASS (next step: 10% → 25% → 50%, then promote). Policy Engine verdict FAIL (automatic rollback). Policy Engine verdict INCONCLUSIVE (retry, then freeze for a human).

  1. ServiceAutomation Workerrestart-safe polling loop
  2. AnalyzerTwo Evaluation Windowsfresh reliability, matured quality, drift
  3. AnalyzerPolicy Engineconfidence intervals; FAIL beats INCONCLUSIVE beats PASS
  1. ControlPASSnext step: 10% → 25% → 50%, then promote
    ControlFAILautomatic rollback
    ControlINCONCLUSIVEretry, then freeze for a human

Desired / observed reconciliation

The database's desired state commits first; the router push is best-effort and repaired on drift, not assumed to always land.

Deployment + TrafficAllocation pushes Best-Effort Router Push. Best-Effort Router Push updates Router Observed Config. Router Observed Config reconciles Reconcile Tick.

  1. PersistenceDeployment + TrafficAllocationdurable desired state, model-scoped generation — commits before router push
  2. ControlBest-Effort Router PushPUT /router/config
  1. ServiceRouter Observed Configin-memory, restart-losable, rejects stale generation
  2. ControlReconcile Tickworker-triggered, repairs drift

Operator / audit

Manual actions use the same endpoints the worker does; every action and policy verdict lands on one merged timeline.

Dashboard calls Control Plane API. Control Plane API records Deployment Timeline.

  1. ClientDashboardpause / resume / promote / rollback
  2. ControlControl Plane APImanual or automated actor, same endpoints as the worker
  3. OutputDeployment Timelineevents + policy snapshots merged

Architecture notes

  • The database is the durable desired routing state; the router's config is an in-memory, restart-losable cache the control plane pushes best-effort after committing that decision.
  • TrafficAllocation revisions are scoped per model (RoutingGeneration), not per deployment, so the router rejects an equal-or-stale push even when it comes from an already-superseded rollout.
  • SQLAlchemy optimistic concurrency (a version column bumped on every commit) and a DB-level partial unique index together stop a losing concurrent action from corrupting a rollout and cap each model at one unresolved deployment at a time — INCONCLUSIVE counts as unresolved too.
  • INCONCLUSIVE means frozen for manual review, not a silent revert to the previous traffic split — its allocation stays the router's authoritative desired state until a human resolves it, the same as a completed PROMOTED or ROLLED_BACK rollout.
Read the design notes

What the runtime guarantees.

These hold through restarts, failed pushes and late data, so the traffic split always matches the decision behind it.

A down canary is never hidden

The gateway never sends a request to a different version when one is down. A failed request is answered 503 and recorded against the version it was meant for, so a broken canary is rolled back instead of looking idle.

Read the design

The database is the truth

Every traffic split change gets a new, monotonic revision in the database. The router's copy is a cache; a failed push never fails the rollout, and the next reconcile tick closes the gap.

Read the design

Old splits cannot come back

The router rejects any revision older than the one it holds, so a delayed push from a superseded rollout cannot bring back an old traffic split.

Read the design

Labels are idempotent

A repeated label answers 200, a conflicting one 409 with an audit event, and a label that arrives before its prediction is stored and joined later.

Read the design

Make a false rollback unlikely.

Fail only on the whole interval

A check fails when the entire confidence interval is past the limit and is INCONCLUSIVE when it straddles it. The first look is held to 97.5% and later looks to more, so a rollout's 95% level covers all its evaluations.

Wait for positive labels

Recall's denominator is positive examples. At a 2% fraud rate a window can hold hundreds of labels and only two frauds, so recall waits for enough positives before it speaks.

Catch drift before labels

Feature drift reads the training profile written next to each model; prediction drift reads its validation scores. Both act from the first window, before any ground truth exists.

A worker with no state

The worker reads everything from the control plane each cycle and only calls its REST endpoints, so a crash or restart loses nothing, and one rollout can be paused without stopping the worker for others.

Keep the boundary narrow

The control plane never talks to a model container, and the router only receives version-to-weight maps, never a host. Each side can be restarted or replaced without the other noticing.

Every scenario ends as expected.

Each benchmark runs against the real stack with Locust at about 100 requests per second, under its own model name, with faults switched on at runtime and always reset afterwards.

ScenarioFaultOutcomeTime to action
Latency failure+400 ms on canaryRolled back30.9 s
Error failure50% 5xx on canaryRolled back30.7 s
Quality failureWeak modelFrozen for a human46.3 s
SuccessNonePromoted at 50%, then 100%55.9 s

Time to action runs from the rollout starting to the worker's final decision, with the worker's production 15 s poll interval. The baseline served 29,871 requests with 0 errors at p95 97 ms.

Read the benchmark design

The working product.

Every screen below is the running stack. Open any screenshot to see it full size.

ModelOps overview: live, promoted, rolled-back and inconclusive rollouts, live routing from the gateway to five models with their splits, and two rollouts in flight.
See every model at once

Rollout outcomes and who decided them, the gateway fanning out to each active model with its live split, and the rollouts in flight.

Gateway page with requests per second, in-flight and unanswered requests, and for each model the path from clients through the gateway to stable and canary, with p95, errors and breaker state per version.
Follow every request

Clients, the gateway's rate limit, sticky routing and circuit breakers, then the control loop that measures the split and moves it.

A canary that is down: its circuit breaker is open and the gateway fails its requests fast while stable keeps serving.
Fail fast when a canary is down

After five consecutive failures the breaker opens and the gateway fails fast instead of waiting on timeouts, until a half-open probe succeeds.

Over time chart: canary p95 latency far above stable, with the limit line and the rollback marker.
See the rollback

A canary with 400 ms injected: p95 latency per version across the rollout, with the traffic steps, the limit and the moment the worker rolled it back.

Policy checks with observed values, confidence intervals drawn against each limit, p-values and plain-English explanations, with the rollout's decision gates and evidence requirements.
Read the evidence

Each check stores its observed value, the interval drawn against the limit, the p-value and a plain-English reason.

Timeline of a rollout: traffic steps, policy verdicts with explanations and the automatic rollback.
Read the story

Every state change, worker action and policy result in one timeline, top to bottom.

A rollout in progress: applied traffic split, canary analysis and operator controls.
Control a live rollout

The split the router actually applied, the canary analysis against stable, and the controls to pause automation, promote or roll back.

Benchmarks page with the five scenarios and their last results.
Run the benchmarks

Five repeatable end-to-end scenarios, started from the dashboard or the CLI.

Grafana ModelOps Rollouts dashboard.
Watch it in Grafana

Canary against stable per model, the control loop and circuit breakers, with decisions marked on every graph.

Jaeger trace of one prediction from the router to the model's inference span.
Trace one prediction

Router, readiness check, model service and model.inference as one trace in Jaeger.

Tested on the real stack.

Every real bug in this project was found by running the actual stack, so CI boots it on every push and runs the real worker against it.

Benchmarks

5 of 5 as expected

Locust against the real stack · about 100 req/s

Latency and error faults rolled back in 30.9 s and 30.7 s, the weak model frozen for a human in 46.3 s, the healthy canary promoted in 55.9 s. Baseline: 29,871 requests, 0 errors, p95 97 ms.

Real-stack CI

8 scenarios on every push

Real worker, router and models

Promotion on a real recall PASS, rollbacks on latency, recall, feature drift and prediction drift, and two router restarts repaired by reconcile and startup sync.

Drift without labels

Rolled back before any label

CI scenarios 7 and 8

A canary fed inputs with amount scaled 4× is rolled back on feature drift; one on 20% fraud traffic is rolled back on prediction drift while every input stays within limits.

Verification

395 backend tests

ruff, mypy --strict, eslint, tsc, next build

An API-contract job regenerates the OpenAPI schema and TypeScript types and fails on any diff. Labels come from a synthetic dataset through the real ingestion API, not production feedback.

Run it locally.

  • Python
  • FastAPI
  • SQLAlchemy
  • SQLite
  • Alembic
  • Next.js
  • TypeScript
  • scikit-learn
  • Prometheus
  • Grafana
  • OpenTelemetry
  • Jaeger
  • Locust
  • Playwright
  • Docker Compose

One command trains the models and another starts the stack: the control plane, dashboard, gateway, five model services, the worker, a webhook sink, Prometheus, Grafana and Jaeger.

git clone https://github.com/negativexq/modelops-control-plane.git
cd modelops-control-plane
make prepare-models
make dev
make benchmark-latency-failure
# Open http://localhost:3000

Labels flow through the real API but come from a synthetic dataset. SQLite, one worker and one router keep it on a laptop; the README lists what changes for production.

In short

What is ModelOps Control Plane?
ModelOps Control Plane is a FastAPI and Next.js platform that rolls out a new ML model version through a real gateway, 10% then 25% then 50% of traffic. At each step a policy engine compares the canary with the stable version on error rate, p95 latency, recall from delayed labels, and input and prediction drift, each with a confidence interval. A stateless worker promotes, rolls back or freezes the rollout and explains every decision in plain English.
What problem does ModelOps Control Plane solve?
A model can start, answer requests and still be wrong for production. Deciding whether a new version deserves more traffic means comparing it with the current one on reliability and on quality, when labels arrive late and incomplete, without letting two unlucky requests roll back a good model or a thin sample promote a bad one. The routing that carries the decision also has to survive restarts and failed pushes.

Follow the implementation.