LearnQuestion bank

Dense-only retrieval misses queries that contain product codes, error IDs and people’s names. What would you change, and how would you merge result lists?

Applied LLMTechnicalMedium

Theme reported publicly: Cohere

Answer it yourself first, out loud or on paper, then compare.

Answer

Model answer, written in a candidate's voice

In short

  • Dense embeddings are weak on rare tokens and exact strings; lexical search (BM25) is strong there
  • Fusion with reciprocal rank fusion (Σ 1/(k + rank)) or normalised weighted scores, tuned on an eval set
  • Query understanding: detect identifiers and route to exact match or metadata filters
  • Rerank after fusion; report recall@k per query segment (identifier-heavy vs semantic)
  • Operational cost: two indexes to keep consistent; latency budget

In full

I would stop treating dense retrieval as the only path and make retrieval hybrid: dense for meaning, BM25/lexical for rare tokens like product codes, error IDs and names, because embeddings are weak exactly where exact strings matter. I would fuse the two result lists with reciprocal rank fusion, summing 1/(k + rank) across lists, or with normalised weighted scores if the eval set shows one signal is more reliable for a segment; the weights and k should be tuned on a representative eval set, not guessed. I would also add lightweight query understanding: detect identifier-like spans and names, route those to exact match or metadata filters, and keep the semantic path for intent-heavy queries. After fusion I would rerank the merged candidates and report recall@k separately for identifier-heavy versus semantic query segments so we can see whether the fix helps the right cases. The trade-off is operational: two indexes to keep consistent, extra latency, and a need to degrade gracefully if one path is slow or unavailable, so I would set a latency budget and monitor both recall and p95 latency rather than only average quality.

Checked against sources by an independent AI reviewer.

What a strong answer covers

  • Dense embeddings are weak on rare tokens and exact strings; lexical search (BM25) is strong there
  • Fusion with reciprocal rank fusion (Σ 1/(k + rank)) or normalised weighted scores, tuned on an eval set
  • Query understanding: detect identifiers and route to exact match or metadata filters
  • Rerank after fusion; report recall@k per query segment (identifier-heavy vs semantic)
  • Operational cost: two indexes to keep consistent; latency budget

Common mistakes

  • Adding raw BM25 and cosine scores without normalisation
  • judging success on an aggregate metric that hides the failing segment