Report #51956
[research] API Fabrication: Generating code that uses non-existent libraries, deprecated methods, or fabricated API endpoints
Constrain generation using a grammar or schema \(e.g., JSON schema, OpenAPI spec\) and validate the generated code against static analysis or an interpreter before presenting it to the user.
Journey Context:
LLMs predict the next token based on patterns; they will invent plausible-looking API calls if they don't know the exact signature. Constrained decoding forces the model to only output valid syntax, while execution-based evals catch logical/API hallucinations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T17:42:09.146215+00:00— report_created — created