Reinforcement Learning with Backtracking Feedback
Safety training usually teaches a model to refuse at the start of a response. That leaves a gap: if a request looks benign, or an attacker plants instructions partway into the context, the model has already committed to answering and nothing stops it from drifting into harmful territory later. The available fixes are blunt. Resetting the generation throws away everything written so far, which is wasteful when a single offensive line appears in an otherwise correct page of text. Earlier backtracking work (BSAFE) was more targeted but asked the model to repeat the harmful span before rewriting it — a step the authors argue costs efficiency and leaves artifacts in the output, though the paper reports no measurement of either.
RLBF gives the model a cheaper correction signal. When a violation is detected, the model emits a category token identifying the kind of violation and then a single [BACKTRACK_BY_X] token, where X is the count of preceding tokens to drop. Generation stays autoregressive throughout; the internal state and KV cache are never rewound. The special tokens are instructions to an output handler, which deletes the last X tokens from what the user sees and splices in whatever comes next, so a small streaming buffer is enough to make the correction nearly real-time. Two training stages teach this. Supervised fine-tuning uses BSAFE+ data, built by taking a high-quality safe answer from the model being trained and injecting a violation at a contextually plausible spot — because the original answer is known, both the exact backtrack distance and an in-distribution safe continuation come for free. A reinforcement learning stage (GRPO, with the SFT loss mixed in at weight 0.1) then trains against an LLM safety critic scoring the model's own live rollouts: +1.0 for a clean generation or a successful correction, -1.0 for an uncaught violation, -0.5 for backtracking over text that was fine, and -0.2 for a correction that lands somewhere unsafe or incoherent.
The RL stage is what separates RLBF from SFT-only backtracking. On Middle Filling attacks the two are close (RLBF 3-7% attack success, BSAFE+ 3-6%), but on the plain LMSYS harmful-query subset RLBF reaches 1-2% against BSAFE+'s 14-17% and instruction tuning's 24-28%. The authors hypothesize, rather than demonstrate, two reasons: the RL policy learns to avoid entering the bad state instead of only cleaning up after it, and the one-token backtrack command is an easier signal to execute reliably than BSAFE's multi-token rewrite. Robustness also holds on attacks absent from the training data — under GCG, RLBF sits at 4.3-4.7% against BSAFE+'s 5.7-6.6% and Circuit Breakers' 10.7-13.4% — and an adaptive GCG variant that also optimizes the suffix to suppress backtrack tokens leaves RLBF unchanged (4.7% AdvBench, 4.3% HEx-PHI), with BSAFE+ moving at most 0.4 points. Utility is essentially untouched: Gemma 2 9B with RLBF scores 70.7% on MMLU and 35.6% on MATH against the instruction-tuned baseline's 70.6% and 35.4%, with BBH and GSM8K a tenth of a point lower.
Key results
- On the standard LMSYS harmful-query subset, RLBF holds attack success rate to 1-2% across five models, against 14-17% for the SFT-only BSAFE+, 17-21% for Circuit Breakers, and 24-28% for instruction tuning.
- Against Middle Filling attacks both backtracking methods work about equally well (RLBF 3-7%, BSAFE+ 3-6%), far below Circuit Breakers at 13-18% and instruction-tuned baselines at 68-81%.
- Robustness generalizes to attacks absent from training data: under GCG, RLBF reaches 4.3-4.7% ASR, ahead of BSAFE+ at 5.7-6.6% and Circuit Breakers at 10.7-13.4%; an adaptive GCG variant that optimizes the suffix to suppress backtrack tokens leaves RLBF's numbers unchanged (4.7% AdvBench, 4.3% HEx-PHI).
- Essentially no alignment tax: Gemma 2 9B with RLBF scores 70.7% MMLU and 35.6% MATH against the instruction-tuned baseline's 70.6% and 35.4%, with BBH and GSM8K within a tenth of a point; the earlier BSAFE data recipe, by contrast, dropped an instruction-tuned model to a 28.2% win rate on LMSYS.
BibTeX
@inproceedings{sel2025rlbf,
title = {Reinforcement Learning with Backtracking Feedback},
author = {Sel, Bilgehan and Keshava, Vaishakh and Wallis, Phillip and Rutishauser, Lukas and Jin, Ming and Li, Dingcheng},
booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
year = {2025}
}