Similarity vs MMR
Diversity leads to better answers. Avoiding the echo chamber.
1. The Trap of Redundancy
User asks: "Tell me about the iPhone 15 camera."
Similarity Search (k=4) returns:
- iPhone 15 has a 48MP camera.
- The camera on iPhone 15 is 48MP.
- The iPhone 15 features a 48MP sensor.
- 48MP is the resolution of the iPhone 15.
The LLM gets 4 versions of the same sentence. It misses info about "Night Mode," "Zoom," or "Video." This is Redundancy Collapse.
2. Maximal Marginal Relevance (MMR)
MMR tries to maximize Relevance (Similarity) while punishing Redundancy (Similarity to already selected docs).
Algorithm intuition:
- Find the most similar doc (Doc A). Select it.
- Find the next doc that is similar to Query BUT dissimilar to Doc A.
- Repeat.
3. The Result
MMR (k=4) returns:
- iPhone 15 has a 48MP camera. (High Relevance)
- Night Mode is improved by 2x. (High Relevance, Low overlap with #1)
- Video supports 4K60. (High Relevance, Low overlap with #1, #2)
- The new Telephoto lens is 5x. (High Relevance, Low overlap with #1, #2, #3)
4. Summary
If your RAG answers feel repetitive or shallow, switch to MMR. It forces the retriever to explore the "Concept Space" rather than getting stuck in one corner.
Key Intuition: "Don't tell me the same thing 5 times."