passdrill
AI & LLM Engineering · RAG & Embeddings · Card 014/022 easy

A retrieval system's top 5 results by similarity alone turn out to be five near-duplicate passages that all restate the same single fact, because the corpus happens to contain many redundant copies of that fact and none of the closest embeddings differ much from each other. A technique called Maximal Marginal Relevance (MMR) re-ranks the candidate pool to fix exactly this problem. How does it work?

  1. It picks each next result by rewarding closeness to the query but penalizing closeness to results already picked, so that once a fact has been represented once, near-duplicate passages restating it score lower and passages covering different information get a chance to be selected instead
  2. It removes any passage whose embedding is closer to another passage's embedding than a fixed distance threshold, deleting near-duplicates from the corpus entirely before any query is ever run
  3. It retrains the embedding model so that semantically similar passages are pushed further apart in vector space, permanently reducing how many near-duplicate passages the corpus can contain
  4. It runs the query once against each half of the corpus separately and interleaves the two result lists so that whichever half a passage was drawn from, at least some diversity across halves is guaranteed
Next card → Shuffle