Tune contextual bandits with period weighting and exploration
You can now tune how GrowthBook updates contextual bandit weights with two optional settings, both off by default. Period weighting corrects results when the mix of users shifts over time. A prior sample size makes a bandit more cautious, so it explores more.
Weight results across update periods
As a bandit moves traffic, each variation collects a different mix of early and recent users. That mix can make two identical variations look different. With period weighting on, GrowthBook groups users into cohorts by the period of their first exposure, then weights the data by cohort shares.
- The setting applies to every contextual bandit in your organization. You can't set it per bandit.
- Your Contextual Bandit Assignment Query must select
bandit_version, which GrowthBook uses to identify each period. - Only bandits created after period weighting shipped are eligible. They pick up the change on their next refresh.
- Weighting reduces bias from shifting traffic but adds some variance to your decision metric estimates.
Multi-armed bandits already weight results across periods by default, independent of this setting.
Explore more with a prior sample size
By default, each variation's posterior comes only from its own data. The bandit starts favoring a variation as soon as a difference appears. A prior sample size pulls every variation's mean toward a shared mean, which flattens the weights. Larger values explore more.
You set the prior sample size per bandit, and you can change it while the bandit runs. The new value takes effect on the next refresh. Turning exploration back off returns each variation to its own independent posterior.
Getting started
Contextual bandits are an Enterprise beta feature. For period weighting, go to Settings → General → Bandit Settings, enable Weight results across update periods, and save. For exploration, open Edit Analysis & Metrics on the bandit's page, turn on Increase Bandit exploration, and set Prior variation sample size. That value defaults to 50. The contextual bandit setup guide covers both settings.