Bird
0
0

You want to build a search feature that returns 5 documents: the top 3 most relevant and 2 that add new information. How can you configure MMR retrieval to achieve this?

hard📝 Application Q8 of 15
LangChain - Embeddings and Vector Stores
You want to build a search feature that returns 5 documents: the top 3 most relevant and 2 that add new information. How can you configure MMR retrieval to achieve this?
AUse Similarity Search with k=5 and filter duplicates manually
BSet top_k=5 and lambda_param around 0.6 to balance relevance and diversity
CSet top_k=3 and lambda_param=1.0 to get only relevant documents
DUse random sampling of 5 documents from the dataset
Step-by-Step Solution
Solution:
  1. Step 1: Understand MMR parameters for balance

    Setting top_k=5 retrieves 5 documents; lambda_param=0.6 balances relevance and diversity.
  2. Step 2: Compare with other methods

    Similarity Search alone won't ensure diversity; filtering duplicates manually is inefficient; lambda_param=1.0 disables diversity; random sampling ignores relevance.
  3. Final Answer:

    Set top_k=5 and lambda_param around 0.6 to balance relevance and diversity -> Option B
  4. Quick Check:

    MMR with balanced lambda_param returns relevant + diverse docs [OK]
Quick Trick: Balance lambda_param near 0.5-0.7 for relevance and diversity [OK]
Common Mistakes:
  • Using similarity search without diversity control
  • Setting lambda_param too high or too low
  • Ignoring the need for both relevance and novelty

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes