research29 min studyLesson 643 in Engineering

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

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.

ρt=π(at∣ht)μ(at∣ht),μ(at∣ht)>0\rho_t=\frac{\pi(a_t\mid h_t)}{\mu(a_t\mid h_t)},\qquad\mu(a_t\mid h_t)>0
μ is the behavior distribution and π the target distribution at the same defined history h. The ratio is dimensionless. Correcting a target distribution requires behavior support wherever that target assigns positive probability or density; this one-action ratio alone does not correct arbitrary state-distribution mismatch.↔ Scroll wide equations horizontally.

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.

Ea∼μ[ρ(a)f(a)]=Ea∼π[f(a)],ρˉ=min⁡(c,ρ)\mathbb E_{a\sim\mu}[\rho(a)f(a)]=\mathbb E_{a\sim\pi}[f(a)],\qquad\bar\rho=\min(c,\rho)
The expectation identity is conditional on one fixed history, adequate behavior support, and finite relevant expectations. c>0 is a chosen clipping ceiling. Replacing ρ with capped ρ generally breaks this exact identity; support gaps cannot be repaired by a finite clip.↔ Scroll wide equations horizontally.

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.

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.

  1. 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.

  2. 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.

  3. 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.

The result

Exact conditional weighting gives one; the capped calculation gives 0.75. A bounded weight and an unbiased target are different claims.

Explore the model

Interactive lab

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.

An action distribution can change while its array schema stays fixedThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

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.

Check your understanding

A target policy assigns positive probability to an action that the behavior policy never takes at the same history. What follows?

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.

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.