The Value Function and the -Function
The central quantity in RL is the value function, , which measures how good it is to be in a state under a policy . Formally, it is the expected discounted return of all trajectories starting from ,
(1)
where is the discount factor introduced in the Reward Function and is the reward received at time . The expectation averages over the randomness in both the policy and the environment. Crucially, the value function is always defined relative to a specific policy, it measures the quality of , not of the state in isolation.
A closely related object is the state-action value function, or -function, , which measures the expected return from taking a specific action in state and then following thereafter,
(2)
The -function is practically useful because it allows a policy to be improved locally: if for some action , then switching to in state is guaranteed to improve the policy. Both and satisfy recursive relations known as the Bellman equations, which express the value of a state in terms of the values of its successors,
(3)
The Bellman equations are the foundation of nearly all RL algorithms. The goal of RL, finding the optimal policy , can be stated compactly as,
(4)
Dynamic Programming
If the dynamics of the environment, the transition probabilities , are fully known, the Bellman equations become a system of simultaneous linear equations, one per state, that can in principle be solved exactly. Dynamic programming (DP) exploits this structure.
The standard approach is value iteration: initialise for all states and repeatedly apply the Bellman update,
(5)
until successive iterations differ by less than a chosen threshold. This is guaranteed to converge to the true value function. Once the value function is known, the policy can be improved by acting greedily with respect to the -function, and the two steps, evaluation and improvement, can be alternated in what is called policy iteration.
Dynamic programming is exact and efficient relative to the size of the policy space (polynomial in the number of states and actions, compared to the exponential number of policies), but it has a critical limitation: it requires a complete model of the environment and must sweep over every state at every iteration. For large state spaces this quickly becomes infeasible. The excursion problem has a state space of , manageable for small , but the approach does not generalise.
-Learning
When a model of the environment is unavailable, DP cannot be applied directly. -learning sidesteps this by learning the optimal -function through experience, interacting with the environment and updating estimates from observed transitions.
The core update rule is,
(6)
where is a learning rate. At each step, the current -estimate for the taken action is nudged towards the observed reward plus the best estimated future value from the next state. Crucially, the in Equation 6 means -learning targets the optimal policy regardless of which policy generated the data, it is off-policy.
-learning has theoretical guarantees of convergence to the optimal -function given infinite experience and a decaying learning rate. However, it inherits a fundamental difficulty: it still requires visiting and maintaining estimates for every state-action pair. In large or continuous state spaces, this is intractable without additional function approximation.
-learning learns a value function and derives a policy from it implicitly. For the excursion problem, the target is not just any policy that achieves the excursion, it is the specific distribution over trajectories given by the Doob dynamics. A value-based method has no natural way to represent or optimise for a distribution as its objective. Policy gradient methods, which directly parameterise and optimise the policy, are far better suited to this goal.
Towards Policy Gradients
Both DP and -learning are value-based: they learn a value function first and derive a policy from it. An alternative family of methods directly parameterise the policy as and optimise by gradient ascent on the expected return. These are policy gradient methods.
The and functions introduced here reappear throughout: is the quantity whose derivative drives the tabular parameter updates, and is approximated by the reward-to-go in the Monte Carlo gradient estimates.
← Back to the main article: RL Algorithms