Sample Ratio Mismatch (SRM) is a critical validity check in online controlled experiments that detects when the observed user allocation between variants deviates statistically from the pre-specified randomization ratio. It is the first diagnostic run on any A/B test, as a failure indicates a fundamental breakdown in the randomization pipeline—such as bot traffic filtration, residual bias in a hash function, or a bug in the experiment configuration service—rendering downstream metric comparisons invalid.
Glossary
Sample Ratio Mismatch

What is Sample Ratio Mismatch?
A diagnostic check verifying that the observed traffic split between control and treatment groups matches the intended randomization ratio, serving as a primary guardrail for detecting bugs in experimentation infrastructure.
SRM is detected using a Chi-Squared Test comparing observed counts against expected counts. A significant p-value signals that the traffic diversion mechanism is broken, often due to treatment group crashes causing differential dropout or instrumentation errors silently dropping users from one variant. Unlike metric movements, SRM is a non-negotiable invariant; a failed SRM check requires immediate experiment termination and a root-cause investigation into the feature flag delivery system before any causal conclusions can be drawn.
Frequently Asked Questions
Critical diagnostic checks that validate the integrity of your A/B testing infrastructure before you trust the results.
A Sample Ratio Mismatch (SRM) is a diagnostic check that verifies whether the observed traffic split between control and treatment groups matches the intended randomization ratio, serving as a primary guardrail for detecting bugs in the experimentation infrastructure. It works by comparing the actual number of users assigned to each variant against the expected allocation using a Chi-Squared Goodness of Fit test. For example, if you configure a 50/50 split but observe 5,100 users in control and 4,900 in treatment, the SRM check calculates a p-value to determine if this deviation is statistically significant or just random noise. A significant p-value (typically < 0.001) triggers an alert, indicating a critical failure in the randomization pipeline—such as a hash collision, a misconfigured load balancer, or a bot filtering rule that asymmetrically drops users from one variant. SRM is the first metric any experimentation platform should evaluate before analyzing treatment effects because if the randomization is broken, all downstream causal conclusions are invalid.
How Sample Ratio Mismatch Detection Works
Sample Ratio Mismatch (SRM) is a diagnostic check that verifies if the observed traffic split between control and treatment groups matches the intended randomization ratio, serving as a primary guardrail for detecting bugs in the experimentation infrastructure.
Sample Ratio Mismatch detection operates by applying a Chi-Squared Test to compare the expected user counts against the observed user counts in each experimental variant. If the p-value falls below a strict threshold, typically 0.001, the test signals an SRM, indicating a critical failure in the randomization pipeline, such as a bot filtering bias or a faulty hash function, rather than a natural statistical fluctuation.
This diagnostic serves as a non-negotiable pre-condition for analyzing any Online Controlled Experiment. An SRM invalidates all downstream metric calculations because the treatment and control populations are no longer statistically equivalent. Common root causes include residual Data Leakage from test rollouts, browser redirect loops, or crashes in a specific variant that prevent users from being properly assigned and tracked.
Key Characteristics of SRM
Sample Ratio Mismatch (SRM) is the primary canary in the coal mine for your experimentation platform. It verifies that the observed traffic split matches the intended randomization ratio, catching bugs in hashing algorithms, bot filtering, and variant assignment before they silently invalidate your results.
The Chi-Squared Sentinel
SRM detection relies on a Pearson's Chi-Squared test comparing observed user counts against expected counts. If you intend a 50/50 split but observe 50,100 in control and 49,900 in treatment, the test quantifies the probability this deviation is due to chance. A p-value below 0.001 typically triggers an automatic alarm, halting the experiment. This is not a metric evaluation; it is a pre-statistical infrastructure check that must pass before any analysis of lift or significance is valid.
Common Root Causes
SRM rarely indicates a problem with your model. It almost always signals a pipeline bug upstream of the analysis:
- Hashing Collisions: A non-uniform randomization seed causing deterministic bias in variant assignment.
- Residual Bot Traffic: Automated scrapers or click-farm traffic that bypasses your bot detection, artificially inflating one variant.
- Funnel Filtration: A downstream filter (e.g., 'active users only') that differentially removes users from one variant due to a performance bug.
- Telemetry Loss: A logging outage in one data center causing systematic data loss for a specific treatment group.
SRM vs. AA Test
While related, these are distinct validation layers:
- SRM Check: A continuous, automated monitor running on every live experiment. It uses a simple count of randomized units to detect assignment failures.
- AA Test: A deliberate, time-bound experiment where both groups receive the identical control experience. It validates the entire metric computation pipeline, ensuring no false positives arise from variance in metric definitions. An AA test can pass while SRM fails if the assignment is broken but the metric logging is consistent.
Severity Thresholds
Not all mismatches are fatal. The severity is a function of sample size and deviation magnitude:
- Tiny Sample: A 0.1% deviation on 1,000 users is likely noise.
- Massive Sample: A 0.1% deviation on 100 million users is almost certainly a systemic bug. The Chi-Squared statistic is sensitive to sample size, correctly flagging trivial percentage deviations as critical when the absolute user count is large enough to rule out random chance.
The SUTVA Connection
SRM can be an early symptom of a Stable Unit Treatment Value Assumption (SUTVA) violation. In social networks or ride-sharing marketplaces, if a treatment user invites a control user to the app, the control user's experience is contaminated. This 'interference' can manifest as a traffic imbalance because the treatment group is effectively 'generating' new users who are then incorrectly bucketed, skewing the observed ratio.
Remediation Protocol
When the SRM alarm fires, the experiment is immediately quarantined. The standard triage workflow:
- Freeze Traffic: Stop the experiment to prevent further data corruption.
- Segment Diagnosis: Slice the mismatch by platform (iOS vs. Android), browser, or geography to isolate the faulty component.
- Hash Audit: Verify the randomization seed and salt used by the experimentation library.
- Bot Replay: Run the logged traffic through a secondary, stricter bot-detection model. Results from an SRM-flagged experiment are statistically unusable and must be discarded.
SRM vs. Other Experimentation Guardrails
A comparison of Sample Ratio Mismatch against other critical validation checks used to ensure the integrity of online controlled experiments.
| Guardrail | Sample Ratio Mismatch | A/A Test | Minimum Detectable Effect |
|---|---|---|---|
Primary Function | Validates traffic split integrity | Validates Type I error rate | Validates test sensitivity |
Detection Target | Buggy randomization or data pipeline filtering | Systematic bias in metric calculation | Underpowered experiment design |
Statistical Test | Chi-Squared Goodness of Fit | Two-Sample T-Test | Power Analysis |
Null Hypothesis | Observed ratio equals intended ratio | No difference between identical groups | Effect is smaller than detectable threshold |
Timing | Continuous monitoring during experiment | Pre-experiment infrastructure validation | Pre-experiment design phase |
Failure Consequence | Invalidates all downstream metric results | Inflated false positive rate | Inability to detect true effects |
Automated Alerting | |||
Typical Threshold | p < 0.001 | p > 0.05 for metric parity | 80% statistical power |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Sample Ratio Mismatch (SRM) is a critical diagnostic for data quality. The following concepts are essential for understanding, detecting, and resolving the underlying causes of SRM in online controlled experiments.
Chi-Squared Test for SRM
The primary statistical tool for detecting a Sample Ratio Mismatch. It compares the observed user counts in each variant against the expected counts based on the intended traffic allocation. A significant p-value (typically < 0.001) indicates a severe randomization failure. The test statistic is calculated as the sum of (Observed - Expected)² / Expected across all variants. A non-significant result does not guarantee the absence of bugs, but a significant result is a definitive stop signal.
Guardrail Metric
An organizational metric monitored to ensure a new feature doesn't cause unintended harm. SRM is often the very first guardrail metric checked in an experiment. If the sample ratio is mismatched, all other metric calculations—such as conversion rates or revenue per user—are likely invalid due to systematic bias. Other guardrails include latency, crash rates, and gross merchandise volume.
Data Pipeline Bugs
The most common root cause of SRM. Bugs can occur at any stage of the data pipeline:
- Logging: Treatment events are dropped due to rate limiting or malformed payloads.
- ETL: A join key is missing, systematically filtering out users from one variant.
- Bot Filtering: Aggressive bot detection incorrectly classifies automated traffic from a specific treatment as invalid.
- Residual Data: Data from a previous experiment is not properly flushed, contaminating the new assignment.
Interference Effect
A violation of the Stable Unit Treatment Value Assumption (SUTVA) where the treatment of one user influences the outcome of another. In two-sided marketplaces, a heavy discount treatment for riders might attract all available drivers, degrading the experience for the control group. This can manifest as an SRM if users in the control group churn or switch devices to gain access to the treatment, artificially inflating the treatment group's size.
Stratified Sampling
A randomization technique that divides the population into homogeneous subgroups (strata) before assigning treatments. If stratification is implemented incorrectly—for example, using a faulty hash function for assignment—it can cause a Sample Ratio Mismatch within specific segments even if the global ratio appears correct. Properly implemented, it reduces variance and prevents covariate imbalance.
Peeking Problem
The statistical bias introduced when an experimenter checks interim results and stops the experiment early upon seeing a significant result. While SRM is a continuous monitoring check, it is not subject to the peeking problem in the traditional sense because it is a diagnostic for data integrity, not a primary metric. An SRM test should be run continuously from the first hour, and any significant result requires immediate investigation regardless of the experiment's planned duration.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us