Skip to main content
Reinforcement Learning (RL) enables robots to learn from trial and error by interacting with their environment. Instead of requiring expert demonstrations, RL agents learn optimal behaviors by maximizing cumulative reward signals.

Overview

In RL, a policy learns to select actions that maximize expected future rewards through repeated interaction with the environment. This approach is particularly valuable when:
  • Expert demonstrations are difficult or expensive to collect
  • The optimal solution is unknown
  • The task requires exploration and discovery
  • You want policies that can adapt and improve beyond human performance

How It Works

The RL Loop

Key Components

Policy: Neural network that maps observations to actions Reward Function: Scalar signal indicating action quality Replay Buffer: Stores past experiences for learning Value Function: Estimates expected future rewards

Supported Algorithms

SAC (Soft Actor-Critic)

SAC is an off-policy actor-critic algorithm that maximizes both reward and entropy, encouraging exploration:
Key features:
  • Stable training through soft updates
  • Maximum entropy objective for exploration
  • Off-policy learning from replay buffer
  • Works well with continuous action spaces
Best for: Robotic manipulation, continuous control, tasks requiring exploration

TDMPC (Temporal Difference Model Predictive Control)

TDMPC combines model-based RL with model predictive control:
Key features:
  • Learns world model for planning
  • Sample efficient compared to model-free RL
  • Uses trajectory optimization
Best for: Sample-efficient learning, simulation environments, tasks with clear dynamics

HIL-SERL (Human-in-the-Loop SERL)

HIL-SERL combines RL with human interventions for safe, efficient real-world learning:
Key features:
  • Human interventions guide safe exploration
  • Combines offline demos with online RL
  • Reduces training time by 10x
  • Safe for real robots
Best for: Real-world robot learning, safety-critical tasks, bootstrapping from demos See the complete HIL-SERL example for implementation details.

Reward Design

The reward function is critical for RL success. LeRobot supports several approaches:

Hand-Crafted Rewards

Learned Reward Models

Train a classifier to predict rewards from observations:
See examples/tutorial/rl/reward_classifier_example.py.

Human Feedback

Use human interventions as implicit rewards in HIL-SERL:

Key Concepts

Exploration vs Exploitation

RL agents must balance exploring new behaviors with exploiting known good actions:

Replay Buffer

Store and reuse past experiences for stable learning:

Off-Policy vs On-Policy

Off-policy (SAC, TDMPC): Learn from any past experience
  • More sample efficient
  • Can reuse old data
  • Requires replay buffer
On-policy (PPO, A3C): Learn only from current policy
  • More stable
  • Simpler implementation
  • Cannot reuse old data

Combining RL with Imitation Learning

Bootstrap RL training with demonstrations for faster learning:

Advantages

  • No Expert Required: Learns from environment feedback
  • Discovers Solutions: Can find strategies humans might not consider
  • Adaptive: Continues improving with more experience
  • Optimal: Can exceed human performance

Limitations

  • Sample Inefficient: Requires many environment interactions
  • Reward Engineering: Designing good reward functions is challenging
  • Unstable: Training can be sensitive to hyperparameters
  • Safety: Random exploration can be dangerous on real robots
  • Sim-to-Real Gap: Policies trained in simulation may not transfer

Best Practices

Next Steps