When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation
Ahmed Nusayer Ashik, Shaowei Wang, Tse-Hsun Chen, Muhammad Asaduzzaman, Yuan Tian

TL;DR
This paper systematically studies how evolving APIs impact LLM code generation, revealing that LLMs often struggle with outdated knowledge despite documentation and reasoning strategies, highlighting the need for better benchmarks.
Contribution
It introduces a benchmark of real-world API updates and evaluates LLMs' ability to adapt, revealing persistent outdated patterns and the limited effectiveness of current strategies.
Findings
LLMs only generate 42.55% executable code without comprehensive documentation.
Structured documentation and larger models improve performance but do not fully solve executability issues.
Reasoning strategies like Self-Reflection improve executable rate by 11%.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
