How do you ensure randomization in A/B testing with deterministic hashing and consistent traffic allocation?

Quick Overview

Asks how to randomize users in an A/B test so assignment is stable across visits and servers. Tests deterministic hashing with per-experiment salts, bucket-based traffic allocation and ramp-ups, and checking the split with a sample-ratio mismatch test.

How do you ensure randomization in A/B testing with deterministic hashing and consistent traffic allocation?

Role: Data Scientist

Category: Analytics & Experimentation

Difficulty: medium

Interview Round: Other

How do you ensure randomization in A/B testing, for example with deterministic hashing and consistent traffic allocation? ```hint Stable assignment Think about what an assignment function needs as input so that every server gives the same user the same arm without looking anything up. ``` ```hint Many tests at once Consider what happens when two experiments running at the same time both hash the plain user ID. ``` ### What a Strong Answer Covers - How a stable unit ID and a hash give a stateless, repeatable assignment - Why each experiment needs its own salt, and how mutually exclusive tests are handled - How bucket ranges set the split, and what a ramp-up does to users who are already assigned - How to check that the randomization worked, such as a sample-ratio mismatch test or an A/A test - Pitfalls such as unstable IDs, process-specific hash functions or non-random assignment keys ### Follow-up Questions - Logged-out users only have a cookie ID that is often cleared. How does that affect assignment and the analysis? - During a ramp from 10% to 50% treatment, which users change arms in your scheme, and can that bias the result? - Your sample-ratio check fails with a 50.6/49.4 split on two million users. How do you investigate? - When would you restart an experiment with a new salt?

Overview: Asks how to randomize users in an A/B test so assignment is stable across visits and servers. Tests deterministic hashing with per-experiment salts, bucket-based traffic allocation and ramp-ups, and checking the split with a sample-ratio mismatch test.

General logo
General
Nov 24, 2026
mediumData ScientistOtherAnalytics & Experimentation
0
0

How do you ensure randomization in A/B testing, for example with deterministic hashing and consistent traffic allocation?

What a Strong Answer Covers Guidance

  • How a stable unit ID and a hash give a stateless, repeatable assignment
  • Why each experiment needs its own salt, and how mutually exclusive tests are handled
  • How bucket ranges set the split, and what a ramp-up does to users who are already assigned
  • How to check that the randomization worked, such as a sample-ratio mismatch test or an A/A test
  • Pitfalls such as unstable IDs, process-specific hash functions or non-random assignment keys

Follow-up Questions Guidance

  • Logged-out users only have a cookie ID that is often cleared. How does that affect assignment and the analysis?
  • During a ramp from 10% to 50% treatment, which users change arms in your scheme, and can that bias the result?
  • Your sample-ratio check fails with a 50.6/49.4 split on two million users. How do you investigate?
  • When would you restart an experiment with a new salt?