liveBook · Manning

Action-value function

As explained in Reinforcement Learning from Human Feedback

A Q-function maps a state-action pair to a scalar estimate of expected future reward.

An action-value function, or Q-function, maps a state–action pair to a scalar estimate of future reward. It answers how useful taking action a in state s is, under policy π. Unlike a value function, which evaluates only states, Q evaluates the immediate choice and its downstream consequences. section 10.4 section 6.2.1

The Bellman relationship makes Q operational: Qπ(st, at) = E[rt + γVπ(st+1) | st, at]. The estimate combines the reward produced now with the discounted value of the next state. With deterministic transitions, the expectation simplifies to rt + γV(st+1). For a deterministic policy, Vπ(st) = Qπ(st, π(st)); for a stochastic policy, Vπ averages Q over actions sampled from π. section 6.2.1

Q-values support several reinforcement-learning operations:

  • Q-learning updates estimates of state–action usefulness through temporal-difference learning, allowing policy updates as new data arrives rather than relying only on a fixed cumulative dataset. section 10.4
  • Policy-gradient methods can use Qπ(st, at) as a per-timestep learning signal, trading against alternatives such as total return, baselines, advantage, or a TD residual. section 6.2.1
  • The advantage function centers Q by subtracting the state value: A(st, at) = Q(st, at) − V(st). This measures whether an action performs better or worse than the state’s average expectation. section 6.2.1

From Q-value to policy update

Suppose a policy takes action at in state st. A learned value model estimates V(st) and V(st+1), while the environment supplies reward rt. The TD residual rt + γV(st+1) − V(st) estimates the action’s advantage and can weight the action’s log-probability contribution during policy optimization. section 6.2.1

Equation 6.19
\[\label{eq:advantage_trick} A(s_t,a_t) = Q(s_t,a_t) - V(s_t) = r_t + \gamma V(s_{t+1}) - V(s_t).\]

Use the equation to inspect the equivalence between the Q-minus-V advantage and the one-step TD residual. section 6.2.1

How Reinforcement Learning from Human Feedback covers it

How deep it goes
Defines Q, derives its Bellman relation to V, and connects it to advantages and TD residuals without developing a full Q-learning algorithm.
Examples
Uses deterministic language-model transitions, game-playing systems, adaptive control, and a policy-gradient TD-residual calculation.
What it assumes
Assumes states, actions, rewards, policies, and discounting, while distinguishing state values from state–action values.
What you can do after
Apply Q-values as Bellman targets, policy-gradient signals, or components of advantage and temporal-difference estimates.
How it connects
Connects action-value functions to reinforcement learning, Q-learning, value functions, Bellman equations, policy gradients, advantage functions, and temporal-difference learning.

Also explained in

Compare how 5 books explain action-value function →

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.