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

RustEvo2: An Evolving Benchmark for API Evolution in LLM-based Rust Code Generation

Linxi Liang, Jing Gong, Mingwei Liu, Chong Wang, Guangsheng Ou, Yanlin Wang, Xin Peng, Zibin ZhengarXiv 2025 · DOI

Abstract

Large Language Models (LLMs) are increasingly used for code generation, yet their performance is often tethered to a static "knowledge cutoff." In fast-evolving languages like Rust, this leads to a significant gap between model output and modern, safe API usage. This paper introduces RustEvo², a dynamic benchmark designed to evaluate version-awareness in LLMs. Our study reveals that even top-tier models like Claude-3.7-Sonnet experience a performance drop of nearly 24% for APIs released post-training, frequently defaulting to deprecated or unsafe patterns.

Introduction: The "Fast-Mover" Challenge

In the world of software engineering, Rust is a "fast-mover," releasing new versions approximately every six weeks. This rapid pace creates a unique challenge for LLMs, which are essentially frozen in time at their "knowledge cutoff" date. Existing benchmarks for code generation are typically static; they test a model's ability to write code based on a snapshot of a language at a specific moment. However, as APIs evolve—through stabilizations, signature changes, or subtle behavioral shifts—models often generate "hallucinated" or deprecated code.

Timeline of Rust version releases vs. LLM training cutoffs, highlighting the knowledge gap.

For example, a model might still use a complex unsafe pointer casting block to solve a problem that a newly stabilized, safe standard library method now handles in a single line. This paper seeks to quantify this "version-awareness" and provide a framework for benchmarks that evolve alongside the language.

The EvoEval Framework

The authors introduce EvoEval, a two-phase framework for building dynamic benchmarks:

  1. API Evolution Data Collection: The system automatically identifies changes by scraping official Rust changelogs and documentation. Changes are categorized into four types: Stabilizations, Signature Changes, Behavioral Changes, and Deprecations.
  2. Task Construction: An LLM-based pipeline (DeepSeek-v3) synthesizes programming tasks that implicitly require the new API. For instance, a task might describe a memory management problem where the most efficient solution is the target evolving API.
Example of a RustEvo² task where an LLM without API evolution knowledge uses unsafe code, while one with knowledge uses the modern safe API.

To ensure rigor, every generated task includes a reference solution and executable test cases. A "judge" model reviews tasks to ensure they don't explicitly name the target API in the prompt, which would make the test trivial.

The RustEvo² Dataset

The primary contribution is the RustEvo² dataset, which spans Rust versions 1.71.0 to 1.84.0 and includes:

  • 588 API changes: 380 from the Rust standard library and 208 from 15 popular third-party crates (e.g., bitflags).
  • 2,574 test cases: Used to verify the functional correctness of the generated code.
  • Control Dataset: 50 "stable" (non-evolving) APIs for baseline comparison.

Key Insights and Results

The researchers evaluated 10 state-of-the-art models, including the GPT-4, Claude, Llama, and DeepSeek families. Key findings include:

  • The Cutoff Cliff: Models scored an average of 56.1% on tasks involving APIs released before their cutoff, but only 32.5% on those released after.
  • Behavioral Changes are Hardest: Models struggle most with "Behavioral Changes"—where an API's name stays the same but logic changes—with success rates of only 38.0%.
  • Persistence of Legacy Idioms: LLMs exhibit a strong bias toward "historical" coding patterns. Even when a model's cutoff is after an API improvement, it often defaults to older, more verbose, or less safe code.
  • RAG as a Bridge: Retrieval-Augmented Generation (RAG) significantly helps, bridging approximately 60% of the gap between "no info" and "perfect info" scenarios.

Claude-3.7-Sonnet emerged as the top performer with a 65.3% Pass@1 rate, though it still showed a significant performance drop when moving from stable to evolving APIs.

Limitations and Future Work

While RustEvo² provides a critical lens into model evolution, it has limitations. The use of an LLM-in-the-loop for task generation may introduce bias. Furthermore, the evaluation focuses on functional correctness rather than "idiomaticity." Future directions include expanding the framework to other ecosystems like JavaScript/NPM and exploring more sophisticated RAG strategies.

Summary updated

BibTeX
@misc{liang2025rustevo,
  author = {Linxi Liang and Jing Gong and Mingwei Liu and Chong Wang and Guangsheng Ou and Yanlin Wang and Xin Peng and Zibin Zheng},
  title = {{RustEvo2: An Evolving Benchmark for API Evolution in LLM-based Rust Code Generation}},
  year = {2025},
  eprint = {2503.16922},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.16922},
}
Figure