ReCode: Updating Code API Knowledge with Reinforcement Learning
On the map: Deep reinforcement learning methods → RL training of language and agent models
Abstract (arXiv)
Large Language Models (LLMs) exhibit remarkable code generation capabilities but falter when adapting to frequent updates in external library APIs. This critical limitation, stemming from reliance on outdated API knowledge from their training data, even with access to current documentation, impedes reliable code generation in dynamic environments. To tackle this issue, we propose ReCode (rule-based Reinforcement learning for Code Update), a novel framework that mimics human programmer adaptation to API changes. Specifically, we construct a dataset of approximately 2,000 data entries to train the LLMs to perform version migration based on updated information. Then, we introduce a modified string similarity metric for code evaluation as the reward for reinforcement learning. Our experiments demonstrate that ReCode substantially boosts LLMs' code generation performance in dynamic API scenarios, especially on the unseen CodeUpdateArena task. Crucially, compared to supervised fine-tuning, ReCode has less impact on LLMs' general code generation abilities. We apply ReCode on various LLMs and reinforcement learning algorithms (GRPO and DAPO), all achieving consistent improvements. Notably, after training, Qwen2.5-Coder-7B outperforms that of the 32B parameter code instruction-tuned model and the reasoning model with the same architecture. Code is available at https://github.com/zjunlp/ReCode.
Key facts. Cited by 12 papers in the map (data through 14 Oct 2026). Placed in RL training of language and agent models, one of 15 directions in Deep reinforcement learning methods. Builds on 48 of its 69 references that are in the map. First posted on arXiv 25 Jun 2025.
Builds on
48 of 69 references.
Closest ancestors · 2
Same direction, newest first
- 2025SimpleRL-Zoo: Investigating and Taming Zero Reinforcement Learning for Open Base Models in the Wild24 Mar
- 2025SFT Memorizes, RL Generalizes: A Comparative Study of Foundation Model Post-training28 Jan
Other references · 46
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2017Proximal Policy Optimization Algorithmscited by 15,215
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,330
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,371
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2025DAPO: An Open-Source LLM Reinforcement Learning System at Scalecited by 2,810
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
34 more
- 2025Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learningcited by 1,444
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,391
- 2025Kimi k1.5: Scaling Reinforcement Learning with LLMscited by 1,210
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2024The AI Scientist: Towards Fully Automated Open-Ended Scientific Discoverycited by 1,071
- 2025Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model?cited by 982
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2023An Empirical Study of Catastrophic Forgetting in Large Language Models During Continual Fine-tuningcited by 639
- 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
- 2025Video-R1: Reinforcing Video Reasoning in MLLMscited by 484
- 2022DS-1000: A Natural and Reliable Benchmark for Data Science Code Generationcited by 452
- 2023Editing Large Language Models: Problems, Methods, and Opportunitiescited by 372
- 2025ToolRL: Reward is All Tool Learning Needscited by 362
- 2021Entity-Based Knowledge Conflicts in Question Answeringcited by 356
- 2024LoRA Learns Less and Forgets Lesscited by 328
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 300
- 2024Knowledge Conflicts for LLMs: A Surveycited by 283
- 2024Data Interpreter: An LLM Agent For Data Sciencecited by 225
- 2024CodeGemma: Open Code Models Based on Gemmacited by 150
- 2022Large Language Models Meet NL2Code: A Surveycited by 138
- 2024MathBench: Evaluating the Theory and Application Proficiency of LLMs with a Hierarchical Mathematics Benchmarkcited by 105
- 2025SimpleAR: Pushing the Frontier of Autoregressive Visual Generation through Pretraining, SFT, and RLcited by 86
- 2025SQL-R1: Training Natural Language to SQL Reasoning Model By Reinforcement Learningcited by 68
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2023A Survey on Large Language Models for Software Engineeringcited by 59
- 2025SynLogic: Synthesizing Verifiable Reasoning Data at Scale for Learning Logical Reasoning and Beyondcited by 50
- 2025MT-R1-Zero: Advancing LLM-based Machine Translation via R1-Zero-like Reinforcement Learningcited by 48
- 2024LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-based Code Completioncited by 32
- 2024U-MATH: A University-Level Benchmark for Evaluating Mathematical Skills in LLMscited by 24
- 2024CodeUpdateArena: Benchmarking Knowledge Editing on API Updatescited by 19
- 2024VersiCode: Towards Version-controllable Code Generationcited by 17
- 2024A Comprehensive Survey of Reinforcement Learning: From Algorithms to Practical Challengescited by 13
- 2024GitChameleon: Unmasking the Version-Switching Capabilities of Code Generation Modelscited by 6
Built on by
Citing papers per year: 2025: 4; 2026: 8.
12 papers.
- 2025CodeRL+: Improving Code Generation via Reinforcement with Execution Semantics Alignmentcited by 24
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
- 2026Environment-Aware Code Generation: How far are We?cited by 4
- 2025MENTOR: Reinforcement Learning via Flexible Teacher-Optimized Rewards for Tool-Use Distillationcited by 2
- 2026Beyond Outcome Rewards: Step-Level Self-Distilled Policy Optimization for Deep Search Agentscited by 2
- 2026KCoEvo: A Knowledge Graph Augmented Framework for Evolutionary Code Generationcited by 1
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2026Towards Knowledge Alignment in Code LLMs: Contrastive Unlearning for Evolving APIscited by 1
- 2025MoL-RL: Distilling Multi-Step Environmental Feedback into LLMs for Feedback-Independent Reasoningcited by 0
- 2026DHRCL:Training Code LLMs with Dense Hierarchical Rewards and Curriculum Learningcited by 0
- 2026DynaContext: Self-Improving Dynamic Contextualization of Optimized Prompts for Heterogeneous Parameter Extractioncited by 0
- 2026Synthetic Worlds for Temporal Evaluation and Knowledge Updating in LLMscited by 0
- 2026Synthetic Worlds for Temporal Evaluation and Knowledge Updating in LLMs31 Aug 2026
- 2026DynaContext: Self-Improving Dynamic Contextualization of Optimized Prompts for Heterogeneous Parameter Extraction22 Aug 2026
- 2026Beyond Outcome Rewards: Step-Level Self-Distilled Policy Optimization for Deep Search Agents13 Aug 2026
- 2026DHRCL:Training Code LLMs with Dense Hierarchical Rewards and Curriculum Learning29 Jul 2026
- 2026Towards Knowledge Alignment in Code LLMs: Contrastive Unlearning for Evolving APIs29 Jun 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026KCoEvo: A Knowledge Graph Augmented Framework for Evolutionary Code Generation8 Mar 2026
- 2026Environment-Aware Code Generation: How far are We?18 Jan 2026
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025CodeRL+: Improving Code Generation via Reinforcement with Execution Semantics Alignment21 Oct 2025
- 2025MENTOR: Reinforcement Learning via Flexible Teacher-Optimized Rewards for Tool-Use Distillation21 Oct 2025
- 2025MoL-RL: Distilling Multi-Step Environmental Feedback into LLMs for Feedback-Independent Reasoning27 Jul 2025
Similar, not cited
Close in wording, no citation either way
- 2025CODESYNC: Synchronizing Large Language Models with Dynamic Code Evolution at Scale
- 2025APRIL: API Synthesis with Automatic Prompt Optimization and Reinforcement Learning
- 2026When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation
- 2024Enhancing Code LLMs with Reinforcement Learning in Code Generation: A Survey
- 2025Towards Better Correctness and Efficiency in Code Generation
- 2026Code2LoRA: Hypernetwork-Generated Adapters for Code Language Models under Software Evolution
- 2024RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning
- 2025Afterburner: Reinforcement Learning Facilitates Self-Improving Code Efficiency Optimization