NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

CodeSync: Synchronizing Large Language Models with Dynamic Code Evolution at Scale

Chenlong Wang, Zhaoyang Chu, Zhengxiang Cheng, Xuyi Yang, Kaiyue Qiu, Yao Wan, Zhou Zhao, Xuanhua Shi, Hai Jin, Dongping Chen

Introduction

Large Language Models (LLMs) have become indispensable tools for modern software development. However, their utility is fundamentally constrained by the "knowledge cutoff" problem. Because these models are trained on static snapshots of the internet, they lack awareness of the continuous evolution of third-party libraries. When popular frameworks like pandas, torch, or numpy introduce breaking changes—such as deprecating parameters or altering function signatures—LLMs continue to suggest legacy code. This results in "non-executable" code and runtime errors, forcing developers to manually debug AI-generated suggestions.

To address this, we introduce CODESYNC, a specialized data engine and benchmark designed to systematically synchronize LLMs with the latest API changes in the software ecosystem.

The CODESYNC Data Engine

The core of the CODESYNC framework is a three-step pipeline designed to identify, retrieve, and synthesize code updates at scale.

  1. Real-Time API Update Tracking: The engine utilizes Python’s inspect module to perform a differential analysis between legacy and current versions of major libraries. By comparing function signatures and metadata, it pinpoints exactly which APIs have undergone modifications.
  2. Real-World API Invocation Retrieval: Once a change is identified, the engine queries GitHub Code Search to find historical, real-world examples of how developers utilized the old version of the API. This ensures the training data reflects actual usage patterns rather than synthetic boilerplate.
  3. Legacy-Updated API Invocation Synthesis: Using a high-capacity teacher model (DeepSeek-V3), the engine transforms these "old" code snippets into "new" versions that comply with the updated API. This process creates a contrastive dataset that explicitly demonstrates the transition from legacy to modern syntax.

Benchmarking Code Evolution: CODESYNCBENCH

To evaluate the effectiveness of knowledge synchronization, the authors developed CODESYNCBENCH. This benchmark covers 220 updated APIs across six foundational Python libraries: pandas, numpy, scipy, tensorflow, torch, and flask. It comprises 3,300 test cases across three distinct tasks:

  • Code Completion (CCT): Generating the correct API call given a context.
  • Error Correction (ECT): Fixing code that uses a deprecated or altered API.
  • Multiple Choice Questions (MCQ): Identifying the correct signature or behavior of an updated API.

Key Insights and Experimental Findings

The study revealed several critical insights into how LLMs process and internalize evolving code knowledge:

The Method Difficulty Gap

A notable finding is that LLMs struggle significantly more with updating knowledge of Method APIs (functions tied to class instances) compared to standalone functions or class initializers. This difficulty stems from the complex object references and class hierarchies inherent in methods, which are harder for models to track through simple text-based updates.

The Efficiency of Few-Shot Tuning

The researchers identified a "sweet spot" for knowledge injection: providing approximately 10 invocation samples per API is sufficient for a model to internalize a change. Beyond this threshold, the returns diminish rapidly, suggesting that LLMs are highly efficient at learning new rules when provided with clear, contrastive examples.

The Limitations of RAG and SOTA Models

Even state-of-the-art models like GPT-4o and Claude 3.5 Sonnet performed poorly on CODESYNCBENCH out-of-the-box, often scoring below 20% on code completion for recent updates. Furthermore, while Retrieval-Augmented Generation (RAG) is often proposed as a solution for the knowledge cutoff, it achieved a "hit rate" of only ~60% in this context. RAG often fails when APIs have similar names or when the retrieved context is ambiguous, highlighting the need for fine-tuning the model's internal weights.

Results and Performance

The researchers evaluated 14 LLMs using various preference optimization techniques, including SFT, DPO, ORPO, and SimPO.

  • Performance Gains: Applying SimPO or DPO led to substantial improvements. For instance, the Qwen2.5-7B model saw its Code Completion BLEU score rise from 8% to 25% after tuning.
  • Preserving General Utility: A common concern in model editing is "catastrophic forgetting." However, evaluations on HumanEval showed that CODESYNC updates are stable; most models retained over 90% of their original general coding utility.
  • Optimization Efficiency: SimPO emerged as the most effective training method, providing the best balance between training efficiency and the accuracy of the updated code.

Conclusion

CODESYNC demonstrates that the "knowledge cutoff" is not an insurmountable barrier for AI coding assistants. By combining automated API tracking with contrastive instruction tuning, it is possible to keep LLMs synchronized with the fast-moving world of software development. Future work will focus on expanding this framework to other programming languages and developing continual learning systems that can update model knowledge incrementally without the need for full fine-tuning cycles.

Summary updated

BibTeX
@inproceedings{wang2025codesync,
  author = {Chenlong Wang and Zhaoyang Chu and Zhengxiang Cheng and Xuyi Yang and Kaiyue Qiu and Yao Wan and Zhou Zhao and Xuanhua Shi and Hai Jin and Dongping Chen},
  title = {{CodeSync: Synchronizing Large Language Models with Dynamic Code Evolution at Scale}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=8NN0ZEBuQk},
}
Figure