Experiment guardrails
Checks that protect users and the validity of a running experiment.
Experiment guardrails include guardrail metrics, sample ratio mismatch checks and rules for when to stop. They catch broken assignment and changes that harm the product while improving the target metric. Peeking at results and stopping early is a common way to fool yourself.
Why it matters for a product engineer
A running experiment can go wrong in two ways. It can hurt users while the target metric improves. Or it can be broken, so its numbers mean nothing. Guardrails catch both. The second kind is usually a bug in assignment, logging or data processing, which is the product engineer’s own area.
How to do it
- Choose guardrail metrics that must not get worse, such as revenue, errors, page speed and unsubscribes.
- Decide how much harm is acceptable before the test. Spotify calls this the non-inferiority margin. For example, ship only if there is evidence that sales do not fall by more than 1%.
- Check the sample ratio before anyone reads results. Compare the number of users in each group with the planned split, using a statistical test such as chi-square.
- If the check fails, find the cause first. Look at segments, and at the condition that decides who is counted in the analysis.
- Set the stopping rule in advance. Do not stop because one day’s result looks good.
Common mistakes
- Reading results before the sample ratio check.
- Judging the ratio by eye instead of testing it.
- Guardrails with no threshold, so every decision becomes a debate.
- Stopping early on a good day.
Example
A team at MSN tested an image carousel with 16 cards instead of 12. The results showed lower engagement, with a warning that the groups did not match the planned split. An investigation found the cause. People who saw 16 cards engaged so much that a bot detection algorithm removed them from the analysis. When the problem was fixed, the result reversed: the extra cards increased engagement.
How often experiments fail the sample ratio check
- 6%
- Microsoft experiments
- In a recent analysis
- 10%
- LinkedIn experiments
- About, in the past, for tests that count only some users
A broken experiment is common, not rare. At Microsoft, every test must pass this check before anyone sees its results.
ReportedMicrosoft Experimentation Platform, 14 Sep 2020
Sources: Diagnosing sample ratio mismatch in A/B testing (Microsoft Experimentation Platform) ↗ · Better product decisions with guardrail metrics (Spotify, Confidence) ↗ · Guardrail metrics for A/B tests, explained (PostHog) ↗
Resources
3- articleStart here
Guardrail metrics for A/B tests, explained ↗
PostHog · 5 minWritten for product engineers. What guardrail metrics are, which ones to pick, and how companies such as Airbnb use them.
- articleGo deeper
Diagnosing sample ratio mismatch in A/B testing ↗
Microsoft Experimentation Platform · 2020 · 12 minThe check that catches broken experiments before anyone reads the results, with a taxonomy of the causes.
- articleGo deeper
Better product decisions with guardrail metrics ↗
Spotify (Confidence) · 2024 · 8 minHow Spotify uses inferiority tests on guardrail metrics to decide when a change should be rolled back.
Tools
4- ToolOpen source
GrowthBook
Open-source feature flags and A/B testing that analyzes results from your own data warehouse.
- ToolFreemium
Statsig
Feature flags, experiments and product analytics with built-in statistics such as variance reduction.
- ToolOpen source
PostHog
Open-source product analytics with session replay, feature flags, experiments and surveys in one tool.
- ToolFree
Evan's Awesome A/B Tools
Free calculators for sample size, significance of results and sequential tests.