Behavior versions: a trajectory’s probabilities belong to its actor
Track policy and preprocessing identity, derive a conditional importance ratio, and state support and clipping limits before using stale rollouts.
On this page
The question for today
What you’ll understand
- Record the behavior distribution that actually generated an action.
- Separate version lag from distributional policy distance.
- Derive a simple importance correction and identify support and clipping limitations.
A learner can update faster than actors receive new parameters. A trajectory arriving now may therefore have been generated by an older behavior policy, with different action masks, observation normalization, or exploration settings. A policy version is provenance, not a proof that the data is on-policy. IMPALA explicitly separates acting and learning and introduces V-trace for its off-policy setting. This lesson derives a much smaller conditional importance calculation to expose what metadata and assumptions any such correction needs.
Record the distribution used at action time
Attach an immutable behavior-policy identifier to each rollout or, if the actor can change policy inside it, to each transition. Store the action log probability under the actual behavior distribution, not a probability recomputed later from the learner’s current model. Exploration mixtures, temperature, action masks, action transformations, recurrent context, and observation preprocessing can all change that distribution. For continuous actions, the density must correspond to the actual represented action and transformations. A weight-file digest alone is incomplete if the actor applied a different normalization snapshot or sampling rule.
Define when actors adopt a new snapshot and ensure they do not read half-updated parameter arrays. Freezing behavior within an unroll simplifies provenance, though another design can log per-step versions and contexts. Track environment version, episode identity, model state, and probability metadata together through transport and replay. If an actor reports an impossible zero probability for an action it supposedly sampled, investigate the record rather than stabilize the denominator with an arbitrary epsilon and declare the mismatch corrected.
A version gap does not measure a distribution gap
Subtracting behavior version from learner version gives an update-count lag. The same count can correspond to tiny or enormous probability changes, depending on learning rate, data, architecture, and update behavior. Wall-clock age is another distinct quantity and depends on transport and clock assumptions. Monitor behavior-age distributions, ratios, and relevant divergence diagnostics rather than impose a universal acceptable number of versions. Slow actors can contribute a systematically different task or state distribution, so indiscriminately dropping their rollouts can also change the dataset.
At one fixed history, exact importance weighting can transform a behavior expectation to a target expectation when support and integrability hold. Full trajectory corrections can have large variance, and an action-level identity is not a blanket guarantee for bootstrapped learning. Clipping weights controls magnitude but changes the estimator. IMPALA’s V-trace uses specified truncated ratios and has a correspondingly scoped target and analysis; it is not simply “multiply everything by a capped ratio and get an unbiased on-policy algorithm.” State the chosen estimator and its assumptions explicitly.
Treat stale-data handling as an algorithm choice
An on-policy pipeline can stop admitting old-version rollouts at a batch boundary, while an off-policy learner can retain data with a justified correction and sampling scheme. Both designs need explicit policies for delayed packets, retries, worker restarts, and recurrent sequences. Preserve discarded-data counts and task mix. A queue that is operationally healthy can still deliver data outside the algorithm’s acceptable provenance. Validate the behavior probabilities using a saved actor snapshot on a small replayable fixture before trusting aggregate learning curves.
Use the probability lab for a binary action-frequency analogy. Reset, explicitly set p=0.25 and n=20, predict the mean count, then Play or Step. Compare a fresh Reset with p=0.5 and n=20 explicitly set. The means change from five to ten even though the action-count format is identical. These are known independent Bernoulli distributions, not actor traces, policy updates, importance estimates, or V-trace. Playback does not sample trajectories or infer behavior probabilities from a version number.
Work it through
Clipping a conditional ratio changes the expectation
At one fixed history there are two actions. Behavior probabilities are [0.25,0.75], target probabilities are [0.5,0.5], and f values are [2,0]. Compare unweighted behavior expectation, exact ratio weighting, and a ratio ceiling of 1.5.
The unweighted behavior expectation is 0.25×2+0.75×0=0.5. The target expectation is 0.5×2+0.5×0=1. Both target actions have positive behavior support.
The exact ratios are two for the first action and two-thirds for the second. Weighted behavior expectation is 0.25×2×2+0.75×(2/3)×0=1, matching the target in this conditional fixture.
Capping the first ratio at 1.5 yields 0.25×1.5×2=0.75. The capped result differs from one. This demonstrates the change from clipping; it does not quantify a full trajectory estimator’s variance or prove an algorithm’s convergence.
Exact conditional weighting gives one; the capped calculation gives 0.75. A bounded weight and an unbiased target are different claims.
The living notebook
Explore the model
Interactive lab · probability
An action distribution can change while its array schema stays fixed
Use separate Reset → explicitly set BOTH p and n → predict → Play/Step runs for (.25,20) and (.5,20), with means five and ten. The model has no policy versions, state distribution, importance correction, or sampled rollout transport.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forStore behavior-distribution provenance rather than infer it from a fresh-looking packet or model version.
Pause & reason
Check your understanding
Your turn
Try it yourself
At a fixed history, behavior probabilities are [0.5,0.5], target probabilities [0.75,0.25], and f=[4,0]. Compute the exact ratios and weighted expectation. What does a behavior version 41 versus learner version 45 tell you?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Compute ratios from probabilities, and interpret the version difference only as metadata about update count.
Compare with the solution
The ratios are 1.5 and 0.5. The weighted expectation is 0.5×1.5×4=3, matching the target expectation 0.75×4. The version gap is four updates; it supplies neither those probabilities nor a universal bound on policy divergence, variance, or acceptable staleness. Verify the actor’s actual probabilities, preprocessing, masks, and context. A conditional identity at one history does not remove arbitrary state-distribution mismatch in a complete off-policy trajectory.
Keep the idea
Take it with you
- Record the actual behavior distribution and immutable snapshot identity.
- Distinguish update-count lag from policy-distribution mismatch.
- State support, variance, and clipping effects for the chosen estimator.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.