Choosing an RL Algorithm
Choose the algorithm from the experiment, not the leaderboard. How action space, data access, safety and compute narrow the field.
Jump to a section
Start from the experiment, not the algorithm
PPO's MuJoCo benchmarks ran for one million environment steps per task. On a physical robot arm controlled at 10 steps per second, one million steps is about 28 hours of continuous operation, before counting resets, breakages or a second random seed. An algorithm that looks cheap in a simulator can be unaffordable, or unsafe, on the real thing.
There is no generally best reinforcement-learning algorithm. The useful questions come first: what decisions does the agent make, how does it get experience, and what does a bad action cost? Take one task through those questions: a robot arm that picks parcels from a bin. As a tiny gridworld, in a fast simulator, on the real arm, and from a log of past operations, it is four different problems, and each one points to a different family of methods.
Choose the family before tuning a library. Then compare the candidates under one environment, one observation and reward definition, one interaction budget, one compute budget and one evaluation protocol.
A shortlist by situation
Treat this table as a shortlist, not an automatic winner. Data quality and engineering constraints decide the branch.
| Situation | Candidate starting point | Main cost or failure mode |
|---|---|---|
| Small, discrete state and action spaces | Tabular Q-learning or SARSA | Tables scale poorly; exploration still matters |
| Large observations, discrete actions, online interaction | DQN-style value learning | Replay and bootstrapped value error need care |
| Online policy learning with discrete or continuous actions | PPO | Fresh rollouts can be expensive in environment steps |
| Continuous control with costly online interactions | SAC | Reused data helps, but critic bias and tuning still matter |
| Fixed logged dataset, no safe interaction | Offline RL such as CQL, plus behavioral baseline | Out-of-distribution actions can receive unreliable values |
| Learnable dynamics and costly interaction | Model-based methods | Model error can compound over imagined rollouts |
Match the learning signal to the task
Action space, data availability, and interaction cost constrain the choice of learning method.
Exact inputs and equations appear with the figure.
Preparing the scientific figure…
A shortlist that mirrors the article’s table, not an automatic recommendation or a ranking. PPO also handles discrete actions; compare candidates under the same budgets and evaluation.
Authored analytic exampleSafety is a constraint on the experiment, not a property you can infer from an algorithm's name. If a bad exploratory action is unacceptable, the plan needs a safe simulator, an action shield, a constrained policy or an offline evaluation before any online RL runs. A high reward does not show that exploration was safe; count the violations and the worst outcomes, during training as well as evaluation.
What each family learns from
Every method here maximizes the discounted return , but they learn from different signals. Value-based methods estimate the expected return of each action and act greedily on the estimates. Policy-gradient methods adjust action probabilities directly in the direction that raises expected return.
The other split is where the data comes from. An off-policy method can learn from transitions generated by a different behaviour policy, including old versions of itself stored in a replay buffer. An on-policy method such as PPO updates only on fresh samples from a recent policy, then discards them.
Q-learning and DQN. For a nonterminal transition, Q-learning moves towards . The max over actions is cheap when actions are few and discrete, which is the setting DQN was built for: Mnih et al. learned directly from screen pixels on 49 Atari games with up to 18 actions each. For the gridworld version of the parcel task, a table of is enough.
PPO. The update weights each action's likelihood ratio under the new and old policies by its advantage, and clips the ratio in the surrogate objective so that one batch cannot push the policy far. It handles discrete and continuous actions, which makes it a common default in a fast simulator. Its cost is that every update needs new rollouts.
SAC. Soft Actor-Critic reuses a replay buffer and adds an entropy bonus to the objective, so the policy stays as random as the reward allows. It was designed for continuous control, and reusing old transitions is what improves its interaction efficiency there. On the real arm, where each step costs time and wear, that reuse is the main reason to try it before PPO.
These are different optimization signals, not entries in an accuracy ranking. Each fits the setting it was designed for, and moving one outside that setting needs a reason.
Fixed logs and learned models
Suppose new actions on the arm cannot be tried at all, and all you have is a log of past operations. Offline data brings a coverage problem. A learned policy may prefer actions that never appear in the log, and bootstrapped value estimates can give those unseen actions undeserved high value, because nothing in the data ever corrects them. Standard Q-learning on a fixed log does exactly this.
CQL addresses the problem by learning conservative values: it pushes down the estimated value of actions the policy prefers but the data does not support. Its assumptions still matter, and so does a baseline. Behaviour cloning, which imitates the logged actions directly, is the comparison that shows whether offline RL learned anything beyond the log. Record how much of the action space the behaviour policy covered.
Model-based methods take a third route. They learn a model of the dynamics and generate simulated experience from it, trading extra computation for fewer real interactions. The risk is model bias: small errors compound over imagined rollouts, which is why methods such as MBPO keep those rollouts short.
Writing the comparison down
Two budgets must stay separate. Environment steps measure interaction cost, the thing that is scarce on a real robot. Wall-clock time includes simulation, model training, data transfer and evaluation. A method can win on one axis and lose on the other, so report performance against both, across several seeds, with the same termination and truncation rules.
Write the experiment contract before running any candidate. This standard-library sketch records the numbers a reviewer needs; the values come from actual run logs, never from the shortlist.
1from statistics import median
2
3
4def summarize_run(env_steps, eval_returns, safety_violations, wall_seconds):
5 assert env_steps > 0 and wall_seconds > 0
6 assert eval_returns, "evaluate complete episodes"
7 assert safety_violations >= 0
8 return {
9 "env_steps": env_steps,
10 "median_eval_return": median(eval_returns),
11 "eval_episodes": len(eval_returns),
12 "safety_violations": safety_violations,
13 "wall_seconds": wall_seconds,
14 }
15
16
17run = summarize_run(env_steps=1_000_000, eval_returns=[212.0, 198.5, 240.1], safety_violations=0, wall_seconds=3600)
18assert run["median_eval_return"] == 212.0 and run["eval_episodes"] == 3
19assert 1_000_000 / 10 / 3600 > 27 # a million steps at 10 Hz is over 27 hours of robot timeFor each candidate, fix the action and observation spaces, the reward and constraint definitions, the evaluation episodes, the seeds and the stopping budget. Then compare learning curves with their spread across runs, and the worst safety outcomes alongside the median.
Where selection goes wrong
Unequal budgets. One method gets more environment steps, more tuning or a different time limit, and wins for that reason alone. Fix the budgets before the first run.
One lucky seed. RL results vary widely across random seeds. A single best seed or one final score is not enough to choose a policy you intend to deploy.
Throughput mistaken for data. A faster simulator or a better GPU raises wall-clock throughput, but on a real system it cannot create environment steps. PPO on the physical arm is still bounded by how many picks the arm can make.
Online methods on offline data. Running standard Q-learning or SAC on a fixed log, as if it could explore, invites overvalued actions the log never contained.
Put together, the parcel task resolves into three answers. The gridworld version wants tabular Q-learning, which fits because the table is small, and fails if exploration never reaches some states. The real arm wants SAC, for its reuse of each costly step, with critic bias as the risk and a safe-exploration plan as the precondition. The fixed log wants CQL against a behaviour-cloning baseline, and should be trusted only after it has been evaluated on states the log actually covers.
Sources and further reading
- Mnih et al., Human-level Control through Deep Reinforcement Learning (2015): DQN on high-dimensional observations and discrete game actions.
- Schulman et al., Proximal Policy Optimization Algorithms (2017): on-policy clipped surrogate.
- Haarnoja et al., Soft Actor-Critic (2018): off-policy continuous-control actor-critic method.
- Kumar et al., Conservative Q-Learning for Offline Reinforcement Learning (2020): fixed-data distribution-shift problem and conservative values.
- Janner et al., When to Trust Your Model (2019): model-generated experience versus model bias.