LeveredDocs
Concepts

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:

  1. Levered computes the SHA-256 hash of <optimization id>:<id>.
  2. It reads the first 4 bytes of the hash as an unsigned big-endian integer and takes that number modulo 100.
  3. 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 typeHoldout users seeUse when
variant (default)The baseline variantOne of the variants is the current experience.
externalA version that is not one of the variantsThe current experience is not one of the variants.
noneThere is no holdoutAll 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_variant in 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.

Terminal
levered optimizations create ... --control external --holdout 10
  • The app renders the current version when isHoldout is true. 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.
  • external requires 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_idoptimization_idis_holdouttitlecta
user_1236da0…falseba
user_4566da0…trueaa
user_7896da0…trueNULLNULL
  • user_456 is a holdout user who saw the baseline (control type variant).
  • user_789 is a holdout user of an optimization with control type external who 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.