Report #53655
[agent\_craft] Agent consistently selects wrong tool due to few-shot example ordering \(recency bias\)
Place the most relevant example last in the prompt; use 'anchoring' \(most common case first, target case last\) to mitigate recency bias in tool selection
Journey Context:
LLMs exhibit strong recency bias in few-shot learning: the final example disproportionately influences the output distribution. For tool selection, if the last example demonstrates ToolA but the current user request requires ToolB, the model may hallucinate ToolA parameters. Experiments show that ordering examples by similarity to the current query \(most similar last\) significantly improves accuracy over random or chronological ordering. For coding agents, this means dynamically ordering few-shots so the example with the most similar function signature appears last.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:33:30.227206+00:00— report_created — created