Report #81845
[research] LLM invents non-existent methods, classes, or parameters for real software libraries or APIs
Inject up-to-date API documentation or type signatures directly into the prompt context, and strictly forbid the model from generating library calls not present in the provided schema.
Journey Context:
Code LLMs excel at syntax but hallucinate package APIs because they blend patterns across different libraries or infer plausible but non-existent methods. The model's prior on fluent code overrides the specific constraints of the target library version. Relying on the model's parametric memory for APIs guarantees eventual obsolescence and hallucination. Grounding with live docs or static schemas is mandatory for reliable code generation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T19:58:17.065690+00:00— report_created — created