When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Ashik, Ahmed Nusayer, Wang, Shaowei, Chen, Tse-Hsun, Asaduzzaman, Muhammad, Tian, Yuan
Format: Preprint
Publié: 2026
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866913021752770560
author Ashik, Ahmed Nusayer
Wang, Shaowei
Chen, Tse-Hsun
Asaduzzaman, Muhammad
Tian, Yuan
author_facet Ashik, Ahmed Nusayer
Wang, Shaowei
Chen, Tse-Hsun
Asaduzzaman, Muhammad
Tian, Yuan
contents The rapid evolution of software libraries creates a significant challenge for Large Language Models (LLMs), whose static parametric knowledge often becomes stale post-training. While retrieval-augmented generation (RAG) is commonly used to provide up-to-date API specifications, "context-memory conflict" arises when external instructions contradict a model's internal parametric knowledge. This paper presents a systematic empirical study of LLM code generation under API evolution (e.g., API deprecation, API modification, and API addition), by constructing a benchmark of 270 real-world updates from eight Python libraries. We evaluate four LLM families of 11 models. Our results show that without comprehensive documentation, LLMs struggle to prioritize external context, averaging only 42.55% of generated code examples are executable in the target environment. While structured documentation and larger model scales improve LLMs' ability to update adoption, they do not fully resolve executability issues with a low 66.36% executable rate. In addition, reasoning-based strategies (e.g., Self-Reflection) significantly boost LLMs' performance with 11% improvement on executable rate. Our findings highlight the persistence of outdated patterns from LLMs, even when API update specifications are provided, and emphasize the need for evolution-aware benchmarks and techniques.
format Preprint
id arxiv_https___arxiv_org_abs_2604_09515
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation
Ashik, Ahmed Nusayer
Wang, Shaowei
Chen, Tse-Hsun
Asaduzzaman, Muhammad
Tian, Yuan
Software Engineering
The rapid evolution of software libraries creates a significant challenge for Large Language Models (LLMs), whose static parametric knowledge often becomes stale post-training. While retrieval-augmented generation (RAG) is commonly used to provide up-to-date API specifications, "context-memory conflict" arises when external instructions contradict a model's internal parametric knowledge. This paper presents a systematic empirical study of LLM code generation under API evolution (e.g., API deprecation, API modification, and API addition), by constructing a benchmark of 270 real-world updates from eight Python libraries. We evaluate four LLM families of 11 models. Our results show that without comprehensive documentation, LLMs struggle to prioritize external context, averaging only 42.55% of generated code examples are executable in the target environment. While structured documentation and larger model scales improve LLMs' ability to update adoption, they do not fully resolve executability issues with a low 66.36% executable rate. In addition, reasoning-based strategies (e.g., Self-Reflection) significantly boost LLMs' performance with 11% improvement on executable rate. Our findings highlight the persistence of outdated patterns from LLMs, even when API update specifications are provided, and emphasize the need for evolution-aware benchmarks and techniques.
title When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation
topic Software Engineering
url https://arxiv.org/abs/2604.09515