Skip to main content

Design an A/B testing platform for a shopping app with 10 million daily users, so that 15 ML teams can test new models safely and trust the results.

System design · Pro 2

Short answer

Clarify the unit of randomisation, the main metric and the guardrail metrics. Then: stable hashing to assign users, layers so many experiments run together, exposure logging, a metrics pipeline with standard statistics, sample size planning before launch, automatic guardrail alerts with a kill switch, and checks such as sample ratio mismatch.

Deeper answer

Start with what teams need: to compare a new model with the current one on business metrics, without hurting users and without each team building its own statistics. Agree on the unit, usually the user, and on a primary metric and guardrails such as latency, crashes and returns.

Main parts: an assignment service hashes the user id with an experiment salt, so a user always sees the same variant. Experiments are placed in layers. Experiments in different layers overlap, and experiments in the same layer split traffic, so two ranking tests do not interfere. Every exposure is logged with the model version. A metrics pipeline joins exposures to outcomes and reports the difference with confidence intervals. Before launch, a power calculation gives the sample size and duration. Models start at one percent of traffic and ramp up.

Trade-offs: stopping early when results look good inflates false positives, so use a fixed duration or a sequential method. Trust checks include A/A tests and sample ratio mismatch alerts. At scale, the first problems are interference between experiments, novelty effects, and marketplace effects where one user's treatment changes another user's result.

What a strong answer covers

Answer it out loud in the mock interview about 2.5 min

Follow-ups to expect

Common mistakes

Learn it

Online evals and feedback

Practice System design questions

More on this topic

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.