Skip to content

Sample ratio mismatch (SRM): how to check your A/B test and fix it

Stuart Brameld

Stuart Brameld

Founder
Updated
Contents

Sample ratio mismatch (SRM) is the single cheapest check you can run on an A/B test, and the one that catches the most broken results. If your test was set to split traffic 50/50 and it didn’t, the result is very likely wrong, however significant it looks.

This guide shows how to check for SRM with a worked example, which free tools do it for you, and where to look when you find one.

Table of contents

What sample ratio mismatch means

Sample ratio mismatch is when the number of visitors in each variant of an A/B test differs from the split you configured by more than chance can explain. It signals a fault in how visitors are assigned, served or tracked, and in most cases it makes the test result unusable.

A small gap is normal. Randomisation never gives an exact 50/50, so 5,050 against 4,950 is fine. The question is whether the gap is bigger than randomness would produce, and that is what an SRM check answers.

“Just like fever is a symptom for multiple types of illness, an SRM is a symptom for a variety of data quality issues.”

Aleksander Fabijan and colleagues, Diagnosing Sample Ratio Mismatch in Online Controlled Experiments, Microsoft and Booking.com, KDD 2019

Why it matters more than the p-value

An SRM means the visitors in control and the visitors in the variant are no longer comparable groups. If the variant’s page loads slowly and impatient visitors leave before tracking fires, the variant ends up with fewer, more patient visitors. Its conversion rate rises, and the change you made had nothing to do with it.

That is why an SRM outranks every other number in the report. A significant p-value on a test with an SRM is a precise answer to the wrong question.

“While there are many data quality issues that could decrease the validity and significance of a controlled experiment, Sample Ratio Mismatch in most cases completely invalidates experiment results.”

Aleksander Fabijan and colleagues, KDD 2019

It isn’t rare either. The same paper found that approximately 6% of experiments at Microsoft showed an SRM, and cites LinkedIn finding one in about 10% of its triggered analyses. Teams with less mature tooling than Microsoft’s are unlikely to do better.

How to check for SRM: a worked example

The check is a chi-square goodness-of-fit test. You only need two things: the split you configured and the number of visitors who ended up in each variant. You don’t need conversions.

Say a test was set to 50/50 and ran on 20,000 visitors.

ScenarioControlVariantChi-squarep-valueSRM?
Normal noise5,0504,9501.00.32No
Borderline5,1004,9004.00.046No (above 0.001)
Broken split10,2509,75012.50.0004Yes

The broken split is only 51.25% against 48.75%. That looks harmless on a dashboard, which is exactly why SRMs go unnoticed. With large samples the gap can be smaller still: the KDD paper shows a 50.2/49.8 split (821,588 against 815,482 users) that had less than a 1 in 500,000 chance of happening by chance.

Use a threshold of 0.001, not the usual 0.05. You run this check on every test, so a strict threshold keeps false alarms rare. Analytics Toolkit’s SRM calculator uses the same cut-off.

“An observed p-value lower than 0.001 should be solid ground for suspecting the trustworthiness of the test outcome.”

Analytics Toolkit, SRM calculator documentation, by Georgi Georgiev

Free SRM checkers

You don’t need to do the maths by hand.

  • Lukas Vermeer’s SRM checker. Free, from one of the authors of the KDD paper. Enter the expected split and the counts. His Chrome extension has been retired, but the manual checker still works.
  • Speero’s A/B test calculator. Free. It shows an SRM alert alongside the significance result, so you see both at once.
  • ABTestResult’s MCP server. Its check_srm tool lets an AI assistant run the check in real statistics code rather than estimating it. Its licence covers personal use; business use needs a separate licence.
  • Analytics Toolkit. Handles A/B/n tests and unequal splits, such as 20/80. Paid after a 30-day free trial.
  • Your testing tool. Many platforms now run the check for you. Lukas Vermeer retired his extension partly because “most major experimentation platforms now include built-in SRM checks”. Find out whether yours does, and where it shows the warning.

For a side-by-side comparison of these and other calculators, see our guide to A/B test calculators.

Common causes of SRM

The KDD paper lists 25 distinct causes. Most marketing tests hit one of these:

  • Assignment bugs. The code or tool that buckets visitors gives one variant slightly more traffic than configured.
  • Redirect tests. Split URL tests lose some visitors on the redirect, and usually only on one side.
  • Slower or crashing variants. If one variant loads more slowly, more visitors leave before the tracking event fires, so that variant looks smaller.
  • Bot filtering. Bots are filtered after assignment, and the variant changes how many look like bots.
  • Targeting and triggering. An analysis that only counts visitors who reached a certain step can drop people unevenly if the variant changes how many reach it.
  • Manual overrides. Someone forces visitors into one variant, for example by sending a paid campaign straight to the variant URL.
  • Cookies and devices. Visitors who clear cookies or switch devices are counted twice, more often on one side.

How to find the cause

When a check fails, slice the data before you change anything. These rules of thumb come from the KDD paper:

  1. Check it across segments. If only one browser, device or country shows the mismatch, the cause is local to it.
  2. Check it over time. An SRM that is strongest on day one and fades suggests caching or one variant starting later.
  3. Check performance. If the variant is slower or crashes more, lost tracking is the likely cause.
  4. Check the filters. If the mismatch appears only in a filtered or triggered analysis, relax the filter and see where it starts.

Then fix the cause and rerun the test. Don’t try to re-weight the old result.

How to keep SRM out of your tests

  • Check SRM before reading any result. Make it the first step in your analysis, not an afterthought.
  • Run an A/A test when you set up a new tool or a new type of test, and check it for SRM.
  • Avoid redirects where an in-page change will do.
  • Don’t force visitors into variants outside of QA.
  • Keep one variant’s speed in line with control, or track page speed as a guardrail metric.

If you’re unsure whether to read your result with a frequentist or Bayesian method, it doesn’t matter here: an SRM breaks both.

About Growth Method

An SRM check is one of the questions every analysis should ask before a result is trusted.

Growth Method is the practical way to use AI in marketing. Our agents suggest campaigns from your own data, then help you plan, launch and analyse them, with no AI vendor lock-in, security taken care of and humans in the loop. At the analyse step, the AI checks whether a result can be trusted before it gives a verdict.

We are on-track to deliver a 43% increase in inbound leads this year. There is no doubt the adoption of Growth Method is the primary driver behind these results.

Laura Perrott, Colt Technology Services

Get started and make sure the next winner you report is a real one.

Keep reading