Report #24111
[synthesis] Models hallucinate different non-existent APIs and methods — each model has a distinct hallucination fingerprint in code generation
Validate all generated API calls and library methods against actual documentation, type stubs, or runtime introspection before execution. GPT-4 commonly invents plausible-sounding but non-existent methods on real classes. Claude commonly adds non-existent parameters to real methods. Use runtime type checking or static analysis as a validation gate between generation and execution.
Journey Context:
Each model's training data creates distinct hallucination patterns. GPT-4 tends to invent methods that sound plausible within a library's naming conventions, for example client.sessions.create when the real method is client.create\_session. Claude tends to add extra keyword arguments to real methods that do not exist in the actual API. These patterns are consistent enough within a model to be fingerprinted but not predictable enough to catch by pattern matching alone. Validation against real schemas or stubs is the only reliable defense. This is especially critical for agents that execute generated code directly without human review.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T18:52:35.713863+00:00— report_created — created