Simple Algorithm
Reinforcement Learning · Fixed Point · 28 min

Representation Learning for RL

Auxiliary tasks, bisimulation and what makes a good state representation.

A deep RL agent is a learned feature map ϕ(s)\boldsymbol\phi(s) followed by a linear head, so everything the linear theory says applies to the last layer, and the real question becomes which ϕ\boldsymbol\phi 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 Φ⊤Φ\boldsymbol\Phi^\top\boldsymbol\Phi, 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 ϕ:S→Sˉ\phi:\mathcal S\to\bar{\mathcal S} merges states, and learning happens on the merged states. A tabular learner on Sˉ\bar{\mathcal S} is exactly a linear learner whose features are one-hot indicators of ϕ(s)\phi(s), 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:

AbstractionMerged states agree onAbstract optimal policy optimal?Q-learning on abstract states finds it?
Model-irrelevance (bisimulation)Rewards, and probabilities of moving into each abstract class, for every actionYesYes
QπQ^\pi-irrelevanceQπ(s,a)Q^\pi(s,a) for every policy π\pi and action aaYesYes
Q⋆Q^\star-irrelevanceQ⋆(s,a)Q^\star(s,a) for every actionYesYes
a⋆a^\star-irrelevanceThe optimal action and V⋆V^\starYesNot necessarily; with a fixed behavior policy, yes
π⋆\pi^\star-irrelevanceThe optimal action onlyNot necessarilyNot necessarily, even with a fixed behavior policy
Theorems 2–6 of Li, Walsh & Littman (2006). Each row's abstractions are special cases of the rows below it. a⋆a^\star-irrelevance is the coarsest abstraction in their class for which model-based learning, or Q-learning with a fixed behavior policy, still yields an optimal greedy policy.

Bisimulation (Givan, Dean & Greig, 2003) is the only row defined without reference to any value function, which makes it learnable without knowing Q⋆Q^\star. It also has a precise role in batch RL. For the class Fϕ\mathcal F_\phi of functions that are constant on each abstract state, Chen & Jiang (2019) show that Bellman completeness, T⋆f∈Fϕ\mathcal T^\star f\in\mathcal F_\phi for every f∈Fϕf\in\mathcal F_\phi, holds exactly when ϕ\phi 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.

Check your understanding

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 ε\varepsilon-greedy behavior policy that keeps changing as the estimates change. What is guaranteed?

  1. Convergence to Q⋆Q^\star of the original MDP
  2. Nothing in general: Q-learning need not converge, although the optimal policy is representable
  3. Divergence of the Q-values to infinity
  4. 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 a⋆a^\star-irrelevance. Merged states can have different Q⋆Q^\star 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 10−610^{-6} separates two states as firmly as a difference of 100. Ferns, Panangaden and Precup (2004) replace the equivalence by a distance. Let Wd(p,q)W_d(p,q) be the Kantorovich (Wasserstein-1) distance between next-state distributions, with ground metric dd on states.

DerivationProof by induction over value iteration
  1. ∣f(u)−f(v)∣=γcT cR∣Vn(u)−Vn(v)∣≤γcT dn(u,v)≤dn(u,v)\abs{f(u)-f(v)}=\frac{\gamma}{c_T}\,c_R\abs{V_n(u)-V_n(v)}\le\frac{\gamma}{c_T}\,d_n(u,v)\le d_n(u,v)

    Iterate Vn+1(s)=max⁡a[r(s,a)+γEP(⋅∣s,a)Vn]V_{n+1}(s)=\max_a\big[r(s,a)+\gamma\E_{P(\cdot\mid s,a)}V_n\big] and dn+1=F(dn)d_{n+1}=F(d_n) from V0=0V_0=0, d0=0d_0=0. Suppose cR∣Vn(u)−Vn(v)∣≤dn(u,v)c_R\abs{V_n(u)-V_n(v)}\le d_n(u,v) for all u,vu,v. Then the rescaled function f=(cRγ/cT) Vnf=(c_R\gamma/c_T)\,V_n is 1-Lipschitz for dnd_n, because γ≤cT\gamma\le c_T:

  2. cR∣Vn+1(s)−Vn+1(t)∣≤max⁡a(cR∣r(s,a)−r(t,a)∣+cT ∣EP(⋅∣s,a)f−EP(⋅∣t,a)f∣)≤dn+1(s,t)c_R\abs{V_{n+1}(s)-V_{n+1}(t)}\le\max_a\Big(c_R\abs{r(s,a)-r(t,a)}+c_T\,\big|\E_{P(\cdot\mid s,a)}f-\E_{P(\cdot\mid t,a)}f\big|\Big)\le d_{n+1}(s,t)

    Kantorovich duality, Wd(p,q)=sup⁡{∣Epf−Eqf∣:f 1-Lipschitz for d}W_d(p,q)=\sup\{\abs{\E_pf-\E_qf}: f\ \text{1-Lipschitz for}\ d\}, bounds the difference of expected next values. Using ∣max⁡axa−max⁡aya∣≤max⁡a∣xa−ya∣\abs{\max_ax_a-\max_ay_a}\le\max_a\abs{x_a-y_a}:

  3. cR ∣V⋆(s)−V⋆(t)∣≤d∼(s,t)■c_R\,\abs{V^\star(s)-V^\star(t)}\le d^\sim(s,t)\qquad\blacksquare

    Both sequences converge, Vn→V⋆V_n\to V^\star and dn↑d∼d_n\uparrow d^\sim, and the inequality passes to the limit. With the common choice cT=γc_T=\gamma, cR=1−γc_R=1-\gamma, states within distance ε\varepsilon have optimal values within ε/(1−γ)\varepsilon/(1-\gamma).

The same induction with the policy's own rewards and transitions gives an on-policy version, ∣Vπ(s)−Vπ(t)∣≤dπ(s,t)\abs{V^\pi(s)-V^\pi(t)}\le d^\pi(s,t) with cR=1c_R=1, cT=γc_T=\gamma (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 ℓ1\ell_1 distances between embeddings match a target of this form: the reward difference plus γ\gamma 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 WdW_d by independent sampling, giving a cheaper "diffuse" distance (one with possibly positive self-distances) that can be learned from sampled transitions. Computing WdW_d 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 V^ϕπ\hat V^\pi_\phi the best linear fit of VπV^\pi on the kk features of ϕ\phi, minimize L(ϕ)=max⁡π∥V^ϕπ−Vπ∥22L(\phi)=\max_\pi\norm{\hat V^\pi_\phi-V^\pi}_2^2. The set of all value functions is the value polytope, and its extreme points are values of deterministic policies.

Why vertices. The squared residual V↦∥(I−Πϕ)V∥22V\mapsto\norm{(\mathbf I-\Pi_\phi)V}_2^2 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, r(s,a,s′)=ϕ(s,a,s′)⊤wr(s,a,s')=\boldsymbol\phi(s,a,s')^\top\mathbf w, then Qπ(s,a)=ψπ(s,a)⊤wQ^\pi(s,a)=\boldsymbol\psi^\pi(s,a)^\top\mathbf w with the successor features ψπ(s,a)=Eπ[∑t≥0γtϕt+1∣S0=s,A0=a]\boldsymbol\psi^\pi(s,a)=\E_\pi\big[\sum_{t\ge0}\gamma^t\boldsymbol\phi_{t+1}\mid S_0=s,A_0=a\big], by linearity of expectation. Barreto et al. (2017) combine this with generalized policy improvement: acting greedily on max⁡iQπi\max_iQ^{\pi_i} for several known policies is at least as good as each of them, so a new task needs only its w\mathbf w (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 Φ∈RS×k\boldsymbol\Phi\in\R^{S\times k}, uniform state weighting, and a latent predictor P\mathbf P trained to minimize ∥ΦP−PπΦ∥F2\norm{\boldsymbol\Phi\mathbf P-P^\pi\boldsymbol\Phi}_F^2 with the target PπΦP^\pi\boldsymbol\Phi held fixed (a stop-gradient).

DerivationOptimal predictor plus stop-gradient conserves the covariance (Tang et al., 2023, Thm. 1)
  1. ∇P∥E∥F2=2Φ⊤E=0\nabla_{\mathbf P}\norm{\mathbf E}_F^2=2\boldsymbol\Phi^\top\mathbf E=\mathbf 0

    Let the residual be E=ΦP−PπΦ\mathbf E=\boldsymbol\Phi\mathbf P-P^\pi\boldsymbol\Phi. 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:

  2. Φ˙=−η E P⊤\dot{\boldsymbol\Phi}=-\eta\,\mathbf E\,\mathbf P^\top

    The semi-gradient on Φ\boldsymbol\Phi ignores the target's dependence on Φ\boldsymbol\Phi, so the embedding moves along the residual only:

  3. ddt(Φ⊤Φ)=−η(P E⊤Φ+Φ⊤E P⊤)=0\frac{d}{dt}\big(\boldsymbol\Phi^\top\boldsymbol\Phi\big)=-\eta\big(\mathbf P\,\mathbf E^\top\boldsymbol\Phi+\boldsymbol\Phi^\top\mathbf E\,\mathbf P^\top\big)=\mathbf 0

    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 PπP^\pi and an orthonormal initialization, the dynamics also never decrease Tr⁡((Φ⊤PπΦ)2)\operatorname{Tr}\big((\boldsymbol\Phi^\top P^\pi\boldsymbol\Phi)^2\big), whose maximizers span the eigenvectors of PπP^\pi with the kk 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).

Check your understanding

In the idealized analysis, which two ingredients together keep a self-predictive representation from collapsing to a constant?

  1. Data augmentation and a contrastive loss
  2. A large network and a small learning rate
  3. Reward prediction and value replay
  4. 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 Φ⊤Φ\boldsymbol\Phi^\top\boldsymbol\Phi 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, QπQ^\pi- and Q⋆Q^\star-irrelevance keep Q-learning optimal, a⋆a^\star-irrelevance keeps the optimal policy but not Q-learning's convergence, π⋆\pi^\star-irrelevance can lose optimality.
  • For piecewise-constant function classes, Bellman completeness is exactly bisimulation (Chen & Jiang, 2019).
  • A bisimulation metric with cT≥γc_T\ge\gamma bounds optimal-value differences, cR∣V⋆(s)−V⋆(t)∣≤d∼(s,t)c_R\abs{V^\star(s)-V^\star(t)}\le d^\sim(s,t); 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 Φ⊤Φ\boldsymbol\Phi^\top\boldsymbol\Phi 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.

Question 1

With cT=γ=0.9c_T=\gamma=0.9 and cR=1−γ=0.1c_R=1-\gamma=0.1, two states are at bisimulation distance d∼(s,t)=0.05d^\sim(s,t)=0.05. What is the largest possible gap ∣V⋆(s)−V⋆(t)∣\abs{V^\star(s)-V^\star(t)}?

  1. 0.0050.005
  2. 0.050.05
  3. 0.450.45
  4. 0.50.5
Show the answer

D. 0.50.5

The theorem gives cR∣V⋆(s)−V⋆(t)∣≤d∼(s,t)c_R\abs{V^\star(s)-V^\star(t)}\le d^\sim(s,t), so the gap is at most 0.05/0.1=0.50.05/0.1=0.5. The factor 1/cR=1/(1−γ)1/c_R=1/(1-\gamma) is the effective horizon: a small per-step discrepancy can accumulate over the horizon.

Question 2

Why is the worst-case approximation error of a representation over all policies attained at deterministic policies?

  1. Because deterministic policies have the largest values
  2. 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
  3. Because stochastic policies cannot be represented linearly
  4. 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

∥(I−Πϕ)V∥2\norm{(\mathbf I-\Pi_\phi)V}^2 is convex in VV. 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 δ\boldsymbol\delta, giving the adversarial value functions.

Question 3

Rewards are linear in features, r=ϕ⊤wr=\boldsymbol\phi^\top\mathbf w. A new task changes only w\mathbf w. What do successor features ψπ\boldsymbol\psi^\pi give you?

  1. The optimal policy for the new task, without any computation
  2. Nothing, because the policy must be relearned for every reward
  3. The new task's values for π\pi immediately, Qπ=ψπ⊤wQ^\pi=\boldsymbol\psi^{\pi\top}\mathbf w, and with several policies a GPI policy at least as good as each of them
  4. A bisimulation metric for the new task
Show the answer

C. The new task's values for π\pi immediately, Qπ=ψπ⊤wQ^\pi=\boldsymbol\psi^{\pi\top}\mathbf w, and with several policies a GPI policy at least as good as each of them

Linearity of expectation splits QπQ^\pi into "which features π\pi will accumulate" (ψπ\boldsymbol\psi^\pi) and "what each feature is worth" (w\mathbf w). Evaluation transfers exactly; generalized policy improvement over several stored policies gives a policy no worse than any of them, though not necessarily optimal.

Question 4

RAD and DrQ matched or beat the contrastive method CURL on DeepMind Control using image augmentation alone. What does this show?

  1. Contrastive learning never helps in RL
  2. Data augmentation works only in combination with a contrastive loss
  3. 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
  4. 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).