Self-supervised Reinforcement Learning

Machine Learning
Introduced by
Laskin, M.; Srinivas, A.; Abbeel, P. (and contemporaries)
Year
2020
Type
Self-supervised auxiliary-task learning for RL
Family
Deep learning / NLP / CV

What does it do?

Self-supervised reinforcement learning (SSL-RL) adds self-supervised auxiliary objectives, such as contrastive, predictive or data-augmentation-based tasks, to standard reinforcement learning training.

These objectives are computed on the agent's own stored observations and typically share an encoder with the RL policy and value networks, so they need no external labels. The approach is most often considered for high-dimensional observations such as raw pixels.

The intuition behind the method

Reward signals in RL are often sparse and delayed, so an agent trained only on rewards may need a large amount of experience before its internal features become useful. SSL-RL adds a second learning signal that is derived from the observations themselves, for example by asking whether two augmented views of the same frame are related, or by predicting future observations. Because this signal is available at every step, it can shape the encoder's representation before informative rewards appear. The benefit is usually measured as faster learning and better generalisation, not as a guaranteed improvement.

History

Interest in combining self-supervised learning with RL grew around 2020. CURL (Laskin, Srinivas and Abbeel, ICML 2020) applied momentum contrastive learning to pixel-based RL and reported large gains over pure RL baselines on the DeepMind Control Suite and Atari. RAD (Laskin et al., NeurIPS) showed that simple data augmentation alone can act as an effective self-supervised regulariser. The term now covers a broader family of methods that also includes predictive and world-model objectives, which are discussed generically in the FAQ.

When to use it

Consider SSL-RL when a deep RL agent learns from high-dimensional observations, such as images, and sample efficiency is a practical constraint. It is most relevant when environment interaction is expensive or the reward is sparse, which are the conditions the auxiliary signal is intended to help with. Do not use it when the state is low-dimensional and already well structured, as in classical control with full state access, since the auxiliary task then has little additional structure to learn from. It is also unnecessary when labelled auxiliary data is available for supervised pre-training, or when a standard RL baseline already converges quickly on a simple task.

Limitations and considerations

  • The auxiliary loss design, augmentation choice and loss weighting are extra hyperparameters that must be tuned alongside the RL settings.
  • Contrastive objectives such as CURL use a momentum encoder and a large batch of negatives, which increases memory cost.
  • The gain depends on the observations having exploitable structure; with low-dimensional state vectors the auxiliary task offers little to learn.
  • The auxiliary objective can favour features that help discriminate or predict observations but are not useful for choosing actions, so the two losses can pull the encoder in different directions.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • On pixel-based control benchmarks, the contrastive approach of CURL reported improved sample efficiency over pure RL baselines without adding environment steps.
  • The auxiliary loss is computed from transitions the agent already collects, so no human labels or separate dataset are needed.
  • The method is added as an extra loss term on a shared encoder, so it can usually be attached to an existing SAC, DQN or PPO implementation without changing the RL update rule.
  • RAD indicates that simple augmentation of the observations can act as a self-supervised regulariser, so a version without contrastive machinery is possible.

Applications

  • Pixel-based control tasks in simulated benchmarks, such as the DeepMind Control Suite and Atari settings in which CURL was evaluated.
  • Visual RL tasks with sparse rewards, where early representation learning may reduce the time before the agent receives useful reward signals. This is a hypothesis to test against a pure RL baseline rather than an established result.

How it works

How it works

1

The agent interacts with the environment under its current policy and collects transitions of observation, action, reward and next observation. In off-policy methods these transitions are stored in a replay buffer, which supplies the data for both the RL update and the self-supervised auxiliary task.

2

A self-supervised objective is applied to observations sampled from the buffer. The examples given for this page include contrastive learning, where CURL treats augmented crops of the same frame as positive pairs, momentum contrast, masked prediction, and data augmentation as used in RAD. These tasks need no external labels, because the training signal comes from the structure of the observations.

3

The auxiliary loss trains a shared encoder so that its representations capture structure that is relevant to the task, such as invariances to visual changes or aspects of temporal dynamics. Because the encoder is also used by the policy and value networks, the change in representation affects the RL objective directly.

4

Standard RL updates, for example with Soft Actor-Critic, DQN or PPO, are applied through the same shared encoder. The gradients from the RL loss and the auxiliary loss both shape the encoder and the policy. The relative weight of the two losses is a key hyperparameter.

5

Performance is assessed on the target task with reward-based measures, such as cumulative return, sample-efficiency curves, and performance on held-out environment seeds or with visual distractors. Gains reported for SSL-RL are usually faster reward acquisition and better generalisation relative to a pure RL baseline trained under the same settings.

Common pitfalls

  • Applying SSL-RL to low-dimensional state-based environments, where the auxiliary task adds cost without a clear benefit.
  • Choosing augmentations that remove task-relevant information, for example strong colour jitter in environments where colour identifies the goal.
  • Leaving the weight between the RL and auxiliary losses untuned, so that one objective dominates training.
  • Evaluating only on training seeds, which can hide the generalisation failures that held-out seeds or visual distractors would reveal.
  • Changing the auxiliary loss without re-tuning the RL hyperparameters, since the two sets of settings interact through the shared encoder.

Frequently asked questions

What is the difference between self-supervised RL and transfer learning in RL?

Transfer learning in RL pre-trains a model on a source task and transfers it to a target task. Self-supervised RL trains the representation using auxiliary tasks derived from the agent's own current-task experience, without a separate source domain or pre-training phase.

Which self-supervised objective should I choose?

Contrastive methods such as CURL are one option for visual observations, and data augmentation as in RAD is a simpler alternative. Predictive and world-model objectives form a further family and can be more involved to implement. For pixel-based control, RAD or CURL are reasonable starting points, though the best choice depends on the task and should be checked empirically.

Does SSL-RL help with sparse rewards?

It may. Because the auxiliary signal is available at every step, it can shape the encoder before reward arrives, which could reduce the cold-start problem. The size of this effect depends on the task and should be tested against a pure RL baseline.

Does SSL-RL require more compute than standard RL?

Yes, somewhat. The auxiliary objective adds a forward pass and a gradient computation per update. Whether this is offset depends on whether the method reaches the same performance in fewer environment steps, which is a task-specific question.

Can I combine SSL-RL with model-based RL?

Possibly. Model-based RL already learns a predictive model of the environment, which is a form of self-supervised objective. Adding contrastive or reconstruction-based objectives on top of a learned world model is an active research direction, and the results depend on the task.

Related methods

Sources

  1. Laskin, M., Srinivas, A., & Abbeel, P. (2020). CURL: Contrastive Unsupervised Representations for Reinforcement Learning. Proceedings of the 37th International Conference on Machine Learning (ICML), PMLR 119, 5639–5650.

    Open publication reference
  2. Laskin, M., Lee, K., Stooke, A., Pinto, L., Abbeel, P., & Srinivas, A. (2021). Reinforcement Learning with Augmented Data. Advances in Neural Information Processing Systems (NeurIPS), 33, 19884–19895.

    Open publication reference