A policy determines how an agent acts in an environment. It maps a state s to a probability distribution over actions: π(a | s) is the probability of choosing action a in state s. In deep reinforcement learning, a neural network can learn this mapping. section 3.1
The policy chooses actions; the environment determines how the state changes afterward. Together with the initial state distribution, policy choices and transitions define a distribution over trajectories. Training seeks a policy with high expected cumulative reward, optionally discounting rewards further in the future. section 3.1
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 probability combines the initial state probability, policy action probabilities, and environment transition probabilities. section 3.1
Thermostat policy
For a room with a 70°F target, the state is the current temperature and the actions are heater on or off. One policy turns the heater on below 70°F and off otherwise. A reward of +1 is given within 2°F of the target and 0 otherwise. This policy is sensible but not necessarily optimal: the result also depends on how quickly the room heats and cools. section 3.1.1
Policy-gradient methods directly optimize a parameterized policy πθ. A basic update combines the direction that increases the probability of a sampled action with a scalar score for its outcome. A positive score favors making that action more likely; a negative score favors making it less likely. section 6.1 section 6.2
Equation 6.1
\[\label{eq:policy_gradient_intuition} \Delta \theta \propto \Psi_t \nabla_\theta \log \pi_\theta(a_t \mid s_t).\]The update multiplies the action’s log-probability gradient by an outcome score Ψt. section 6.2
In language-model RLHF, the policy is the model being trained. The general state–action notation can also be expressed as prompt and completion; some implementations treat the entire completion as one action. PPO, GRPO, and REINFORCE are policy-gradient algorithms used in this setting. section 6.1 section 6.2
Data collection matters because a policy changes during training. In reinforcement learning, on-policy data for a gradient update comes from the most recent policy. For preference data, the term is often used more loosely for data generated by the current family of models, whose outputs are closely related to those being optimized. section 11.2












