liveBook · Manning

Trajectory

As explained in Reinforcement Learning from Human Feedback

An episode is a finite sequence of interaction steps experienced by an agent during one trial.

A trajectory is the complete sequence of states, actions, and rewards experienced by an agent during a finite episode: τ = (s₀, a₀, r₀, s₁, a₁, r₁, …, sₜ, aₜ, rₜ). An initial-state distribution, policy, and environment dynamics jointly induce its probability. section 3.1

A trajectory records the interaction loop and supports optimization:

  • The policy selects an action from the current state, π(aₜ|sₜ). section 3.1
  • The environment produces a reward and transitions to the next state according to p(sₜ₊₁|sₜ,aₜ). section 3.1
  • The agent evaluates accumulated discounted rewards through the return and updates the policy toward higher expected return. section 6.2
  • In RLHF, one prompt and one completion form a single-step trajectory or rollout, usually receiving response-level reward with γ = 1. section 3.1.3

CartPole rollout

A CartPole trajectory contains cart position and velocity, pole angle and angular velocity, left or right force actions, per-step rewards, and physics-based transitions. The episode ends when the pole or cart violates its bounds; repeated trajectories let the policy learn corrective pushes that keep the pole balanced longer. section 3.1.2

Equation 3.1
\[\label{eq:rl_dynam} {p_{\pi}(\tau)=\rho_0(s_0)\prod_{t=0}^{T-1}\pi(a_t\mid s_t)p(s_{t+1}\mid s_t,a_t).}\]

The trajectory distribution factors into the initial state probability, every policy action probability, and every environment transition. section 3.1

How Reinforcement Learning from Human Feedback covers it

How deep it goes
Defines trajectory notation, factors its probability, connects it to return optimization, and contrasts multistep RL with single-step RLHF rollouts.
Examples
Uses thermostat episodes, CartPole rollouts, and prompt-completion episodes to show trajectory structure and learning.
What it assumes
Assumes states, actions, rewards, policies, transition dynamics, probability distributions, and discounted return notation.
What you can do after
Evaluate and optimize policies by representing interactions as sampled trajectories and computing their accumulated rewards.
How it connects
Connects trajectories to policies, states, actions, rewards, transition dynamics, return, value functions, policy gradients, episodes, and RLHF.

Also explained in

Compare how 19 books explain trajectory →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Reinforcement Learning from Human Feedback. The section links point to the parts of the book it draws on.