Noisy Test-Time Reinforcement Learning for Code LLMs
Organizations: The Chinese University of Hong Kong · Huazhong University of Science and Technology
Abstract
Large language models (LLMs) have demonstrated remarkable performance across various code-related tasks. However, unlike carefully curated datasets that are typically high-quality and error-free, real-world user instructions are often vague and error-prone, posing significant challenges to the robustness of code LLMs. Furthermore, robustness-oriented fine-tuning relies on paired clean-noisy samples, which are costly to curate and require sophisticated noisy simulation techniques. To address these challenges, we propose the Noisy Test-time Reinforcement Learning framework (NTRL-Code), which enables robust self-evolution of code LLMs using only unlabeled noisy data during the testing stage. Specifically, NTRL-Code uses conservative self-denoising to obtain a cleaner semantic anchor for target estimation, and employs an abstract-syntax-tree (AST)-based structural aggregation mechanism to estimate a proxy target from multiple candidate programs. The policy is then optimized on the original noisy prompts with a hybrid reward that combines format validity, code similarity, and anti-repetition signals. Extensive experiments on three benchmarks, each incorporating character-level, word-level, and paragraph-level perturbations, demonstrate that NTRL-Code yields robust and consistent improvements, stabilizing the predictions of various base models. Our code is available at https://github.com/Xikai97/NTRL-Code.
Figures & tables
| Base Model | Methods | HumanEval | LeetCode Bench | MBPP | ||||||
| Char-Perb | Word-Perb | Para-Perb | Char-Perb | Word-Perb | Para-Perb | Char-Perb | Word-Perb | Para-Perb | ||
| DeepSeek-Coder-1.3B | Original | 53.0 | 54.3 | 56.1 | 3.3 | 5.0 | 5.0 | 44.6 | 43.8 | 46.6 |
| Few-shot | ||||||||||
| Big-Denoise | ||||||||||
| Iter-SD | ||||||||||
| NTRL-Code | ||||||||||
| Methods | HumanEval | ||
| Char-Perb | Word-Perb | Para-Perb | |
| Original | 53.0 | 54.3 | 56.1 |
| NTRL-Code w/o SD | |||
| NTRL-Code w/ SD | |||
| Methods | LeetCode Bench | ||
| Char-Perb | Word-Perb | Para-Perb | |
| Format | Rep | Sim | Char-Perb | Word-Perb | Para-Perb | |
| ① | ✓ | |||||
| ② | ✓ | |||||
| ③ | ✓ | |||||
| ④ | ✓ | ✓ | ||||
| ⑤ | ✓ | ✓ | ||||
| ⑥ | ✓ | ✓ |
| Perturbation Type | Original | NTRL-Code |
| Word+Para | 48.1 | |
| Char+Para | 51.2 | |
| Char+Word | 47.5 | |
| Char+Word+Para | 47.0 |
| Cross-Dataset (HumanEval LeetCode) | ||
| Perturbation Type | Original | NTRL-Code |
| Char-Perb | 3.3 | |
| Word-Perb | 5.0 | |
| Para-Perb | 5.0 | |
| Cross-Perturbation (HumanEval) | ||
| Para Char | 53.0 | |
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
| Models | HumanEval | LeetCode Bench | MBPP | |||||||||
| Ori | Char-Perb | Word-Perb | Para-Perb | Ori | Char-Perb | Word-Perb | Para-Perb | Ori | Char-Perb | Word-Perb | Para-Perb | |
| DS-Coder-1.3B | 64.0 | 5.6 | 47.4 | |||||||||
| DS-Coder-6.7B | 81.7 | 19.4 | 64.0 | |||||||||
| Qwen2.5-coder-32B | 91.5 | 75.0 | 81.2 | |||||||||
| Qwen3-coder-30B | 94.5 | 65.6 | 78.2 | |||||||||
| Qwen3-Next-80B | 92.7 | 60.6 | 82.6 | |||||||||
| Model | Clean | Char | Word | Para |
| GPT-4o | 91.5 | |||
| GPT-5 | 97.6 | |||
| GPT-5-Codex | 97.6 | |||
| Claude-Opus-4.5 | 98.2 |
| Benchmark | Noise | Char-edit Ratio | Word-change Fraction | Semantic Cos. Mean / Min |
| HumanEval | Char | 0.132 | 0.353 | 0.930 / 0.817 |
| Word | 0.175 | 0.373 | 0.960 / 0.880 | |
| Para | 0.425 | 0.454 | 0.953 / 0.829 | |
| LeetCode | Char | 0.062 | 0.281 | 0.912 / 0.831 |
| Word | 0.119 | 0.303 | 0.929 / 0.778 | |
| Para | 0.366 | 0.456 | 0.944 / 0.869 |
| HumanEval | LeetCode Bench | MBPP | |
| Original | 64.0 | 5.6 | 47.4 |
| NTRL-Code |
| 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | |
| Pass@1 (%) | 54.3 | 55.5 | 55.5 | 51.8 | 51.8 |
| Revert rate (%) | 76.8 | 74.4 | 73.8 | 70.1 | 67.7 |
| 0.80 | 0.85 | 0.90 | 0.92 | 0.95 | |
| Pass@1 (%) | 54.9 | 54.9 | 55.2 | 55.5 | 55.5 |
| Setting | Character Pass@1 | |
| default | (0.50, 0.25) | 55.5 |
| equal weights | (0.34, 0.33) | 51.8 |
| similarity-heavy | (0.70, 0.15) | 52.4 |
| similarity-only | (1.00, 0.00) | 50.6 |
| Levenshtein Weight | 0.4 | 0.5 | 0.8 |
| pass@1 under Char-Perb | 54.9 | 54.3 |
| Step/Window Ratio (Eq. 6) | 0.25 | 0.5 | 1.0 |
| pass@1 under Char-Perb | 54.3 | 54.3 |
| HumanEval, Word-Perb | Pass@1 |
| Original (base 6.7B) | 64.0 |
| NTRL-Code w/o SD | 66.5 |
| NTRL-Code w/ SD | 67.1 |
| Condition | Proxy Pass Rate | Candidate Pass Rate | Reward– Correctness Corr. | Consensus– Correctness Corr. |
| clean | 65.2% | 55.1% | 0.37 | 0.37 |
| character | 54.3% | 44.9% | 0.38 | 0.36 |
| word | 56.7% | 44.2% | 0.41 | 0.31 |
| paragraph | 62.8% | 55.8% | 0.41 | 0.41 |
| Metric (mean, 0–5 unless %) | Base | NTRL-Code | |
| intent-correctness | 2.30 | 2.67 | |
| noise-handling | 1.49 | 1.61 | |
| robustness | 3.91 | 4.21 | |
| overall pass rate (%) | 10.5% (6/57) | 14.0% (8/57) |
| Language | Condition | Base Pass@1 | NTRL-Code Pass@1 | |
| C++ | clean | 44.7 | 46.6 | +1.9 |
| char-perb | 40.4 | 46.0 | +5.6 | |
| JavaScript | clean | 55.9 | 60.9 | +5.0 |
| char-perb | 52.8 | 54.0 | +1.2 |
Language Model Robustness
Language model robustness studies how reliably language models preserve correct, safe behavior under input changes, distribution shifts, and adversarial pressure.
See all 493 papers