RAG-вопрос
A векторный поиск returns top-k nearest items, but all results are too similar to each other. How can you keep relevance while increasing diversity?
Ответить самому
Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.
Короткий ответ
Retrieve a larger candidate pool, then rerank with a diversity-aware objective such as MMR, clustering, per-attribute quotas or multi-vector prefetch/rerank. Keep a relevance floor so diversity does not produce bad matches.
Полный разбор
Nearest-neighbor search optimizes similarity to the query, not diversity among results. If the top 20 are all near-duplicates, first retrieve more candidates than you need. Then rerank with an objective that balances query relevance and dissimilarity to already selected items.
Maximum Marginal Relevance is a standard approach: at each step choose an item with high similarity to the query and low similarity to selected items. Alternatives include clustering candidates and picking representatives, applying quotas over attributes such as color/brand/category, or using a two-stage retriever where one vector gets broad candidates and another reranks.
In systems such as Qdrant, prefetch/multi-vector retrieval can support this pattern: retrieve from several embeddings or filters, merge candidates and rerank. The key production point is to tune diversity with offline relevance metrics and online user behavior; diversity is useful only if relevance remains acceptable.