arXiv:2610.20401cs.LGOct 2026

Manuscript Offprint

arXiv:2610.20401

Training Language Models to Fail Gracefully

Daman Arora, Xuecheng Liu, Himanshu Gaurav Singh, Fahim Tajwar, Abitha Thankaraj, Ruslan Salakhutdinov, Haiwen Feng, Yuda Song, Andrea Zanette

Abstract

Reinforcement learning makes language models better at solving tasks, but the same mechanism also rewards guessing. When success is the only way to earn reward, opting for a safe fallback is always worse than a long-shot attempt. When a wrong action can corrupt a database or ship broken code, that incentive can be costly. Therefore, we propose training models to fail gracefully: to preserve successful behavior whenever possible while learning to execute a safe fallback policy when acting would be unreliable. However, naively using policy gradients with intermediate reward for fallback behavior is brittle due to unfavorable optimization dynamics. We address this challenge with GRACEFULRL, which reshapes the optimization landscape to promote graceful failure. Importantly, this behavior emerges directly from outcome-level reward signals, without annotations specifying when to fall back or additional inference-time machinery such as a verifier. Across a range of tasks and scales, we train models that largely preserve their task-solving capability while selectively falling back when acting would be unreliable. More broadly, our results show that reinforcement learning can not only incentivize models to succeed, but also to reason about the limits of their capabilities and change course when they determine that success is out of reach.

1 Introduction

Large Language Models (LLMs) can now complete in minutes tasks that would take a person hours. They write and refactor code across whole repositories, produce long mathematical arguments, and act as agents that edit files and run commands on our behalf. Significant improvements in such capabilities can be attributed to Reinforcement learning (RL) in domains with verifiable rewards such as coding and mathematics, (Guo et al., 2025; OpenAI et al., 2026; Shao et al., 2024) where models are rewarded for successful task completion (Lambert et al., 2025; Luo et al., 2025).

These improvements are often measured by metrics such as accuracy or success rate, but these metrics say little about how the model behaves when it does not succeed. Models are imperfectly informed and computationally bounded during inference. Therefore, there always exist situations in which appropriate actions cannot be reliably determined. In such cases, reinforcement learning can incentivize guessing, as a strategy to maximize reward (Kalai et al., 2025), laying the burden of verification on the user. Someone needs to check the proof, review the pull request, and confirm what the agent actually did. This verification can be tedious and prone to errors, and when it fails, mistakes can propagate into consequential actions.

Project website, code, and other assets: https://zanette-labs.github.io/failing-gracefully/

Correspondence: {damana,azanette}@andrew.cmu.edu

(a) Outcome preference

Three outcomes, ordered by preference

Success

Solves the task

Fallback

Defer safely

Error

Commits a harmful mistake

Success > Fallback > Error

A safe fallback is preferable to an error.

(b) Optimization geometry

JGracefulRL=(1−c)log⁡pS+clog⁡(1−pE)\mathcal{J}_{\text{GracefulRL}} = (1 - c) \log p_S + c \log(1 - p_E)

Success

pS=1p_S = 1

Figure

Fallback

pF=1p_F = 1

Barrier 2:

pS→0p_S \rightarrow 0

Barrier 1:

pE→1p_E \rightarrow 1

Enables end-to-end policy optimization

(c) AIME performance

Qwen3-4B-Base trained on DAPO-17k

Rate (%)

Figure

Error rate reduces by 70.2 points

Figure 1: Learning to fail gracefully. (a) GRACEFULRL augments standard RLVR with an explicit fallback behavior, ordered as SUCCESS ≻\succ FALLBACK ≻\succ ERROR. (b) Standard policy gradient (PG) can lose optimization signal near saturated policies. In contrast, the GRACEFULRL objective retains a non-vanishing gradient. (c) Using models trained with GRACEFULRL on the AIME benchmark, the most cautious model (c = 0.8) reduces the error rate from 79.1% to 8.9%, an 88.8% relative reduction, while success only drops by 3.1% compared to RL with binary rewards (c = 0).

Therefore, we want models that change course when success is unlikely. If they can solve a task reliably, they should. If they cannot, they should do something else: revert their changes, inform the user that they are stuck, or hand the task to a different model. We call this behaviour failing gracefully. Not only does graceful failure avoid harmful actions, it also helps build trust with users.

The naive way to train for this behavior is to reward success most, fallback second, and failure least. In principle, this should teach the model to keep trying when success is within reach and to fallback when it is not. Surprisingly, we find that learning this behavior with standard policy-gradient methods (Williams, 1992) and their derivatives (Shao et al., 2024) can be brittle. In the worst case, they can collapse to a model that always falls back and stops solving the task altogether (Section 3). We trace this failure to unfavorable optimization dynamics: the objective expresses the behavior we want, but the optimization process does not reliably produce it.

We introduce GRACEFULRL, a reinforcement learning approach designed to avoid this pathology. We modify the optimization landscape which lets us maintain pressure to solve the task, while simultaneously encouraging the model to fall back rather than making an error when success is unlikely. Crucially, the model learns when to fall back from its own interaction with the environment with no labels specifying which problems are too hard, and no separate uncertainty model or post-hoc decision rule at inference time.

Across navigation, mathematical reasoning, and multi-turn Minesweeper, GRACEFULRL learns selective fallback while preserving strong task performance. On AIME, it reduces the error rate from 79.1% to 8.9% while sacrificing only 3.1 percentage points of success relative to standard RL. In Minesweeper, it improves both sides of the tradeoff, increasing success while reducing errors. Perhaps most strikingly, we find that the model verbalizes its decision making strategy in its chain-of-thought when its about to change course. Overall, our results suggest that reinforcement learning can not only improve a model's task performance, but also shape it's behavior when success is unlikely.