Report #56470
[synthesis] Tool schema hallucination under token pressure causes structurally invalid but syntactically plausible calls
Implement strict schema validation on the client side before executing tool calls. When token pressure is detected \(high context utilization\), switch to 'conservative mode' that uses smaller, verified tool subsets rather than complex nested schemas. Validate against JSON Schema before execution, not after.
Journey Context:
As context windows fill, language models experience pressure to generate shorter outputs. The synthesis reveals that when calling tools with complex nested schemas \(objects within objects\), models under pressure will hallucinate simplified schemas—flattening nested structures, omitting required fields, or converting objects to strings—to 'fit' better. These calls often pass basic type checks \(they're still JSON\) but fail schema validation. The dangerous part: if the tool execution layer is permissive \(e.g., JavaScript treating missing fields as undefined\), the call succeeds but behaves unexpectedly. Common mistake: relying on the model to 'know' the schema from the system prompt without enforcing it programmatically. The fix requires using libraries like Zod, JSON Schema validators, or Pydantic to validate calls before execution, and dynamically simplifying available tools when context pressure exceeds thresholds \(e.g., >80% context used\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:16:37.067375+00:00— report_created — created