Divida el tráfico entre versiones del modelo
Enrute un porcentaje de las solicitudes a un modelo challenger.
Divida el tráfico entre versiones del modelo es una lección gratuita de MLOps Academy en CoddyKit. Esta es la lección 1 de 4. Puedes leer la lección completa abajo gratuitamente — luego la practicas en el navegador con un editor de código integrado y un tutor de IA 24/7. Forma parte de la ruta de aprendizaje de MLOps Academy, y tu progreso se sincroniza en la web y la app de CoddyKit. El curso de MLOps Academy incluye 4 lecciones en total.
Partes de esta lección aún no han sido traducidas y se muestran en inglés.
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. 🎯
Preguntas frecuentes
¿La lección «Divida el tráfico entre versiones del modelo» es gratis?
Sí — el texto completo de «Divida el tráfico entre versiones del modelo» es gratis para leer aquí en la web. Para practicarla de forma interactiva (editor de código integrado y tutor de IA 24/7) y desbloquear el resto del curso de MLOps Academy, actualiza a CoddyKit PRO. El curso de MLOps Academy incluye 4 lecciones en total.
¿Qué aprenderé en «Divida el tráfico entre versiones del modelo»?
Enrute un porcentaje de las solicitudes a un modelo challenger. Practicas MLOps Academy con código real que ejecutas directamente en el navegador, y un tutor de IA 24/7 responde tus preguntas mientras trabajas en la lección.
¿Necesito experiencia previa para empezar MLOps Academy?
No se requiere experiencia previa. MLOps Academy en CoddyKit está estructurado para principiantes hasta estudiantes avanzados, así que puedes empezar aquí o desde el inicio y avanzar a tu ritmo. Esta es la lección 1 de 4.
¿Cuánto tiempo toma la lección «Divida el tráfico entre versiones del modelo»?
La mayoría de las lecciones de CoddyKit toman alrededor de 5–10 minutos. Cada una es compacta e interactiva, así que avanzas constantemente y retomas exactamente por donde dejaste en la web y la app.
¿Puedo escribir y ejecutar código en esta lección de MLOps Academy?
Sí. Cada lección de MLOps Academy incluye un editor de código integrado, así que escribes y ejecutas código real directamente en tu navegador y obtienes retroalimentación instantánea de IA — sin configuración local necesaria.
Todas las lecciones de este curso
- Divida el tráfico entre versiones del modelo
- Elija las métricas importantes
- Interprete la significancia sin engañarse
- Promueva al ganador o vuelva atrás