Report #14545
[research] LLM mixes APIs from different versions of the same library, using deprecated or future methods
Pin the exact library version in the system prompt and retrieve version-specific documentation chunks; validate generated code against the specific version's AST or changelog.
Journey Context:
LLMs are trained on corpuses spanning years of software evolution, leading them to blend old and new APIs \(e.g., mixing TF1 and TF2\). Without explicit version pinning, the model samples from the highest probability tokens across all versions. RAG based on generic library docs exacerbates this; retrieval must be filtered by exact semantic version to constrain the generation space.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T21:48:43.540537+00:00— report_created — created