---
title: Dense-only retrieval misses queries that contain product codes, error IDs and people's names. What would you change…
url: https://gurkanozkan.ai/learn/questions/applied-llm-rag-03/
markdown: https://gurkanozkan.ai/learn/questions/applied-llm-rag-03.md
kind: question
role: Applied LLM
stage: Technical
difficulty: Medium
json: https://gurkanozkan.ai/api/learn/questions/applied-llm-rag-03.json
robots: noindex
---

# 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 LLM · Technical · Medium

Theme reported publicly: [Cohere](https://www.techinterview.org/post/3233474931/cohere-interview-process-2026/)

## 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

## Topic guides

- [Retrieval-augmented generation](https://gurkanozkan.ai/learn/topics/rag.md)
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
