Representation Learning for RL
Auxiliary tasks, bisimulation and what makes a good state representation.
A deep RL agent is a learned feature map followed by a linear head, so everything the linear theory says applies to the last layer, and the real question becomes which to learn. This lesson collects what is proved about that question: which state abstractions preserve optimal behavior, the bisimulation metric that bounds value differences, why value functions of extreme policies are the hardest targets for a representation, why self-predictive learning does not collapse, and how much of the empirical progress from auxiliary losses and data augmentation survives careful evaluation.
What you’ll learn
- Order the standard state abstractions, from bisimulation to optimal-action equivalence, by what they preserve, and connect bisimulation to Bellman completeness.
- State and prove the bound of a bisimulation metric on differences of optimal values, and describe its use in deep RL (DBC, MICo).
- Explain why the worst-case approximation error over all policies is attained at extremal vertices of the value polytope, and what this says about auxiliary tasks.
- Prove that self-predictive learning with an optimal predictor and a stop-gradient conserves , and separate established from contested empirical claims about augmentation and contrastive objectives.
What should a representation preserve?
The cleanest version of the question is discrete: a state abstraction merges states, and learning happens on the merged states. A tabular learner on is exactly a linear learner whose features are one-hot indicators of , so abstractions are the simplest representations. Li, Walsh and Littman (2006) order the standard ones from finest to coarsest, each merging only states that agree on the listed quantity:
| Abstraction | Merged states agree on | Abstract optimal policy optimal? | Q-learning on abstract states finds it? |
|---|---|---|---|
| Model-irrelevance (bisimulation) | Rewards, and probabilities of moving into each abstract class, for every action | Yes | Yes |
| -irrelevance | for every policy and action | Yes | Yes |
| -irrelevance | for every action | Yes | Yes |
| -irrelevance | The optimal action and | Yes | Not necessarily; with a fixed behavior policy, yes |
| -irrelevance | The optimal action only | Not necessarily | Not necessarily, even with a fixed behavior policy |
Bisimulation (Givan, Dean & Greig, 2003) is the only row defined without reference to any value function, which makes it learnable without knowing . It also has a precise role in batch RL. For the class of functions that are constant on each abstract state, Chen & Jiang (2019) show that Bellman completeness, for every , holds exactly when is a bisimulation. Completeness is the assumption under which fitted Q-iteration provably works (Fitted Q-Iteration & Its Guarantees), so a bisimulation is precisely an aggregation that FQI can trust.
An abstraction merges states only when they have the same optimal action and the same optimal value. You run Q-learning on the abstract states with an -greedy behavior policy that keeps changing as the estimates change. What is guaranteed?
- Convergence to of the original MDP
- Nothing in general: Q-learning need not converge, although the optimal policy is representable
- Divergence of the Q-values to infinity
- Convergence to the optimal policy, because the optimal action is preserved
Show the answer
B. Nothing in general: Q-learning need not converge, although the optimal policy is representable
This is -irrelevance. Merged states can have different values for their non-optimal actions, so the abstract process is not Markov for those actions and the update targets depend on how often the behavior visits each merged state. Li, Walsh & Littman show Q-learning need not converge here, while with a fixed behavior policy it converges to a solution whose greedy policy is optimal.
Bisimulation metrics
Exact bisimulation is brittle: a reward difference of separates two states as firmly as a difference of 100. Ferns, Panangaden and Precup (2004) replace the equivalence by a distance. Let be the Kantorovich (Wasserstein-1) distance between next-state distributions, with ground metric on states.
Iterate and from , . Suppose for all . Then the rescaled function is 1-Lipschitz for , because :
Kantorovich duality, , bounds the difference of expected next values. Using :
Both sequences converge, and , and the inequality passes to the limit. With the common choice , , states within distance have optimal values within .
The same induction with the policy's own rewards and transitions gives an on-policy version, with , (Castro, 2020), which avoids the max over actions; Castro also gives algorithms that estimate it from sampled transitions in deterministic MDPs. Deep bisimulation for control (DBC; Zhang et al., 2021) trains an encoder so that distances between embeddings match a target of this form: the reward difference plus times the 2-Wasserstein distance between a learned latent model's Gaussian predictions of the next embeddings. MICo (Castro et al., 2021) replaces the optimal coupling inside by independent sampling, giving a cheaper "diffuse" distance (one with possibly positive self-distances) that can be learned from sampled transitions. Computing exactly is a transport problem per state pair, which is why these practical versions approximate it.
Auxiliary tasks and the geometry of value functions
A second line of work asks the representation to predict many things at once. UNREAL (Jaderberg et al., 2017) added three auxiliary tasks to an actor–critic agent, controlling changes in its own pixels, predicting immediate reward and replaying value targets, all sharing the agent's network; it reported about tenfold faster learning on 3D Labyrinth tasks. Why should predicting other quantities help? Bellemare et al. (2019) give a geometric answer for value functions.
Measure a representation by its worst error over all policies: with the best linear fit of on the features of , minimize . The set of all value functions is the value polytope, and its extreme points are values of deterministic policies.
Why vertices. The squared residual is convex, and a convex function's maximum over a polytope is attained at a vertex; the value polytope is not always convex, but its convex hull has the same vertices, all of them achieved by deterministic policies. Training on a set of value functions as auxiliary targets is then a relaxation of this minimax problem (an average instead of a max over the vertices), which gives a principled reason to predict many value functions. The idea connects to proto-value functions (Mahadevan & Maggioni, 2007), which take eigenvectors of a graph Laplacian of the state space as features, and to Lyle et al. (2021), who analyze TD learning with auxiliary tasks and relate the representations it induces to the spectral decomposition of the transition operator.
A third kind of prediction makes evaluation linear for a whole family of tasks. If rewards are linear in features, , then with the successor features , by linearity of expectation. Barreto et al. (2017) combine this with generalized policy improvement: acting greedily on for several known policies is at least as good as each of them, so a new task needs only its (Successor Representations & Features).
Self-prediction, augmentation and what survives careful evaluation
Self-predictive objectives drop external targets altogether: predict your own future embedding. SPR (Schwarzer et al., 2021) predicts its latent state several steps ahead through a learned latent transition model, against targets from a copy of the encoder (an exponential moving average of it, or, in the reported runs with data augmentation, the online encoder itself behind a stop-gradient); on Atari with 100k interaction steps it reported a median human-normalized score of 0.415, a 55% relative gain over the previous best. Such objectives have an obvious trivial solution, a constant embedding that predicts itself perfectly. Tang et al. (2023) explain why learning does not find it, in an idealized linear model: tabular states, an embedding matrix , uniform state weighting, and a latent predictor trained to minimize with the target held fixed (a stop-gradient).
Let the residual be . If the predictor is optimal at every instant (it learns on a faster timescale), its normal equations say the residual is orthogonal to the embedding:
The semi-gradient on ignores the target's dependence on , so the embedding moves along the residual only:
Then the covariance of the embedding cannot change, so distinct columns can rotate but never merge, and a full-rank embedding never collapses. With a full gradient (no stop-gradient) or a non-optimal predictor, the cancellation fails, and in their experiments the columns did collapse. For symmetric and an orthonormal initialization, the dynamics also never decrease , whose maximizers span the eigenvectors of with the largest absolute eigenvalues (their Thm. 6), a spectral decomposition of the dynamics; convergence to that maximizer is not guaranteed.
The pixel-based benchmarks tell a more tangled story. CURL (Laskin, Srinivas & Abbeel, 2020) added a contrastive loss between two augmented crops of each observation. Weeks later, RAD (Laskin et al., 2020) and DrQ (Yarats, Kostrikov & Fergus, 2021) reported that image augmentation alone, with no auxiliary loss, matched or beat it on the DeepMind Control Suite, so much of the gain credited to the contrastive objective on those tasks came from the augmentations. Agarwal et al. (2021) then re-analyzed Atari 100k results and showed that with the few runs per game typical of these papers, point estimates such as the median are unreliable and several reported rankings fall within the uncertainty; they recommend stratified bootstrap confidence intervals and the interquartile mean (Benchmarks & Honest Evaluation).
In the idealized analysis, which two ingredients together keep a self-predictive representation from collapsing to a constant?
- Data augmentation and a contrastive loss
- A large network and a small learning rate
- Reward prediction and value replay
- A predictor that is optimal at each step and a stop-gradient on the target embedding
Show the answer
D. A predictor that is optimal at each step and a stop-gradient on the target embedding
The optimal predictor makes the residual orthogonal to the embedding, and the stop-gradient makes the embedding move only along that residual, so stays constant. Remove either and the cancellation fails. Augmentation, contrastive negatives and extra prediction targets are other ways to avoid collapse, but not the mechanism of this theorem.
Key takeaways
- State abstractions form a hierarchy: bisimulation, - and -irrelevance keep Q-learning optimal, -irrelevance keeps the optimal policy but not Q-learning's convergence, -irrelevance can lose optimality.
- For piecewise-constant function classes, Bellman completeness is exactly bisimulation (Chen & Jiang, 2019).
- A bisimulation metric with bounds optimal-value differences, ; DBC and MICo learn approximations of such metrics.
- The worst-case linear error over all policies is attained at adversarial value functions of deterministic policies, a principled reason to predict many value functions as auxiliary tasks.
- Idealized self-prediction conserves thanks to an optimal predictor and a stop-gradient; empirical gains from auxiliary losses and augmentation are real but need careful, multi-run evaluation.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
With and , two states are at bisimulation distance . What is the largest possible gap ?
Show the answer
D.
The theorem gives , so the gap is at most . The factor is the effective horizon: a small per-step discrepancy can accumulate over the horizon.
Why is the worst-case approximation error of a representation over all policies attained at deterministic policies?
- Because deterministic policies have the largest values
- Because the squared residual is a convex function of the value function, and a convex function's maximum over a polytope is at a vertex, and the vertices are values of deterministic policies
- Because stochastic policies cannot be represented linearly
- Because the error of a stochastic policy is always zero
Show the answer
B. Because the squared residual is a convex function of the value function, and a convex function's maximum over a polytope is at a vertex, and the vertices are values of deterministic policies
is convex in . Maximizing a convex function over the convex hull of the value polytope puts the maximum at an extreme point, and extreme points are achieved by deterministic policies. Which deterministic policies matter depends on the direction , giving the adversarial value functions.
Rewards are linear in features, . A new task changes only . What do successor features give you?
- The optimal policy for the new task, without any computation
- Nothing, because the policy must be relearned for every reward
- The new task's values for immediately, , and with several policies a GPI policy at least as good as each of them
- A bisimulation metric for the new task
Show the answer
C. The new task's values for immediately, , and with several policies a GPI policy at least as good as each of them
Linearity of expectation splits into "which features will accumulate" () and "what each feature is worth" (). Evaluation transfers exactly; generalized policy improvement over several stored policies gives a policy no worse than any of them, though not necessarily optimal.
RAD and DrQ matched or beat the contrastive method CURL on DeepMind Control using image augmentation alone. What does this show?
- Contrastive learning never helps in RL
- Data augmentation works only in combination with a contrastive loss
- On those benchmarks, much of the gain attributed to the contrastive loss came from the augmentations; it does not settle whether contrastive objectives help elsewhere
- Representation learning is unnecessary for pixel-based RL
Show the answer
C. On those benchmarks, much of the gain attributed to the contrastive loss came from the augmentations; it does not settle whether contrastive objectives help elsewhere
An ablation on specific benchmarks shows which ingredient produced the gains there. It does not prove that contrastive or other auxiliary objectives are useless in other regimes, such as very low data, transfer, or without augmentation, and any such comparison needs enough runs to be statistically meaningful.
Further reading
- L. Li, T. J. Walsh & M. L. Littman, "Towards a unified theory of state abstraction for MDPs", International Symposium on Artificial Intelligence and Mathematics (2006).
- N. Ferns, P. Panangaden & D. Precup, "Metrics for finite Markov decision processes", UAI (2004).
- M. G. Bellemare, W. Dabney, R. Dadashi, A. Ali Taiga, P. S. Castro, N. Le Roux, D. Schuurmans, T. Lattimore & C. Lyle, "A geometric perspective on optimal representations for reinforcement learning", NeurIPS (2019).
- Y. Tang et al., "Understanding self-predictive learning for reinforcement learning", ICML (2023).
- R. Agarwal, M. Schwarzer, P. S. Castro, A. Courville & M. G. Bellemare, "Deep reinforcement learning at the edge of the statistical precipice", NeurIPS (2021).