Manuscript Offprint

arXiv:2610.02039

CARM: Cancellation-Aware Response Masking for LLM Reinforcement Learning

Yafei Zhang, Songshuo Lu, Sicong Liao, Zhi Chen, Yaohua Tang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original. This text is shared under the same licence.

ABSTRACT

Recent years have witnessed the rapid adoption of reinforcement learning (RL) in large language model (LLM) post-training, with substantial gains in mathematical reasoning and code generation. In practical systems, however, policy updates and differences between rollout and training engines can make sampled responses off-policy. Sequence-level masking addresses this mismatch by deciding whether an entire response should contribute to optimization. A common masking rule uses the length-normalized geometric mean of sampled token probability ratios. Its signed log-ratios can cancel across positions, concealing substantial bidirectional policy drift. We propose Cancellation-Aware Response Masking (CARM), a sequence-level mask that takes the absolute value of each token log-ratio before averaging, preventing opposing probability changes from canceling. We prove that accepted responses satisfy a joint bound on the fraction of sampled-token ratios outside a prescribed band and their mean log-distance beyond its boundaries. Experiments on mathematical reasoning and code generation show that CARM improves mean@16 averaged over AIME 2024/2025/2026 and BeyondAIME by up to 3.13 percentage points over geometric-mean masking, and increases average pass@1 across four code benchmarks by 2.88 points over the strongest evaluated baseline. These findings support CARM as a theoretically grounded and effective method for response-level off-policy control in LLM reinforcement learning.

1 INTRODUCTION

Reinforcement learning (RL) is widely used to improve the reasoning ability of large language models (LLMs), building on advances in preference-based alignment and execution-feedback learning (Ouyang et al., 2022; Le et al., 2022). In an ideal on-policy setting, responses are generated by the same policy that is being optimized. In practical systems, however, several effects introduce policy mismatch. Mini-batch optimization makes stored responses stale as the policy changes, while actor–learner latency can delay their use. High-throughput rollout engines may also differ from the training backend in batching, numerical precision, and kernel implementations (Yao et al., 2025; Sheng et al., 2025). Consequently, the policy being updated can assign substantially different probabilities to sampled tokens than the rollout policy that generated them.

Proximal Policy Optimization (PPO) and Group Relative Policy Optimization (GRPO) regulate policy updates through clipping in their token-level surrogate losses (Schulman et al., 2017; Shao et al., 2024; Guo et al., 2025). Clipping changes how individual tokens contribute to the loss, but does not keep every current-to-rollout probability ratio within a prescribed interval. It also does not decide whether an entire response should participate in the update. Sequence-level masking complements clipping by making this decision from a score that summarizes mismatch across the response. Trust Region Masking (TRM), for example, motivates such filtering through an analysis of how policy mismatch affects optimization over long autoregressive sequences (Li et al., 2026).

A simple response-level criterion is geometric-mean masking: it takes the geometric mean of the token probability ratios and retains responses when this aggregate is close to one. We refer to this baseline as GeoMean. In log space, this aggregation corresponds to averaging signed token log-ratios, as used in DeepSeek-V3.2's off-policy sequence mask (Liu et al., 2025a). The problem is that positive and negative log-ratios can cancel. For example, token ratios of 10 and 0.1 have a geometric mean of one, although each sampled-token probability has changed tenfold. More generally, a

Full-response bidirectional drift

Figure

Prefix-averaged log-ratio deviations

Figure

Real response tokens 6784-6886

Highlighted window: sGeoMean=1.0021s_{\text{GeoMean}} = 1.0021, sCARM=1.0692s_{\text{CARM}} = 1.0692

log⁡rt>0\log r_t > 0 log⁡rt<0\log r_t < 0

it'samathproblemcontext(likelyChineseGaokaoorsimilar
competitionstyle),"m/nformat"withintegersusuallyaccepts
negativenumerators.\n\n
Also,usually$m,n$arecoprimeand$n>θ$.\n\n\n\n
Let'scheckif$f(x)$couldbecomplex?No,logbase2
usuallyimpliesrealdomain.\n\n
Domain$0\lex<7$.$9-x$ispositive.\n\n
So$f(x)$isreal.

Figure 1: A real unfiltered rollout that GeoMean accepts and CARM rejects. This 8,619-token response has scores sGeoMean=1.0025≤1.005s_{\text{GeoMean}} = 1.0025 \leq 1.005 and sCARM=1.0248>1.02s_{\text{CARM}} = 1.0248 > 1.02. Top: positive and negative log-ratio mass and prefix deviations. Bottom: a 103-token window; red tokens have log⁡rt>0\log r_t > 0, green tokens have log⁡rt<0\log r_t < 0, and color intensity encodes magnitude.

response can appear well aligned under this score because its probability changes balance out, rather than because those changes are small.

We propose Cancellation-Aware Response Masking (CARM), a sequence-level mask that takes the absolute value of each token log-ratio before averaging. This prevents opposing probability changes from canceling while treating reciprocal changes symmetrically. Figure 1 illustrates the distinction on a real 8,619-token response: substantial positive and negative log-ratio contributions largely cancel under GeoMean, whereas CARM retains their magnitudes. CARM changes which responses contribute to optimization while retaining the token-level PPO/GRPO surrogate.

Beyond preventing cancellation, CARM gives the response-level threshold a direct token-level interpretation. We prove that every accepted response satisfies a joint bound on the fraction of sampled-token ratios outside a prescribed, possibly asymmetric band and their mean log-distance beyond its boundaries. Experiments on mathematical reasoning and code generation show improvements over token- and sequence-level baselines. Threshold analyses further show that similar filtering rates can yield different accuracies, while filtering more responses is not consistently better.

Our contributions are:

  • We formalize cancellation in signed-log sequence masking: the aggregate score can indicate perfect apparent alignment even when every sampled token ratio violates a prescribed band.

  • We propose CARM, a sequence-level mask that prevents cancellation by taking absolute values before averaging token log-ratios. We derive a joint bound on the frequency and severity of ratio-band violations in accepted responses, including asymmetric bands, giving the filtering threshold a token-level interpretation.

  • Experiments on mathematical reasoning and code generation show improvements over sequence- and token-level baselines. Paired-response diagnostics and threshold analyses

characterize the selection behavior: higher accuracy is observed at comparable average filtering rates, and accuracy is not monotone in the masked fraction.

References (37)