Interaction Data and Passive Observation › Agent-Collected Trajectories

Michael BrenndoerferJuly 3, 20267 min read
World Models HandbookAll chapters
Part 6 of 12Learning World Models at Scale
Chapter 33Interaction Data and Passive Observation › Agent-Collected Trajectories
Reading section 2 of 10 · Agent-Collected Trajectories · 7 minSection 2 of 10 · 7 min

Book contents

Section 2 of 10 · 7 min read

Interaction Data and Passive Observation › Agent-Collected TrajectoriesOne section · Sections in this chapter2 / 10 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Action-conditioned control models are commonly trained or grounded on trajectories produced by an agent, operator, or simulator. We represent an interactive environment as a Markov decision process (S,A,P,R,γ)(\mathcal{S}, \mathcal{A}, P, R, \gamma), where S\mathcal{S} is the state space, A\mathcal{A} is the action space, P(s′∣s,a)P(s' \mid s, a) is the transition kernel, R(s,a)R(s, a) is the reward function, and γ\gamma is the discount factor, as formalized in Part II: Inference, Decisions, and Control. An agent trajectory is a sequence

τ=(s0,a0,r0,s1,a1,r1,…,sT),\tau = (s_0, a_0, r_0, s_1, a_1, r_1, \dots, s_T),

where:

  • τ\tau: a trajectory, i.e., a sequence of states, actions, and rewards from time 00 to terminal time TT
  • sts_t: the state observed at time tt
  • ata_t: the action selected at time tt
  • rtr_t: the reward received after taking action ata_t in state sts_t
  • TT: the terminal time index of the trajectory

sampled by an iterative loop: observe state sts_t, choose action at∼β(⋅∣st)a_t \sim \beta(\cdot \mid s_t), receive reward rtr_t and next state st+1∼P(⋅∣st,at)s_{t+1} \sim P(\cdot \mid s_t, a_t). A dataset D\mathcal{D} of trajectories is a collection of such sequences. The loop is the same primitive that appears throughout the book, from filtering and control in Part II to planning in Part VII. What changes between chapters is not the loop itself but the assumptions we make about the data it produces and the questions we ask of the resulting model.

Three distinct stochastic processes produce a trajectory dataset, and conflating them is a common source of confusion:

  • The environment transition kernel P(s′∣s,a)P(s' \mid s, a): the physical or logical dynamics we want the world model to learn.
  • The behavior policy β(a∣s)\beta(a \mid s): the rule used to choose actions during data collection. This may be a heuristic, a random policy, a human operator, or a previous learned agent.
  • The initial-state distribution ρ(s0)\rho(s_0): where episodes begin.

A world model trained on D\mathcal{D} is learning to approximate PP under the marginal state-action distribution dβ(s,a)d^{\beta}(s, a) induced by β\beta and ρ\rho. Outside that support, internally consistent predictions can still be wrong. The environment kernel describes the dynamics; the behavior policy and initial-state distribution describe how we chose to look at those dynamics. All three matter when we assess what the dataset can identify.

Behavior Policy

The behavior policy β(a∣s)\beta(a \mid s) is the action-selection rule that generated the data. It may differ from the target policy π(a∣s)\pi(a \mid s) used at deployment. When β≠π\beta \neq \pi, the dataset is off-policy; whether a harmful coverage gap appears depends on how their induced state-action occupancies overlap.

What interaction data contains

Interaction data records which command was applied before each transition (st,at,st+1)(s_t, a_t, s_{t+1}). Under an important condition, this can supply interventional evidence: the logged state or history must include the information used to choose the action, and the action-selection randomization must be independent of unobserved transition disturbances after conditioning on that information. The behavior policy is still state-dependent, since at∼β(⋅∣st)a_t \sim \beta(\cdot\mid s_t); "controlled" does not mean "independent of state." If an operator uses an unlogged sensor or private intent, interaction logs can be confounded in the same way as observational data. With the condition satisfied, varying ata_t lets us estimate how the agent's available controls change the next-state distribution rather than relying only on observed correlations.

Three concrete consequences:

  • Counterfactual reasoning. Given an action-grounded model of P(s′∣s,a)P(s' \mid s,a) learned under the stated no-unobserved-confounding condition, the agent can compare candidate commands. Observational actions can support the same conditional effect only when an identification assumption such as conditional ignorability is justified.
  • Targeted exploration. The agent controls the data it will collect. As discussed in Part VII, Ch 5: Active Perception, Dual Control, and Exploration, it can deliberately choose trajectories that reduce model uncertainty in regions the planner will visit.
  • Reward and value signal. A collection system can record or construct rewards alongside interaction trajectories, enabling control-oriented objectives. The action log alone does not guarantee that reward labels are present.

Interaction can be expensive: real robots wear out, human operators require time, and simulators require engineering. The behavior policy shapes the resulting distribution. An uncertainty-seeking explorer may emphasize novel regions, while a deployed policy may spend more time in routine states. That mismatch is not inevitable, but it must be measured rather than inferred from the label "exploration data."

Trajectory datasets in practice

Offline model-based RL uses a fixed trajectory dataset, while off-policy online methods may use a growing replay buffer. Both store transitions of the form

D={(st(i),at(i),rt(i),st+1(i),donet(i))}i=1N,\mathcal{D} = \{ (s_t^{(i)}, a_t^{(i)}, r_t^{(i)}, s_{t+1}^{(i)}, \mathrm{done}_t^{(i)}) \}_{i=1}^{N},

where:

  • D\mathcal{D}: the trajectory dataset containing NN transitions
  • ii: the transition index
  • tt: the time index associated with transition ii
  • NN: the number of transitions in the dataset
  • st(i)s_t^{(i)}: the state at time tt for transition ii
  • at(i)a_t^{(i)}: the action applied in that state
  • rt(i)r_t^{(i)}: the reward received
  • st+1(i)s_{t+1}^{(i)}: the resulting next state
  • donet(i)∈{0,1}\mathrm{done}_t^{(i)} \in \{0, 1\}: a terminal indicator equal to 1 when the transition ends an episode and 0 otherwise

For a one-step supervised objective, implementations often flatten trajectories into transition records and shuffle them into minibatches. This changes how the optimizer samples the replay buffer, but it does not make transitions independent: adjacent records were produced by the same Markov chain. Stationarity keeps the marginal distribution fixed, while independence is a separate assumption. Temporal mixing and episode structure therefore affect the effective sample size even when the loss is written as an average over individual transitions.

Stationarity Assumption

Writing every transition with the same marginal distribution dβ(s,a)P(s′∣s,a)d^{\beta}(s, a) P(s' \mid s, a) assumes the behavior policy and environment were stationary during collection. If the environment drifts (for example, a robot's friction changes as it warms up), or the behavior policy adapts during collection, the pooled dataset is a mixture over times or policies instead. A model can still be trained on that mixture, but its loss no longer describes samples from one fixed occupancy distribution.

These assumptions are worth stating explicitly because they are frequently implicit in the training code.

  • Markov. st+1s_{t+1} depends on the full history only through (st,at)(s_t, a_t). If the observed state is only a proxy for the true state, the correct model is over a belief state, as discussed in Part II, Ch 2: Bayesian Filtering and Belief States.
  • Stationary. The transition kernel does not change over time or episodes.
  • Deployment coverage. The behavior-induced occupancy places enough probability near the state-action pairs the planner will query. Ergodicity of the behavior-induced Markov chain alone does not guarantee this target-relative coverage.

These are separate checks, and each can fail on its own. A process can be stationary but poorly covered, or well covered for a target while its observation is non-Markov. Naming the checks separately makes deployment failures easier to diagnose.

Two flavors of interaction data

Interaction datasets come in two practically distinct forms, and they impose different training protocols:

  • On-policy data is generated by the policy being evaluated or updated. Many policy-gradient and actor-critic procedures collect such batches. The data can support multiple optimization epochs, but after the policy changes it is no longer exactly on-policy; excessive reuse can increase the mismatch between the sampling and updated policies.
  • Off-policy data is generated by a different behavior policy, often an older version of the same agent, a hand-designed explorer, or a heterogeneous pool of policies. It can be retained and reused, although stale or low-quality transitions may still be filtered. Its behavior mixture determines a coverage distribution that must be measured rather than assumed.

The distinction between the two flavors concerns whether the data-generating policy matches the policy currently being evaluated. On-policy collection reduces that immediate mismatch but requires new collection as the policy changes. Off-policy collection permits reuse, but training and evaluation must account for where the behavior distribution places mass.

The Data Curation and Synthetic Data chapter (Part VI, Ch 4) will discuss how to filter, weight, and curate these datasets at scale. For now, the key point is that "I have interaction data" is not a specificity claim: what actions, in what states, under what behavior?