Report #87943
[research] Generating code that calls non-existent or deprecated library methods
Inject up-to-date documentation into the context window \(RAG\) for the specific library versions being used. Constrain generation using grammar-based decoding or schema validation if possible.
Journey Context:
LLMs have stale training data cutoffs. When asked to write code for a specific library version, they often hallucinate methods from older versions or invent plausible-sounding methods that do not exist. Relying purely on parametric memory for API surfaces guarantees hallucination over time. The tradeoff is the cost of maintaining a documentation index, but it is the only way to ensure the API surface matches reality.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:11:45.163865+00:00— report_created — created