RAG & Retrieval·Question 59 of 100Advanced

A teammate wants to delete the vector index and give the agent grep, file reads and keyword search instead, the way coding agents work. Where are they right, and where does it break outside code?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

Your teammate is right for small, well-organised corpora with a shared vocabulary and a generous per-query budget, and wrong for large, paraphrase-heavy, permissioned corpora behind a latency target. The idea worth keeping is the loop, not the deletion of embeddings.

Full worked answer with diagram

Your teammate is right for small, well-organised corpora with a shared vocabulary and a generous per-query budget, and wrong for large, paraphrase-heavy, permissioned corpora behind a latency target. The idea worth keeping is the loop, not the deletion of embeddings.

It works for code because identifiers are exact, the repository is a navigable structure of directories, imports and definitions, and the agent can grep, read and refine until it has the answer. There is no index to go stale, since every call reads the current tree.

It transfers to a well-named policy folder, a markdown docs site or one customer's files. With list, keyword search and ranged read tools, the agent reformulates its way past most lexical misses.

Where it breaks:

  • Vocabulary mismatch at scale. In two million support tickets, "laptop will not boot" and "notebook fails POST" share no words. The agent has to guess the corpus's vocabulary, and every guess is a round trip. A dense leg finds the paraphrase in one call.
  • Scale. Grep over millions of documents means building an inverted index anyway, so "no index" quietly becomes BM25 plus an agent.
  • Latency and cost. Five to twenty tool calls against one sub-second pipeline. Fine for a research task, wrong for a search box.
  • Permissions. A raw file tool must enforce ACLs on every call. A filtered index already did that work.
  • Evaluation. Trajectories vary run to run, so regressions are harder to catch than a drop in recall@k.

My position: give the agent a hybrid search tool, BM25 plus dense with ACL filters, alongside read and list tools, and let it iterate. Then compare task success and tool calls per answer with and without the dense leg on the same golden set, and drop embeddings only if the data says they add nothing.

Worth sketching. The latency budget picks the architecture first, and corpus shape picks the tools second.

flowchart TD
    Q["Query arrives"] --> B{"Latency budget"}
    B -->|"sub-second search box"| P["Single-shot<br/>hybrid pipeline"]
    B -->|"seconds to minutes"| C{"Corpus shape"}
    C -->|"small, well named"| G["Agent with list,<br/>grep and read tools"]
    C -->|"large, paraphrase-heavy"| H["Agent with a hybrid<br/>search tool plus read"]
    G --> L["Loop: search, read,<br/>refine, answer"]
    H --> L

What a good answer covers

  • The idea worth keeping is the loop, not the deletion of embeddings
  • It works for code because identifiers are exact, the repository is a navigable structure of directories,…
  • There is no index to go stale, since every call reads the current tree
  • It transfers to a well-named policy folder, a markdown docs site or one customer's files
  • With list, keyword search and ranged read tools, the agent reformulates its way past most lexical misses

Key terms: Vocabulary mismatch at scale · Scale · Latency and cost · Permissions · Evaluation

Interviewer follow-ups to expect

  1. How would you design the evaluation that decides whether the dense leg stays?

  2. What does an agent need in a search tool's results to reformulate well after a miss?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep