Holdout
Who is in the holdout, what they see, how to log their exposures, and how the holdout affects training and the holdout test.
The holdout is a share of users that the model does not optimize for. Levered compares the holdout with all other users to measure the effect of the optimization (holdout test).
The holdout percentage is set when the optimization is created. The default is 10%. The allowed range is 0 to 50%.
Who is in the holdout
Levered assigns a user to the holdout based on the id that the app passes to the SDK (anonymousId) or to /serve (anonymous_id). It computes the assignment from the id on each request:
- Levered computes the SHA-256 hash of
<optimization id>:<id>. - It reads the first 4 bytes of the hash as an unsigned big-endian integer and takes that number modulo 100.
- If the result is below the holdout percentage, the user is in the holdout.
For one optimization, the same id is assigned to the same group on every request. With a 10% holdout, about one id in ten is in the holdout. Each optimization assigns users independently of other optimizations. Individual users cannot be placed in the holdout or excluded from it.
Each serve response contains the group of the user: is_holdout in the /serve response, isHoldout in the exposure event of the SDK.
The id column of the exposure table must contain the same id that the app passes to the SDK. If the app calls the SDK with a user id and the id column contains a device id, Levered cannot match rewards to exposures, and the holdout comparison assigns users to the wrong group. levered verify <optimization-id> checks this before launch (Test before launch).
What holdout users see
The control type defines what holdout users see. Set it when creating the optimization, with --control on levered optimizations create or control_type in the API.
| Control type | Holdout users see | Use when |
|---|---|---|
variant (default) | The baseline variant | One of the variants is the current experience. |
external | A version that is not one of the variants | The current experience is not one of the variants. |
none | There is no holdout | All variants are new. |
The control type and the holdout percentage can only be changed while the optimization is a draft.
variant
One of the variants is the current experience. This variant is the baseline, and Levered serves it to holdout users.
- Name the baseline when you create the optimization, with
--baseline '{"title":"b","cta":"a"}'(baseline_variantin the API). The value must contain one level for each factor. Levered never picks one for you. - For a holdout user, the SDK returns the baseline with
isHoldout: true. The app renders it like any other variant.
external
Holdout users keep a version that is not one of the variants. An example is a legacy component that stays in place while all variants use a redesign.
levered optimizations create ... --control external --holdout 10- The app renders the current version when
isHoldoutistrue. The returned variant has no factor values ({}). - Log the exposure as for other users, with
is_holdout = true. The factor columns can be left empty (NULL). - Levered trains holdout users as the current version, based on the hash of their id, regardless of the values in the exposure row. The current version never counts towards a variant. The model estimates it with the same time and segment adjustments as the variants, and the current lift is estimated against it.
- The holdout test compares the users that the model served with the holdout. Its result is the gain over the current version.
externalrequires a holdout above 0%.
If holdout users see a version that is not one of the variants, use external. With variant, the rewards of holdout users are used to train the baseline variant, although these users did not see it.
none
All variants are new, for example on a new screen or in a new flow. Create the optimization with --control none.
- The optimization has no holdout and no guardrails.
- The current lift is estimated against an even split of traffic across the variants.
Training and the holdout test
Training uses the first exposure of each user, if its factor values are levels of the optimization.
- With control type
variant, training includes holdout users. They saw the baseline, so their outcomes are observations of the baseline. - With control type
external, holdout users train the model as the current version, a design with none of the levels, never as a variant.
The holdout test compares the users in the holdout with the users that the model served. It uses one row per user and groups users by the hash described above. See Holdout Test for the estimator and a query that reproduces it.
Logging holdout exposures
Log an exposure for holdout users in the same way as for other users, and add an is_holdout column:
| anonymous_id | optimization_id | is_holdout | title | cta |
|---|---|---|---|---|
user_123 | 6da0… | false | b | a |
user_456 | 6da0… | true | a | a |
user_789 | 6da0… | true | NULL | NULL |
user_456is a holdout user who saw the baseline (control typevariant).user_789is a holdout user of an optimization with control typeexternalwho saw the current version.
Levered computes lift without the is_holdout column. The column is useful for your own analysis. levered verify also uses it to check that the id column contains the id that the SDK was called with: almost all rows with is_holdout = true should hash into the holdout.