Back to Resources

RAG vs keyword search: measure the baseline first

Before adding embeddings to clinical document search, test BM25, check document structure, and compare answer quality, citations, cost, and latency.

Sebastian RicaldoniCEO, Celteeka

Published 9 min read

  • Retrieval-augmented generation
  • Document search
  • Healthcare
  • AI engineering

Before building an embedding index over clinical policies, payer contracts, lab reports, or discharge summaries, measure a keyword-search baseline. If the questions contain the terms that identify the evidence, lexical retrieval may already do much of the work. The useful comparison is the answer your system can support, at an acceptable cost and delay.

First, let's clarify the terminology, because we've seen a lot of confusion around it, from technical and non-technical people alike. Retrieval-augmented generation, or RAG, helps a large language model (LLM) ground its answers in current information it never saw during training, either because the information didn't exist yet (a recent event, for example) or because it is private to an organization and protected by IP, HIPAA, and so on. If a model wasn't trained on your data, you can't trust what it says about your data at inference time. Remember: LLMs are designed to generate probable text, not truthful text.

RAG fixes this shortcoming by adding a retrieval step. Before the prompt goes to the LLM, the system searches up-to-date sources or private knowledge bases and injects the results into the prompt; that is the "augmented" in RAG. Retrieval is the most critical part of this architecture. It's where the actual software engineering comes into play, and it's the fun part. You can search your data in various ways, but the two most common are keyword search (yep, most likely why you're reading this article) and semantic search, usually built on vector embeddings (what the rest of this article calls dense retrieval). Keyword search matches exact words or terms; semantic search matches meaning or intent. Many production systems combine the two in a hybrid search.

So, if you've been paying attention (remember, "Attention Is All You Need" ;-)), by now you know that "RAG vs keyword search" isn't a well-posed question. Keyword search is a component within RAG, and BM25 is one way to perform keyword search. The original RAG paper by Lewis and colleagues used a dense passage index, but that particular implementation should not define every document-search architecture.

This article is based on published research and the tools' own documentation; we have not reproduced the study it discusses. Our view is that the first engineering task is to discover where evidence gets lost. A small study of READ, an agent that reads a document the way a person would (search it, outline it, read a span), offers a useful reason to test that before committing to embeddings or an agent.

When a relevant passage is not enough

Take an illustrative lab report. The table header says results are in mg/dL and were collected on 12 March 2026; three rows down sits Glucose 142. If chunking puts the header in one chunk and the row in another, retrieval can return the row alone: a number with no unit and no date. The model will still answer fluently, and may attach the value to the wrong visit or the wrong scale. Nothing in the answer signals that half the fact was left behind.

The same design risk appears in other document structures. A contract clause may depend on a defined term elsewhere. A policy requirement may have an exception in another section. A guideline quotation may need its scope and effective version to be interpreted.

Chunk-and-embed retrieval partitions text, represents the pieces as vectors, and ranks them against the query. If the evidence needed for an answer spans several pieces, the retrieval and context-assembly stages must bring those dependencies together.

So inspect the representation before blaming the retriever. Larger context windows, preserved table headers, section metadata, parent-section expansion, and structured extraction are design choices worth testing. A better similarity score cannot bring back a header that chunking cut off.

Three ways to retrieve evidence

BM25 is a lexical ranking method: it scores matches to query terms, with term-frequency saturation and document-length normalization. It does not require an embedding model. Robertson and Zaragoza's account of BM25 explains the underlying model. Its retrieval unit can be a passage or section; keyword retrieval is not inherently a whole-document method.

READ takes another approach. Its released implementation lets an agent navigate a converted Markdown document through three core operations:

  • Search: find lexical matches and their line numbers, with normalization for text artifacts.
  • Outline: inspect headings and their locations.
  • Read: fetch a bounded line range and decide whether more context is needed.

Leaving the document available for navigation does not mean sending the entire PDF to the model at once. The agent chooses successive spans to inspect. This creates a trace of what it read, while adding model calls and decisions that also need evaluation.

Three approaches use the same authorized, versioned document text. BM25 ranks passages by lexical matches; dense retrieval ranks embedded chunks by similarity; an agentic reader iterates through search, outline, and line-range reads. Each supplies evidence to answer generation and citation checking.
Compare retrieval and evidence assembly while holding answer generation constant. All three approaches still depend on faithful document conversion, authorization, and checked citations. Original conceptual diagram by Celteeka.

BM25 can miss evidence expressed with different vocabulary. An agent can search badly, stop early, or misinterpret what it reads. Dense retrieval can be useful for paraphrases. The question is which combination retrieves enough authorized evidence for your questions, rather than which architecture sounds most advanced.

What one READ study found

The READ paper, version 2, reports 51 verified questions about one 780-page Gujarat government financial report, using Gemini 2.5 Pro for answer generation throughout. The figures score complete question-answering systems: each retrieval configuration feeds the same answer model.

Retrieval configurationReported answer accuracy
READ agent58.8%
BM25 retrieval51.0%
Dense chunk retrieval, tuned (16 chunks)35.3%
Dense chunk retrieval, main configuration15.7%
Agent loop with vector retrieval27.5%

The main experiment configuration uses table-aware 2,000-character chunks, 200-character overlap, and eight retrieved chunks for the retrieval baselines; the dense encoder is BAAI/bge-base-en-v1.5. The agents have a 30-turn ceiling.

The tuned dense row comes from the paper's results and limitations, with retrieval depth raised to 16, so the 15.7% headline is not dense retrieval's best tested result. The READ–BM25 difference did not reach significance under the authors' corrected paired test, which does not make the two equivalent either. The authors also disclose that they expanded their own benchmark during the study, and READ did not lead on their groundedness measure.

The study uses a financial report, not clinical documents. The lesson still transfers: like a payer contract or a hospital policy manual, the report is long, table-heavy, and full of exact identifiers and cross-references, which is where chunking loses evidence. One report and 51 questions cannot validate READ for clinical questions or show that embeddings are obsolete. What they do show is that a lexical baseline is worth measuring before you pay for anything more complex.

Evaluate your documents before choosing the architecture

Use the study as a prompt for an evaluation your team controls. The recipe below is what we recommend, not a benchmark we ran.

Build questions before tuning the retriever

Start with synthetic documents or appropriately de-identified material. Have domain reviewers write questions, acceptable answers, and exact supporting locations before inspecting system results. Include ordinary queries and difficult dependencies, rather than assembling only cases where you expect one method to win. Reserve a separate set for the final comparison.

For each question, record the document and version, relevant pages or line ranges, required units and dates, allowed arithmetic, and whether the answer is actually present. If an answer depends on several sections, record all of them.

Test caseWhat a reviewer should check
Exact clause or identifierThe answer uses the requested document and section.
Value in a tableRow, column, unit, sign, and reporting period agree.
Definition or exception elsewhereBoth the statement and its governing context were retrieved.
Paraphrased questionDifferent wording still reaches the correct evidence.
Unanswerable questionThe system declines without inventing a source.

A small set exposes failure modes; it rarely settles small differences confidently. Expand coverage across document types and versions before using the result to justify a broad deployment.

Make the comparison fair

Run BM25, dense retrieval, and an agentic reader over the same authorized corpus snapshot. Hold the answer model, output format, citation requirement, and grading rules constant where practical. Record the model and converter versions, retrieval units, chunk settings, normalization, retrieval depth, prompts, and agent budgets.

Give each approach a reasonable tuning budget on the development questions. BM25 needs appropriate tokenization and passage construction; dense retrieval needs an appropriate encoder and context assembly. An untuned baseline is easy to beat and tells you little about what to deploy. If neither single retriever handles both exact terms and paraphrases, include a hybrid candidate.

Check the converted text against the original pages before blaming retrieval. Missing columns, flattened tables, lost signs, and incorrect reading order are representation failures. Keep them distinct from a retriever failing to find intact evidence or a generator making an unsupported inference.

Score answers and evidence separately

Measure answer correctness, citation support, complete evidence retrieval, appropriate abstention, and unauthorized-data exposure. Use deterministic checks for exact values where appropriate, but have a qualified reviewer inspect contextual interpretation. A matching number can still belong to the wrong year or contract version.

Capture latency distributions, tool calls, tokens, per-query model charges, and index-build/update costs. Separate cold from warm runs and record local hardware, concurrency, and hosted-model settings. Repeat model-backed trials where variability matters. Report paired outcomes and uncertainty instead of treating a few extra correct answers as a stable win.

For a policy assistant, choose release criteria with the operational owner: which questions it may answer, when it must abstain, who reviews it, and what evidence must accompany an answer. Research answer accuracy alone does not establish clinical utility or suitability for decisions about patient care.

Protect the corpus, index, and model context

For organizations subject to the HIPAA Security Rule, access controls and safeguards apply to systems handling electronic protected health information. HHS's Security Rule summary describes that broader obligation. A choice of retriever does not satisfy it by itself.

Our recommended design is to enforce document authorization before any passage, search snippet, heading, or file-list result reaches the model or user. Apply the same scope to every tool call, including follow-up reads. Test cross-organization requests, permission revocation, and cached answers that might outlive an access grant.

Treat document text, derived indexes, query logs, traces, and model prompts as part of the sensitive-data boundary. Replacing names or encoding text as vectors is not a sufficient basis to declare the information de-identified. HHS describes the applicable Expert Determination and Safe Harbor methods. Choose approved processing, retention, and logging arrangements before introducing real PHI.

READ's line-oriented tools make evidence easy to inspect, which still leaves correctness, authorization, and currency to check. Start with the least complex system that meets your measured requirements, and add retrieval or agent capabilities when the failure cases justify them.

Get started

Celteeka's AI services include retrieval-augmented generation and agents for business workflows. To discuss an evaluation of document search, evidence handling, and access boundaries, contact Celteeka.

Bring your problem. Let us work on the solution.

For founders, CTOs and product leaders in healthcare, life sciences, edtech and other regulated industries. Share your challenges, pain points or the idea that's been buzzing in your head, and Celteeka will take it from MVP to production.