cs.CLMay 27, 2026

Beyond pass@k: Redundancy-Aware RLVR for Multi-Sample Code Generation

Authors: Le Bronnec FlorianAlexandre VerineRio YokotaBenjamin Negrevergne

Organizations: RIKEN Center for Computational Science, Tokyo, Japan · École Normale Supérieure Paris, PSL University, Paris, France · LAMSADE, CNRS, Université Paris-Dauphine-PSL, Paris, France

Abstract

LLMs for code generation are commonly evaluated in repeated-sampling settings using Pass@k, where multiple candidate programs are executed against unit tests under a finite sampling budget. While recent verifier-based reinforcement learning (RLVR) methods improve executable correctness, how these objectives affect redundancy among sampled programs remains poorly understood. In this work, we study implementation-level redundancy in code generation using JPlag, a plagiarism-detection system for code. Across models and benchmarks, we show that correctness-only RLVR often concentrates generations around repeated implementations, whereas Pass@k-aware objectives maintain lower redundancy and improve larger-budget performance. Motivated by these observations, we augment RLVR with direct anti-redundancy rewards based on JPlag similarity. Across 3 models and 3 benchmarks, discouraging near-duplicate generations reliably improves finite-budget executable performance, often matching or outperforming specialized Pass@k-aware objectives.

Explore similar work

May 28, 2026cs.SE

Improving Small Language Models for Code Generation with Reinforcement Learning from Verification Feedback

Reinforcement learning with verifiable rewards (RLVR) trains language models using programmatically checkable signals such as unit-test outcomes, enabling direct optimization for functional correctness in code generation. We conduct an empirical study of RLVR for Python code generation on the MBPP benchmark using two small models (Qwen3-0.6B and Llama3.2-1B) with LoRA fine-tuning. Across multiple reward formulations such as: unit-test-only rewards, static-analysis-only shaping via the Ruff linter, and a combined reward, we compare group-based policy optimization variants (GRPO and GSPO) and evaluate both functional correctness and behavioral diagnostics. In our experimental setting, RLVR improves pass@1 on MBPP test by up to 13 percentage points under proposed combined reward configuration. However, we find that reward shaping can induce systematic behavioral shifts: using only static-analysis penalties may bias the policy toward shorter completions that reduce lint errors without reliably improving functional correctness. In contrast, combined rewards mitigate this degeneration and yield more stable trade-offs between correctness and style constraints. Overall, our results highlight that RLVR effectiveness for code generation is highly sensitive to reward design and optimization granularity, and that diagnostics beyond pass@1, including generation length, Ruff severity profiles, and execution error types are useful for identifying failure modes.
Egor Skopin, Evgeny Kotelnikov
May 26, 2026cs.CL

Cast a Wider Net: Coordinated Pass@K Policy Optimization for Code Reasoning

Repeated sampling with a verifier is the standard way to allocate test-time compute for code generation, with pass@KK as the canonical metric. Yet the standard policy class draws KK independent samples from a single answer distribution, so attempts often collapse onto near-duplicate reasoning paths and waste the budget on redundant rollouts. This failure is costly in competitive programming, where many problems admit multiple distinct algorithmic strategies and pass@KK requires only one correct attempt. We propose Coordinated Pass@KK Policy Optimization (CPPO), which turns pass@KK generation into joint exploration over strategies: a planner emits a tuple of K=4K{=}4 alternative high-level methods, and a shared solver attempts one solution per method. CPPO trains this joint policy with a multiplicative planner reward, Rplan=JψRoutR_{\mathrm{plan}} = J_ψ\cdot R_{\mathrm{out}}, assigning credit only to valid strategy tuples that lead to verifier-confirmed pass@KK success. Across APPS, CodeContests, and LiveCodeBench-v6, CPPO improves pass@44 over direct sampling, planning baselines, planner-only SFT, and pass@KK-oriented RL under the same K=4K{=}4 solver-attempt budget, with statistically significant gains on six of nine model--benchmark cells. The largest single gain is +0.16+0.16 on Qwen3.5-9B LiveCodeBench-v6 over the strongest baseline, PKPO (0.5880.7480.588 \rightarrow 0.748; paired bootstrap, p<0.05p < 0.05).
Yilong Li, Suman Banerjee, Tong Che
May 1, 2026cs.LG

Exploring Pass-Rate Reward in Reinforcement Learning for Code Generation

Reinforcement learning (RL) from unit-test feedback has become a standard post-training recipe for improving large language models (LLMs) on code generation. However, the pass-all-tests binary reward can be sparse, yielding no learning signal on challenging problems where none of the sampled solutions passes all tests. A common remedy is to use the test-case pass rate as a surrogate reward. In this work, we study pass-rate rewards in critic-free RL for code generation (e.g., GRPO and RLOO) and report a consistent pattern across base models and algorithms: despite alleviating reward sparsity, pass-rate rewards do not reliably improve final performance over binary rewards in rigorous controlled experiments. To understand this discrepancy, we analyze reward density and the resulting gradient directions. We find that pass-rate rewards are denser, but the induced gradient updates do not consistently move probability mass toward full-pass solutions. This arises because test-case pass rate is a miscalibrated surrogate for progress toward full correctness, and partial-pass solutions within the same group can induce conflicting gradient directions that cancel out. Overall, our results suggest that, in critic-free RL, pass-rate rewards are insufficient to improve code generation and motivate reward designs that better align optimization with the goal of full correctness.
Xin-Ye Li, Ren-Biao Liu, Yun-Ji Zhang +3