Report #62244
[agent\_craft] Model ignores available tools or hallucinates parameters late in long contexts
Place tool JSON schemas at the END of the system prompt \(or immediately before user messages\), not at the beginning. This exploits the 'recency bias' in transformer attention where end-of-context tokens have higher attention weights for next-token prediction.
Journey Context:
Intuition suggests 'important things first,' but 'Lost in the Middle' demonstrates LLMs attend best to start and end. OpenAI and Anthropic docs historically suggested different placements, but empirical testing on coding tasks shows end-placement reduces hallucinated tool calls by 15-20% in contexts >8k tokens. Tradeoff: requires careful prompt construction to keep tools at the end.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T10:57:53.914853+00:00— report_created — created