0Pricing
MLOps Academy · Lesson

Split Traffic Between Model Versions

Route a percentage of requests to a challenger.

Split Traffic Between Model Versions is a free MLOps Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MLOps Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Two Models, One Live Test

You have a new model you believe is better. Instead of guessing, you let real traffic decide. An A/B test runs both models side by side on live users. 🔬

Champion and Challenger

The current model in production is your champion. The new candidate you want to prove is the challenger. The test sees if the challenger truly beats the champion.

Splitting the Traffic

The core idea is simple: send a slice of requests to each model. A common start is 90/10, keeping most users safe on the champion while the challenger proves itself.

A Tiny Router

A basic split just rolls a random number per request and routes by the cutoff. Here ten percent of traffic reaches the challenger.

import random

def pick_model(challenger_share=0.1):
    return "challenger" if random.random() < challenger_share else "champion"

Keep Each User Consistent

Random per request flips a user between models on every visit. Instead, hash the user id so the same person always lands on the same model.

Hashing for Sticky Splits

Hashing the user id gives a stable bucket. The same id maps to the same model every time, which keeps the test clean.

import hashlib

def bucket(user_id, challenger_share=0.1):
    h = int(hashlib.md5(user_id.encode()).hexdigest(), 16)
    return "challenger" if (h % 100) < challenger_share * 100 else "champion"

Log Which Model Served

For every prediction, record which model handled it. Without this assignment log, you can never compare the two groups fairly later on. 📝

Start Small, Then Ramp

Begin with a tiny challenger share to limit risk. As confidence grows, you raise the percentage gradually instead of flipping everyone over at once.

Control the Split with Config

Hard-coding the share means a redeploy to change it. Read the split ratio from config so you can dial traffic up or down without shipping code.

Same Inputs, Fair Fight

Both models must see the same kind of requests and the same features. If the groups differ in who they serve, any winner you find may be an illusion.

It Is Just Routing

At its heart, an A/B test is a routing layer plus careful logging. Get the split sticky and recorded, and you have the foundation for a trustworthy comparison. ✅

Quick Check

Let us check how to keep your split clean.

Recap

An A/B test pits a champion against a challenger by splitting live traffic. Hash users for sticky buckets, log every assignment, and start small. 🎯

Frequently asked questions

Is the “Split Traffic Between Model Versions” lesson free?

Yes — the full text of “Split Traffic Between Model Versions” is free to read here on the web, and the MLOps Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MLOps Academy course, upgrade to CoddyKit PRO.

What will I learn in “Split Traffic Between Model Versions”?

Route a percentage of requests to a challenger. You practise MLOps Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start MLOps Academy?

No prior experience is required. MLOps Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Split Traffic Between Model Versions” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this MLOps Academy lesson?

Yes. Every MLOps Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Split Traffic Between Model Versions
  2. Pick Metrics That Matter
  3. Read Significance Without Fooling Yourself
  4. Promote or Roll Back the Winner
← Back to MLOps Academy