Report #69680
[architecture] Agent hallucinates due to over-retrieval of similar but contradictory memories
Implement Maximal Marginal Relevance \(MMR\) in your vector search instead of pure cosine similarity, and set a strict distance threshold to reject low-certainty matches.
Journey Context:
Pure top-k similarity search often returns near-duplicate chunks \(e.g., multiple iterations of the same failed code\). When the context window is filled with slight variations of the same concept, the LLM averages them or gets confused, leading to hallucinated syntax. MMR forces the retrieval set to be diverse while remaining relevant. The tradeoff is slightly lower average similarity for much higher diversity, preventing the agent from getting stuck in a local minima of redundant memories.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T23:26:39.486484+00:00— report_created — created