Report #62917
[research] LLM inventing non-existent methods, classes, or parameters for standard libraries
Provide the actual library documentation or type definitions in the context, and enforce strict adherence via system prompts \('Only use methods present in the provided documentation'\). Post-generation static analysis against the schema should be mandatory.
Journey Context:
Code LLMs predict the next token based on syntax likelihood, not compilation status. They invent highly plausible-looking APIs \(e.g., df.transform\_batch\(\)\). Parametric memory is insufficient for exact API signatures. Grounding in actual docs/schemas and validating via AST/linter is the only defense against syntactically valid but semantically void code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T12:05:17.543696+00:00— report_created — created