Free Action Adversaries: Storing Worst-Case Perturbations in the Replay Buffer

Robust reinforcement learning (RL) often trains an agent against an adversary that pushes on its actuators or physics. The goal is a controller that keeps working when the real robot is heavier, slipperier, or noisier than the simulator. The cost is steep. The adversary is usually a second policy that needs its own training, and the agent's learning slows while the two co-evolve. Supervised adversarial training faced the same kind of cost and largely solved it with two tricks. The first reuses the gradient already computed for the model update to also move the attack ("free" training). The second takes a single attack step from a random starting point instead of many careful ones ("fast" training).

This note proposes the RL analogue for action-space adversaries in off-policy actor-critic methods. In those methods the actor update already computes how the learned value changes with the action. That gradient is exactly the direction an action adversary wants, so the worst-case perturbation can be updated as a by-product of the actor update. It is then stored next to each transition in the replay buffer and warm-started every time that transition is revisited. If this works, minimax-level robustness to action and dynamics shifts would cost roughly the same as ordinary training. The main question is whether RL has its own version of the "catastrophic overfitting" failure that broke cheap adversarial training in vision.

Core Claim

Consider deterministic actor-critic methods such as TD3 or DDPG. The actor is trained by following $\nabla_a Q(s,a)\,\nabla_\theta \pi_\theta(s)$, where $Q$ is the learned value of taking action $a$ in state $s$, and $\pi_\theta$ is the policy with parameters $\theta$. The term $\nabla_a Q$ is the same quantity an action adversary needs in order to pick the perturbation that lowers value the most. We claim three things.

First, an additive action adversary bounded by a norm can be run with no extra backward passes for the actor term. Its state lives in the replay buffer: a per-transition perturbation $\delta_i$ that is refined a little each time transition $i$ is sampled.

Second, data replay at update-to-data ratios above one is already standard in off-policy RL. It plays the role of Free adversarial training's minibatch replay. Free training's known problem of losing data diversity therefore costs little here, because replay happens anyway.

Third, the risk specific to RL is critic-side gradient masking. The critic could become jagged along the action axis, so single-step attacks look weak while real worst-case actions remain damaging. Random starts inside the action ball, borrowed from fast adversarial training, should prevent this, and we will test whether they do.

Concretely, each time transition $i$ is drawn, its stored perturbation is updated from the gradient that the actor's backward pass already produced:

$$\delta_i \leftarrow \Pi_{\|\delta\|\le\epsilon}\Big(\delta_i - \eta\,\frac{\nabla_a Q(s_i, a)}{\|\nabla_a Q(s_i, a)\|}\Big|_{a=\pi_\theta(s_i)+\delta_i}\Big).$$

Here $\Pi$ projects back onto the ball of radius $\epsilon$, and $\eta$ is the attack step size. With probability $\rho$, $\delta_i$ is reset to uniform noise in the ball. The protagonist maximizes $Q(s_i,\pi_\theta(s_i)+\delta_i)$. Bellman targets use the stored perturbation of the successor transition, $y_i = r_i + \gamma Q'(s'_i, \pi'(s'_i)+\delta_{\text{next}(i)})$, where $Q'$ and $\pi'$ are the target critic and target policy. During rollouts, the executed action is perturbed with probability $p$ by a single fresh step, which costs one critic backward pass through a small network. This makes the training data cover the perturbed actions the critic is asked to evaluate.

Relation to Prior Work

Three groups of papers frame this work.

The first group supplies the minimax objective and motivates the work by documenting its cost. Robust Adversarial Reinforcement Learning alternates protagonist and force-adversary training with TRPO. The RRLS benchmark found it suffers prolonged slow initial learning. Action Robust Reinforcement Learning and Applications in Continuous Control defines the noisy-action formulation (NR-MDP) we adopt, and trains a separate adversary actor. It also shows that an unchecked adversary makes InvertedPendulum unlearnable (companion version). That result constrains us: it is why the ball radius is fixed and small rather than learned. Robust Deep Reinforcement Learning with Adaptive Adversarial Perturbations in Action Space (A2P-SAC) stabilizes this setup by adapting the perturbation magnitude, but it still trains two full networks. Robustifying Reinforcement Learning Agents via Action Space Adversarial Training runs multi-step projected gradient descent (PGD) in action space inside PPO. It is the closest "pay full compute" reference. We replace its inner loop with zero to one recycled steps.

The second group supplies the method. Adversarial training for free! recycles a single backward pass to update both the weights and a warm-started perturbation. Fast is better than free shows that one step with a random start matches multi-step robustness. It also identifies catastrophic overfitting, where zero-initialized single-step attacks yield a model that resists one-step attacks but collapses under multi-step ones. We transfer both ideas, with one change. In the vision work, Free training carries a single perturbation from one batch into the next. We instead keep a per-sample perturbation in the replay buffer, which is possible because RL revisits stored transitions.

The third group is the closest efficiency work, and the proposal must differ from it clearly. Efficient Adversarial Training without Attacking (WocaR-RL) removes the attacker by bounding worst-case value with convex relaxations. It is restricted to observation perturbations bounded by a norm, and its authors note the bound can be overly conservative. Robust Deep RL against Adversarial Perturbations on State Observations uses the same relaxation machinery, at notable cost. Explicit Lipschitz Value Estimation Enhances Policy Robustness Against Perturbation (PPO-PGDLC) uses FGSM-assisted search with a Lipschitz-penalized critic to estimate worst-case values. It does not recycle the actor gradient, does not warm-start perturbations, and does not study catastrophic overfitting on the actor side. Our proposal differs from all three: it targets action and dynamics robustness rather than observations, uses no bound propagation, and eliminates the adversary network rather than only smoothing the critic. We treat PPO-PGDLC's Lipschitz critic as an optional stabilizer to ablate, not as a core ingredient.

Research Program

The build is a modification of TD3 inside the RRLS codebase (SuReLI/RRLS). It adds a perturbation column to the replay buffer, a perturbation update hooked into the actor backward pass, and successor indexing for the targets.

The analysis has three parts.

The first is a cost accounting: wall-clock time, gradient evaluations, and environment steps per unit of final robustness, compared against learned-adversary and multi-step baselines.

The second is a gradient-masking diagnostic. Throughout training, we measure the gap between the value drop found by our stored single-step perturbation and the drop found by a 20-step PGD attack with restarts on the same critic. We also track the critic's action-gradient norm and a finite-difference curvature estimate along the action axis. We expect zero-initialized, no-reset variants to show a growing gap, which would be the RL analogue of catastrophic overfitting. Random resets should keep the gap flat.

The third is a staleness study. The stored $\delta_i$ was computed under an older critic, so we vary the reset probability $\rho$ and the update-to-data ratio to map when warm-starting helps and when stale perturbations hurt.

Baselines

The naive reference is plain TD3 trained for 5 million steps on the same RRLS environments, with exploration noise matched to our method's average perturbation magnitude. It sets the nominal-return ceiling and the robustness floor.

Domain randomization, as implemented in RRLS, samples mass, friction, and damping uniformly each episode. It is the strongest cheap competitor: RRLS reports it is strong on average return across uncertainty sets and avoids RARL's slow start. It will run with the suite's own uncertainty sets and budget.

The strongest existing minimax methods are NR-MDP with a learned adversary actor, following Action Robust Reinforcement Learning, and M2TD3 and RARL, all as implemented in RRLS. We add A2P-SAC (Liu et al.) as the strongest stabilized learned-adversary method. On the reported numbers, the file gives RRLS's protocol of 5 million steps across 10 seeds. No reported result was found on Lacuna for NR-MDP, M2TD3, RARL, or A2P worst-case return values on RRLS. We will therefore reproduce them under identical seeds, step budgets, and per-method tuning budgets of equal size.

The accuracy reference is multi-step action PGD (K=10, three restarts) inside the same TD3 loop, in the style of MAS adversarial training. On Lunar Lander, that paper reports a nominal agent dropping from about 2.21 to 0.74 average reward under action attack. It gives no exact number for its robust agent, so we will rerun it.

Beating the field means two things together. Worst-case return over the RRLS grid must be within seed noise of, or above, the best of NR-MDP, M2TD3, and multi-step PGD. Wall-clock time must stay close to plain TD3 and clearly below those methods. Nominal return must also not fall below domain randomization by more than seed noise.

Four ablations isolate the key ingredients. A zero-initialized, never-reset variant tests catastrophic overfitting. A fresh single-step perturbation without buffer storage tests warm-starting. Random perturbations of identical magnitude test whether the adversarial direction matters. The Lipschitz critic penalty of PPO-PGDLC is added on and off to test whether critic smoothing is needed.

Why not just…?

Why not just inject random action noise of the same size? This is the most serious threat. TD3 already smooths its targets with noise, and if robustness comes from smoothness rather than from worst-case direction, our gradient step adds nothing. The magnitude-matched random-perturbation ablation settles it directly. If it matches our method on worst-case grid return and under a post-hoc learned attacker, we will report that the adversarial direction is unnecessary in this regime. That would be a useful negative result, and we would drop the claim.

Why not just use domain randomization? RRLS shows it is strong on average. However, it requires hand-chosen parameter ranges, and RARL and PPO-PGDLC argue it fails outside those ranges. We will test this by evaluating on mass and friction values beyond the training set, and by combining domain randomization with our perturbations. The combination costs almost nothing, so if it helps, the methods are complements rather than rivals.

Why not just keep a learned adversary network, as in NR-MDP or A2P? Learned adversaries can model state-dependent, temporally correlated attacks that a one-step critic gradient may miss. They also double the networks and, per the action-robust results, can overpower learning. The fair comparison is matched wall-clock time. We also evaluate every method against a held-out adversary trained after the fact, so a method is not graded only by the attack it trained on.

Why not just pay for multi-step PGD, or extend WocaR's convex bounds to actions? Multi-step PGD is the accuracy upper bound we compare against. If our method matches it, the extra compute is wasted, as Fast is better than free found in vision. Convex bounds over the action ball are possible in principle, but WocaR-RL reports they are conservative, and bound propagation is not free. We consider them out of scope beyond a single sanity comparison on Hopper.

Proposed Experiments

The main study runs on six RRLS environments (Ant, HalfCheetah, Hopper, HumanoidStandup, InvertedPendulum, Walker2d), with 10 seeds and 5 million steps. We report four quantities: nominal return, worst-case and average return over RRLS's mass, friction, and damping grids, return under a post-hoc learned action adversary at several radii, and wall-clock time plus gradient evaluations per run. A secondary check on Lunar Lander reproduces the action-attack setting of MAS adversarial training.

The decisive checks are three.

The first is the masking test. The 1-step-versus-20-step value-drop gap must stay bounded for the random-reset variant and grow for the zero-initialized variant. That pattern would confirm a real RL analogue of catastrophic overfitting and show the fix works. If neither variant shows a gap, the fast-training fix is unnecessary in RL, which is itself worth reporting.

The second is the random-direction ablation described above, which decides whether the adversarial direction matters at all.

The third is the cost-robustness frontier. Our method should sit at roughly TD3 wall-clock while matching NR-MDP and multi-step PGD on worst-case return. If it lands at the cost of those methods, or at the robustness of plain TD3, the proposal fails.