TL;DR
Large language models (LLMs) are trained on a soup of code from every era of a library's history, leaving them largely "version-oblivious." When asked to write code for a specific library version, they frequently commit anachronistic errors—calling functions or parameters that only exist in a different release. LibEvoBench is a new benchmark that systematically probes this blind spot across 29 versions of PyTorch, NumPy, and SciPy, revealing that even frontier models struggle with evolving APIs—and that simply telling a model which version you are using doesn't fix it.
What Problem Does This Paper Address?
In production software engineering, upgrading dependencies is slow and expensive. A real-world codebase might pin PyTorch to an older release while newer versions introduce fresh entry points, tweak function signatures, and deprecate old symbols. For an AI coding assistant, the "right" code isn't just what works in PyTorch in general—it's what works in the exact version specified in the project's manifest.
Standard LLM training, however, compresses code and documentation from all library versions into a single set of weights. There is no built-in mechanism to separate knowledge by time. While prior benchmarks have looked at version-specific code generation, they were either small and manually curated, or relied on coarse string-matching that couldn't tell whether a model was making up a fake function or confusing two real versions.
Methods
To isolate version-specific knowledge, the authors built an automated pipeline that cross-references two views of a library's public API: official Sphinx documentation inventories and direct runtime introspection (installing each version and walking its module tree). This produces compatibility matrices that track every public API and its signature across versions, splitting them into stable APIs (unchanged) and evolving APIs (added, modified, or deprecated).
Using these matrices, LibEvoBench evaluates models across three complementary tasks:
- API Calling (API-C): Completing a missing API call in real GitHub code. It uses four "noise reduction" prompt levels: raw code only (
L0), code + redacted docstring (L1), code + docstring + explicit version constraint (L2), and API name + version to test parameter prediction (L3). - API Identification (API-I): Naming the right API given a module path and a redacted description.
- Signature Recall (SR): Reproducing a function's full signature (argument names, defaults, ordering) from memory for a given version.
The authors also introduce a deterministic Hallucination Taxonomy that classifies every error via matrix lookup: Unknown (never existed), Invalid (exists at the target version, but wrong), and Anachronistic (exists in a different version). Finally, they propose the Software Evolution Understanding Score (SEUS), which combines a model's harmonic mean on stable and evolving APIs while penalizing version-to-version inconsistency and anachronistic errors.
Datasets
LibEvoBench spans 29 versions of three widely used Python libraries: PyTorch (10 versions), NumPy (10 versions), and SciPy (9 versions). Together, the benchmark comprises over 125,000 evaluation instances covering more than 16,000 APIs—making it the largest version-indexed evaluation of Python library APIs to date.
Key Insights and Ideas
- Models are version-oblivious, even when warned: Adding a redacted docstring to the prompt (
L0→L1) boosts API-calling accuracy by 10–20 points. Adding an explicit version constraint (L1→L2, e.g.,# requires: torch==2.0) yields no measurable improvement. The version tag triggers an attempt to adjust, but the model lacks the underlying version-specific knowledge to back it up. - Scale doesn't fix the temporal decay: Within the Qwen3.5 family (35B, 122B, and 397B parameters), larger models score higher overall, but their accuracy on evolving APIs still degrades in near-parallel steps toward newer releases. The bottleneck is structural, not a matter of model size.
- Confusion, not fabrication: At the API-selection level, models rarely invent completely fake symbols; instead, they fall back on high-frequency symbols that are valid across most versions. At the parameter level, however, anachronistic errors are rampant—models routinely output deprecated or future arguments.
Key Results
The authors evaluated 13 models across four families (OpenAI GPT, Google Gemini, Anthropic Claude, and Qwen3.5) at zero temperature and no thinking budget:
- The Evolving API Gap: While performance on stable APIs stays flat across versions, accuracy on evolving APIs drops for newer releases. Even top models like GPT-5.5 and Claude Sonnet 4.6 lose 5–10 points on evolving APIs compared to stable ones.
- SEUS Leaderboard: GPT-5.4 leads with a SEUS of 86.0 (Stable: 92.0, Evolving: 86.4), edging out GPT-5.5 (85.1), which has a slightly higher stable score (92.3) but suffers from greater version-to-version inconsistency. Sonnet 4.6 ranks third (81.0), followed by Gemini 3 Flash (77.3) and Qwen3.5 397B (67.9).
Limitations and Future Work
- Zero thinking budget: Models were evaluated without extended reasoning to mimic fast, implicit API selection. When the authors re-ran PyTorch evaluations with extended reasoning on GPT-5.1, Gemini 3 Flash, and Sonnet 4.6, absolute scores rose, but the gap between stable and evolving APIs still widened at the same rate.
- Potential contamination: Because API-C samples come from public GitHub repositories, they may overlap with training data—though the systematic version-correlated degradation and consistent patterns on matrix-derived tasks suggest memorization isn't driving the results.
- Future directions: Evaluating end-to-end agentic harnesses (with retrieval and test execution) and extending the benchmark to cross-implementation variations, such as SQL dialects.
Summary updated