Value Function Approximation
Reinforcement Learning · Lecture 5
Christopher Mutschler
University of Technology Nuremberg
12 November 2026
Today
Where we are going
Why function approximation? Generalize beyond a table.
Linear VFA. Features, regression, semi-gradient updates.
Fitted Q-Iteration. Turn Bellman backups into supervised learning.
Deep Q-Networks. Neural approximation plus two stabilizers.
Today's question
How do we keep Q-learning useful when the state space is too large to enumerate?
Part 1
Why approximate value functions? Tables remember. Function approximators generalize.
Recap · Lecture 4
Tabular Q-learning updates one entry at a time
Great when every state-action pair has its own cell. Not so great when there are millions, billions, or infinitely many states.
state ← →
0.2 0.3
−0.1 0.7
0.0 1.4 ⋮ ⋮ ⋮
? ?
No automatic sharing between similar rows.
Challenge #1
In real world problems, the state space can be large
Backgammon states
approx. number of states:
Computer Go states
approx. number of states:
Robot arm: infinitely many states
approx. number of states:
Storage
There are too many states and/or actions to store in memory.
Data
Even if the table fits, visiting enough state-action pairs takes far too long.
Local updates
Only nearby states are observed, so value information propagates slowly.
Challenge #2
Generalization across states
Let’s say we discover through experience that this state is bad:
In naïve Q-learning, we know nothing about this state:
We need a representation that generalizes and speeds up learning across states.
Reference: Pieter Abbeel: CS 188 Introduction to Artificial Intelligence. Fall 2018.
Representation
From a table to a parameterized function
Value Function Representations
Exact:
A table with a distinct value for each case
: one entry per
: one entry for each
pair
Approximate:
Approximate
or
with a function approximator
e.g., neural networks, polynomials, RBFs, …
+ We only need to store the approximator parameters
− Convergence properties do not hold anymore in general
David Silver, Reinforcement Learning lecture notes, 2016.
Features
Describe a state using a vector of features
VFA: Describe a state using a vector of features.
Features are functions from states to real numbers that capture important properties of the state.
Example features for Pac-Man:
Distance to closest ghost
Distance to closest dot
Number of ghosts
…
Example adapted from Pieter Abbeel, CS 188 Introduction to Artificial Intelligence.
Learning the parameters
Turn value approximation into a regression problem
Our goal is to learn parameters
that approximate the target action value well.
↓ gradient-descent update
Method
Target
Q-learning
SARSA
Monte Carlo
The regression target is supplied by the RL algorithm.
Linear VFA
Linear in the parameters, rich in the features
Why we like it
Fast updates, interpretable features, and much stronger stability results than arbitrary nonlinear approximators.
But
Good performance depends heavily on choosing a feature map that makes the value function easy to represent.
The learner tunes
; the designer decides what
can express.
Feature design
Several ways to turn a state into features
Polynomial
Products and powers of coordinates
∿
Fourier
Cosine basis at multiple frequencies
▦
Tile coding
Sparse overlapping partitions
◡
RBF
Localized Gaussian features
Same learner, different geometry
Changing
changes which states share parameters — and therefore which states generalize to one another.
The approximation is linear in the parameters
. The feature map
may be highly non-linear.
Feature design · Polynomial basis
Polynomial features create non-linear value functions
Action A
Action B
Action C
Action D
Feature design · Polynomial basis
A feature map can lift a low-dimensional state into many monomials
Trade-off
Higher degree increases expressiveness — but the number of features grows quickly with state dimension.
Feature design · Fourier basis
Fourier features represent smooth structure with different frequencies
Sutton, R. S., & Barto, A. G. (2018). Reinforcement Learning: An Introduction. MIT Press.
Feature design · Tile coding
Tile coding turns a continuous state into a sparse binary representation
Several offset tilings cover the same continuous state space. A point activates one tile per tiling.
Key idea
Nearby states share some active tiles → local generalization without a single hard discretization.
Sutton, R. S., & Barto, A. G. (2018). Reinforcement Learning: An Introduction. MIT Press.
Feature design · RBFs
Radial basis functions create local, smooth features
Example features: Radial Basis Functions (RBFs)
Sutton, R. S., & Barto, A. G. (2018). Reinforcement Learning: An Introduction. MIT Press.
Why linear VFA?
Convergence of control algorithms
Function approximation lets us generalize, but it changes the convergence story.
Algorithm Table Lookup Linear Non-linear
Monte-Carlo Control ✓ (✓) ✕
SARSA ✓ (✓) ✕
Q-learning ✓ ✕ ✕
(✓) = chatters around a near-optimal value function
Value Function Approximation
Two important questions
Can we approximate any
value function with a linear function approximator?
Is it easy to find such a linear function approximator?
Keep both questions separate
Expressiveness and feature discovery are not the same problem.
Question 1 · Expressiveness
Can a linear FA approximate any value function?
1. Can we approximate any
value function with a linear FA?
Answer
YES! (But the proof is out of scope for this class.)
Question 2 · Feature discovery
Is it easy to find such a linear FA?
2. Is it easy to find such a linear FA? → YES!
Example Gridworld
No obstacles deterministic actions (U/D/L/R) no discounting reward is −1 everywhere except +10 at the goal
goal at the top-right corner
Linear VFA · calculation
Represent the state and perform linear VFA
Represent state
by a feature vector:
Perform linear value-function approximation:
Linear VFA · calculation
Is there a good linear approximation? → YES
Choose weights that encode distance to the goal:
Interpretation
The value decreases linearly with the
Manhattan distance to the goal.
Feature design · calculation
Move the reward: the same features no longer work
With reward in the interior
Is there a good linear approximation with only
?
→ NO!
Add a nonlinear feature that measures distance to the new goal:
Now: → YES!
Feature engineering · Tetris
Is it easy to find a good linear FA? → NO!
Feature Description
Landing Height Height of last piece is added.
Eroded Piece Cells #rows eliminated in the last move × #bricks eliminated from the last piece.
Row Transitions #horizontal full↔empty transitions between cells.
Column Transitions Same idea for vertical transitions.
Holes #empty cells covered by at least one full cell.
Thierry, C. & Scherrer, B.: Improvements on Learning Tetris with Cross-Entropy. 2010. · Tetris illustration: flaticon.com/free-icon/tetris_1006985
Feature engineering · Tetris
Is it easy to find a good linear FA? → NO!
Feature Description
Board Wells Sum of well depths (triangular depth penalty).
Column Height Height of the p-th column.
Column Difference Absolute height difference between adjacent columns.
Maximum Height Maximum pile height.
Holes Empty cells covered by at least one full cell.
Thierry, C. & Scherrer, B.: Improvements on Learning Tetris with Cross-Entropy. 2010. · Tetris illustration: flaticon.com/free-icon/tetris_1006985
Feature engineering · Ms. Pac-Man
Hand-crafted features must encode the relevant geometry
Feature Description
Nearby Walls Existence of walls in all four directions.
Nearest Target Direction of the nearest target where Ms. Pac-Man should move.
Nearby Ghosts Existence of a ghost in all four directions.
Existence of Escape Whether Ms. Pac-Man can move freely or is trapped.
Tziortziotis, N., Tziortziotis, K. & Blekas, K.: Play Ms. Pac-Man Using an Advanced Reinforcement Learning Agent. 2014.
Feature engineering · LSPI
A pendulum: 30 carefully placed basis functions
Lagoudakis, M. G. & Parr, R.: Least-Squares Policy Iteration. JMLR, 2003.
Feature engineering · LSPI
A bicycle: 100 hand-designed basis functions
Scale
20 basis functions per action × 5 actions =
100 parameters .
Lagoudakis, M. G. & Parr, R.: Least-Squares Policy Iteration. JMLR, 2003.
Value Function Approximation
Idea: Why don’t we replace linear approximation with NNs?
Because theory tells us that this doesn’t work out.
Non-linear function approximation breaks the classical convergence guarantees.
Algorithm Table Lookup Linear Non-linear
Monte-Carlo Control ✓ (✓) ✕ SARSA ✓ (✓) ✕ Q-learning ✓ ✕ ✕
(✓) = chatters around a near-optimal value function
But in some applications, it did 🙂 World's best Backgammon player:
Neural network with 80 hidden units RL from 300,000 games of self-play One of the top players in the world
Value Function Approximation
Parenthesis: Gerry Tesauro's TD-Gammon ('92, '94, '95)
TD error drives a neural value function; more hidden units improved self-play performance.
Tesauro, G.: Temporal difference learning and TD-Gammon. 1995. · Backgammon illustration: flaticon.com/free-icon/backgammon_683899
Part 2
Fitted Q-Iteration Freeze the Bellman targets. Fit a regressor. Repeat.
Motivation · Fitted Q-Iteration
Why are one-step online updates not enough?
Use of data
Each update is driven by only one transition, even when we already have a large batch of experience.
Moving targets
Bootstrapped targets change whenever the current value estimate changes.
Model restrictions
Gradient updates tie us to a differentiable parameterization and a particular optimization procedure.
Couldn’t we try the problem differently?
Freeze the current Bellman targets, fit one regressor on the whole batch, and repeat.
Fitted Q-Iteration
Bellman backups become supervised-learning targets
1
Dataset transitions (sᵢ,aᵢ,rᵢ,s′ᵢ)
→
2
Frozen Bellman labels compute one target per transition
→
3
Regression fit Q to those labels
Connection to supervised learning
For one FQI iteration, the targets are fixed. Learning is ordinary regression on Bellman targets; the Bellman error is the regression residual.
Fitted Q-Iteration · limitations
What limits Fitted Q-Iteration?
FQI turns reinforcement learning into a sequence of clean regression problems — but each outer iteration is still a batch procedure.
1
Full-batch sweeps
Bellman targets are recomputed for the entire transition dataset at every outer iteration.
2
Refit the regressor
After changing the targets, the function approximator must be fitted again — expensive as the dataset grows.
3
Scaling to rich observations
Hand-designed features and classical regressors become the bottleneck for high-dimensional inputs such as images.
Open question
How can we keep the fixed-target regression idea while learning efficiently from large experience streams and high-dimensional observations?
Part 3
Deep Q-Networks Use a neural network as the action-value approximator — then stabilize the learning problem.
Deep Q-Networks (DQNs)
A game-changing result: DQN from DeepMind
Then a game-changing result was published in Nature : DQN from DeepMind (now Google DeepMind) Surpassed human performance in many Atari 2600 games. The same RL algorithm learns a policy in each game. End-to-end: only image pixels are used as input. A landmark result that triggered enormous interest in deep reinforcement learning. Mnih et al. (2015), Human-level control through deep reinforcement learning, Nature.
Deep Q-Networks (DQNs)
DQN from DeepMind: performance across Atari games
One algorithm, one broad architecture, many different games — evaluated against human-normalized performance.
Mnih et al. (2015), Human-level control through deep reinforcement learning, Nature.
Deep Q-Networks (DQNs)
How does it work?
A convolutional neural network reads the game image — typically a stack of the last 4 frames. The CNN is a value-function approximator for the action-value function. The reward is the game score. The network weights are tuned by backpropagating learning signals derived from rewards. →
CNN
learned features
→
Q-values
for all actions
Mnih et al. (2015) · David Silver, Reinforcement Learning lecture notes.
Deep Q-Networks (DQNs)
How does it work?
Approximated Q-function:
Target value:
Update:
Mnih et al. (2015)
Deep Q-Networks (DQNs)
From Q-learning to a neural Q-function
Start from the standard Q-learning control loop The environment produces the next transition after each action.
The policy π acts ε-greedily with respect to the current Q-function.
Q-learning updates the action value using reward + bootstrap target.
Deep Q-Networks (DQNs)
DQN v0.1 · Replace the Q-table by a neural network
The same Q-learning idea, now with parameters w For one transition, evaluate the network at the current state-action pair and at the next state.
The TD loss uses the same network for the prediction and for the bootstrap target.
Backpropagate the loss and update the network parameters w.
Deep Q-Networks (DQNs)
Stabilizer #1 · Experience Replay
How does it work? A bag of tricks for stabilizing learning: Experience Replay:Problem: Experiences are correlated over time. → Oscillations and divergence during learning.Solution: Random sampling of experience mini-batches from a memory. → Samples can be re-used to increase data efficiency . → Breaking correlations by randomization reduces variance .
Deep Q-Networks (DQNs)
DQN v0.1 · Before experience replay
The first neural version still trains on the current stream Consecutive experiences are strongly correlated.
The same network is used to compute both terms of the TD loss.
Experience replay addresses the first problem.
Deep Q-Networks (DQNs)
DQN v0.2 · Add experience replay
Train from random mini-batches sampled from memory Store transitions in a replay memory.
Sample random mini-batches for gradient updates.
Reuse past experience and break temporal correlations between successive updates.
Deep Q-Networks (DQNs)
Stabilizer #2 · The target keeps moving
How does it work? A bag of tricks for stabilizing learning: Experience Replay. Separate, frozen target Q-network:Problem: Target Q-values
change constantly.→ Oscillations and divergence during learning.
Deep Q-Networks (DQNs)
Stabilizer #2 · Use two Q-networks
How does it work? A bag of tricks for stabilizing learning: Experience Replay. Separate, frozen target Q-network:Solution: Two Q-networks:→ Frozen Target Q-network with parameters
predicts Q-learning targets
. → Dynamic Main Q-network with parameters
evaluates current Q-values
. → Perform a gradient descent step (w.r.t.
) towards
Added delay breaks correlations between Q-network and target. Avoids oscillations by having fixed targets.(Note: We periodically update the target Q-network by copying the weights
.) Reduces chance of divergence .
Deep Q-Networks (DQNs)
DQN v0.2 · Replay is not enough
Replay fixes the correlated data stream — but not the moving target Random mini-batches reduce correlations between training samples.
The online network still generates its own bootstrap target.
Next: freeze a separate target network for several updates.
Deep Q-Networks (DQNs)
DQN v1.0 · Add the frozen target network
Replay + target network = the core stabilization recipe The evaluation network is updated by gradient descent.
The frozen target network supplies the bootstrap target.
Every k timesteps, copy the evaluation-network weights to the target network.
Deep Q-Networks (DQNs)
Stabilizer #3 · Reward clipping
How does it work? A bag of tricks for stabilizing learning: Experience Replay. Separate, frozen target Q-network. Apply reward clipping:Problem: Large rewards result in large variances in Q-values.Different games have different reward values. Oscillations and divergence during learing.Solution: Clip the rewards (and loss terms) to a range [−1.0, 1.0].Avoids oscillations by normalizing rewards when training for multiple games. Prevents Q-values from becoming too large.
Extension #1
Double DQN reduces maximization bias
Vanilla target
The max tends to select actions whose estimates are accidentally high.
online selects target evaluates
Extension #2
Prioritized Replay spends updates where the Bellman error is large
Transitions with surprising targets are replayed more often.
Importance-sampling weights can compensate for the bias introduced by non-uniform sampling.
Extension #3
Dueling networks separate state value from action advantage
single stream
dueling architecture
Intuition
Learn whether a state is good even when the exact action matters little.
Rainbow
Later work combined Double DQN, prioritized replay, dueling networks and other improvements into one agent.
Extension · Rainbow
Rainbow combines several DQN improvements in one agent
Hessel et al. (2018), Rainbow: Combining Improvements in Deep Reinforcement Learning. AAAI.
The Deadly Triad
Three ingredients make instability especially likely
1
Function approximation shared parameters couple values
2
Bootstrapping targets use current estimates
3
Off-policy learning behavior and target policies differ
DQN uses all three — so its stabilizers are not cosmetic.
Takeaways
The conceptual ladder
table
→
features + parameters
→
FQI regression
→
DQN
Function approximation trades exact storage for generalization.
Fitted Q-Iteration makes Bellman backups look like supervised labels.
DQN uses a neural Q-function, but needs a better optimization schedule.
Experience replay decorrelates updates and reuses data.
Target networks slow down the movement of Bellman labels.
Lesson of today
“Be careful with (non-linear) function approximation.”
generalization
↔
interference
↔
stability tricks
Powerful representations are useful precisely because one update can change many predictions. That is also why they can destabilize learning.