AI Engineer · Published 2026-09-16

The unreasonable effectiveness of BM25 for agentic search — Jo Kristian Bergum, Hornet.dev

Open on YouTube ↗

Summary

Overview

  • Speaker: Jo Kristian Bergum
  • Channel: AI Engineer
  • Main topic: The resurgence and effectiveness of BM25 lexical scoring for agentic information retrieval loops
  • Purpose: To explain why lexical search (BM25) combined with simple tools like grep outperforms complex vector/embedding retrieval setups in agentic search workflows. Jo Kristian Bergum, CEO of Hornet.dev, explains why a 30-year-old lexical scoring function like BM25 is experiencing a strong comeback in the era of LLMs and agentic search. He defines agentic search as search running inside an agent loop consisting of an LLM model, a harness, and a retrieval engine. Modern LLM users are more powerful, issuing complex queries, using syntactic operators, and rewriting queries dynamically. BM25 provides exact matching, low cost, and interpretability, making it an ideal foundational primitive when paired with simple tools like grep.

Topic Map

Introduction and Agentic Search Definition

  • Explanation: Introduction of the speaker, company background, and definition of agentic search as search inside an agent loop.
  • Key claims:
    • Agentic search is search inside an agent loop.
    • An agentic search system requires a capable model, a harness, and a retrieval engine.
  • Examples:
    • Writing code, answering questions, deep research tasks.
  • Terminology:
    • Agentic search
    • Harness
    • Retrieval engine
    • LLM
  • Why it matters: Establishes the foundational architecture of AI agents requiring external retrieval tools.

What is BM25

  • Explanation: Definition of BM25 (Best Match 25) as a 30-year-old lexical scoring function based on term frequency, inverse document frequency, and document length normalization.
  • Key claims:
    • BM25 is a scoring function evaluating term rarity, term frequency, and document length normalization.
    • Top-k retrieval algorithms accelerate finding the highest scoring documents.
  • Examples:
    • Scoring query-document pairs using inverted indexes and algorithms like WAND.
  • Terminology:
    • BM25
    • Best Match 25
    • Scoring function
    • Top-k retrieval
    • Inverted index
    • WAND
  • Why it matters: Clarifies the mechanics of the baseline retrieval function discussed throughout the talk.

User Change: Why BM25 Makes a Comeback

  • Explanation: BM25 hasn't changed, but the user has. LLMs possess general knowledge, detailed queries, and relevance feedback across turns.
  • Key claims:
    • BM25 did not become magic; the user changed.
    • LLMs are powerful users capable of typing complex, multi-term queries and syntax operators.
  • Examples:
    • LLMs using site operators, phrasing, and entity filters.
  • Terminology:
    • General knowledge in model
    • Query formulation
    • Relevance feedback
  • Why it matters: Explains the paradigm shift from single-shot human search to multi-turn agentic query generation.

BrowseComp-Plus Benchmark and Context Windows

  • Explanation: Analysis of the BrowseComp-Plus benchmark containing riddle-like multi-hop questions over web documents.
  • Key claims:
    • Retrieval quality changes end-to-end task accuracy drastically.
    • Context window limitations make retrieval essential even with massive LLM context windows.
  • Examples:
    • Comparing 736M token corpus against floppy disk sized LLM context windows (~370k tokens).
  • Terminology:
    • BrowseComp-Plus
    • Multi-hop question
    • Oracle evidence
    • Context window
    • Floppy disk
  • Why it matters: Demonstrates empirically that retrieval quality is the core bottleneck for agent accuracy.

BM25 + Grep Is All You Need

  • Explanation: Discussion of Waterloo's research paper on scaling direct corpus interaction via dynamic workspace expansion.
  • Key claims:
    • Combining BM25 retrieval with file system workspaces and grep tools achieves superior end-to-end accuracy.
    • Exposing retrieved documents in virtual file systems (vfs) enables progressive disclosure and inspectable reasoning.
  • Examples:
    • Using rg/grep, cat, read lines, inspect, verify tools in agent loops.
  • Terminology:
    • Dynamic workspace expansion
    • Progressive disclosure
    • vfs
    • grep
  • Why it matters: Provides a blueprint for building high-performance, cost-effective agentic search infrastructure.

Key Points

BM25 as an interpretable primitive

  • Explanation: BM25 scores based on exact term matches, making it fully explainable and easy for LLMs to reason about.
  • Evidence: Outperforms complex embedding models when paired with sophisticated agent query generation.
  • Practical implication: Engineering teams should use BM25 as a robust baseline before adopting heavy embedding or neural retrieval models.

Context window vs corpus size

  • Explanation: Even large LLM context windows are tiny fractions of real-world enterprise corpora (billions of documents).
  • Evidence: Corpora like BrowseComp-Plus have 736M tokens while model context windows hold ~370k tokens.
  • Practical implication: Retrieval infrastructure remains indispensable regardless of how large LLM context windows grow.

Evaluating agent + retriever as a system

  • Explanation: Traditional IR evaluation metrics based on static single queries are obsolete for agents.
  • Evidence: Agents generate query trajectories, rewriting queries dynamically over multiple turns.
  • Practical implication: Evaluation must measure end-to-end task success, latency, and tool call efficiency rather than static NDCG@10.

Frameworks, Models & Processes

Agentic Search Loop

  • How it works: An LLM agent determines when to search and formulates queries, interacts with a retrieval engine to get snippets, and refines results in a loop until it finds enough evidence for a final answer.
  • Components:
    • Capable model (LLM)
    • Harness
    • Retrieval engine
  • When to use: When building complex QA, coding assistants, or deep research agents over large corpora.

BM25 + Grep Workspace Architecture

  • How it works: Retrieves candidate documents using BM25, places them in a virtual file system workspace, and uses Unix-like tools (grep, cat) for progressive disclosure and inspection.
  • Components:
    • BM25 retriever
    • Virtual file system (vfs)
    • Grep / read tools
  • When to use: For scaling direct corpus interaction in developer tools and enterprise RAG systems.

Examples & Case Studies

Evaluation of BrowseComp-Plus benchmark with oracle evidence versus retriever pipelines.

  • Illustrates: When the exact evidence document is provided upfront in the context window, GPT-4 reaches 93% accuracy.
  • Lesson: Reasoning is not the bottleneck; retrieval quality determines overall task success.

Comparing human search queries (median 2 terms) with GPT-5 search trajectories (median 10 terms).

  • Illustrates: LLMs act as power users leveraging advanced query syntax, operators, and specific keywords.
  • Lesson: Search engines optimized for human users must adapt to high-frequency, complex LLM-generated queries.

Actionable Takeaways

  • Immediate:
    • Adopt BM25 as a strong, cheap, and interpretable retrieval baseline.
    • Implement file-system-like workspaces (vfs) for agent document inspection.
  • Strategic:
    • Evaluate retrieval and LLM agents as a single integrated system rather than isolated components.
    • Leverage simple Unix tools (grep, cat) alongside lexical search to match modern agent workflows.
  • Questions to investigate:
    • How do BM25 hyperparameters (k1, b) impact long document retrieval in agentic workflows?
    • What is the optimal balance between vector search and lexical BM25 in multi-modal agent systems?

Claims Worth Verifying

  • Oracle evidence in BrowseComp-Plus reaches 93% accuracy on multi-hop questions. (Benchmark statistic)
  • BM25 with grep and virtual file systems outperforms standard vector RAG pipelines on specific agent benchmarks. (Research finding)

Notable Quotes

"The unreasonable effectiveness of BM25 for agentic search." (at 0:19) "BM25 did not become magic. The user changed." (at 5:32) "Retrieval quality changes answer accuracy." (at 10:48) "BM25 plus grep is all you need." (at 20:05)

Compressed Summary

  • BM25 is a 30-year-old lexical scoring function experiencing a major comeback in agentic search.
  • LLMs act as power users issuing complex, multi-term, syntax-heavy queries compared to human users.
  • Retrieval quality is the primary bottleneck in agentic accuracy, not LLM reasoning capability.
  • Combining BM25 with grep and virtual file systems (vfs) provides a powerful, interpretable, and low-cost retrieval architecture.
  • Keywords: bm25, agentic search, retrieval, grep, llm
  • Core insight: BM25 makes a powerful comeback in agentic search because modern LLM agents act as power users capable of exploiting lexical scoring, exact matching, and simple grep tools for superior reasoning accuracy.

Core insights

6
Empirical Resultmedium noveltystrong evidence

Retrieval quality, not model reasoning, is the dominant bottleneck in agentic search: when the exact evidence document is placed in context upfront, GPT-4 reaches 93% accuracy on BrowseComp-Plus, implying most end-to-end task failure comes from the retriever rather than the LLM.

Why it matters

Shifts engineering investment from prompt/reasoning tuning toward retrieval pipeline quality and evidence placement, and gives a concrete upper bound (the oracle ceiling) to measure how much accuracy a retrieval system is leaving on the table.

Generalization

For any agentic QA or research system, benchmark the 'oracle evidence' ceiling first; the gap between oracle and retriever-mediated accuracy is the retrievable ROI, and it is usually larger than any reasoning-side improvement.

Retrieval quality changes end-to-end task accuracy drastically.
Open source video
When the exact evidence document is provided upfront in the context window, GPT-4 reaches 93% accuracy.
Open source video
Reasoning is not the bottleneck; retrieval quality determines overall task success.
Open source video
Mental Modelhigh noveltystrong evidence

BM25 did not get better — the searcher did. The comeback of a 30-year-old lexical scoring function is explained by LLMs acting as power users: they issue long, syntax-rich, dynamically rewritten queries and consume relevance feedback across turns, which is the regime BM25-style exact matching is optimized for.

Why it matters

Reframes retrieval evaluation and tuning: query distributions have structurally changed (longer, operator-heavy, machine-generated), so search stacks tuned for short human queries are being evaluated against the wrong workload.

Generalization

Whenever an interface's consumer changes from humans to models, re-derive the baseline ranking/interface design from the new query distribution rather than assuming the old algorithm suddenly improved.

BM25 did not become magic; the user changed.
Open source video
Comparing human search queries (median 2 terms) with GPT-5 search trajectories (median 10 terms).
Open source video
LLMs are powerful users capable of typing complex, multi-term queries and syntax operators.
Open source video
Architecturehigh noveltymoderate evidence

The practical architecture is BM25 retrieval feeding documents into a virtual file system workspace that the agent explores with grep/cat/read-line tools, enabling dynamic workspace expansion and progressive disclosure instead of one-shot ranked-list retrieval.

Why it matters

Changes the retrieval-to-agent boundary from 'return top-k chunks' to 'expose a navigable, inspectable corpus surface', making retrieval a stateful workspace the agent iterates over rather than a single API call.

Generalization

Tool surfaces that let an agent narrow, verify, and re-read evidence outperform single-shot context stuffing for multi-hop tasks, at the cost of additional tool-call turns.

Combining BM25 retrieval with file system workspaces and grep tools achieves superior end-to-end accuracy.
Open source video
Exposing retrieved documents in virtual file systems (vfs) enables progressive disclosure and inspectable reasoning.
Open source video
Using rg/grep, cat, read lines, inspect, verify tools in agent loops.
Open source video
Tradeoffmedium noveltystrong evidence

Growing context windows do not remove the need for retrieval because corpus scale and context scale differ by orders of magnitude: a 736M-token corpus versus roughly 370k tokens of model context — the summary's 'floppy disk' framing.

Why it matters

Caps the 'long context solves RAG' argument quantitatively, keeping retrieval infrastructure as a permanent layer rather than a transitional hack.

Generalization

Any system where the working set exceeds context capacity by >1000x will require an explicit selection/navigation mechanism regardless of context growth trends.

Corpora like BrowseComp-Plus have 736M tokens while model context windows hold ~370k tokens.
Open source video
Context window limitations make retrieval essential even with massive LLM context windows.
Open source video
Practicemedium noveltymoderate evidence

Evaluation of agentic search must move from static single-query IR metrics (e.g., NDCG@10) to end-to-end system metrics — task success, latency, and tool-call efficiency — because agents emit multi-turn query trajectories that rewrite themselves.

Why it matters

Changes what telemetry and regression harnesses must capture: trajectory-level and system-level signals rather than per-query ranking scores, otherwise agent regressions are invisible.

Generalization

When the querier is itself an adaptive policy, per-step metrics lose validity; evaluate the closed loop (success, cost, latency) rather than any single step.

Traditional IR evaluation metrics based on static single queries are obsolete for agents.
Open source video
Evaluation must measure end-to-end task success, latency, and tool call efficiency rather than static NDCG@10.
Open source video
Architecturelow noveltymoderate evidence

Agentic search is defined as three separable components — a capable model, a harness, and a retrieval engine — with the loop being: the agent decides when to search, formulates queries, receives snippets, and refines until it has enough evidence.

Why it matters

Names the harness as a distinct responsibility boundary between model and retriever, which is where query formulation, tool schemas, and evidence budgeting must live.

Generalization

Separating policy (model), orchestration (harness), and evidence access (retriever) lets each be evaluated and replaced independently.

Agentic search is search inside an agent loop.
Open source video
An agentic search system requires a capable model, a harness, and a retrieval engine.
Open source video
An LLM agent determines when to search and formulates queries, interacts with a retrieval engine to get snippets, and refines results in a loop until it finds enough evidence for a final answer.
Open source video

Deep dives

4

Oracle-evidence ceiling as a diagnostic for retrieval ROI in agentic search

Research question

How large is the gap between oracle-evidence accuracy and retriever-mediated accuracy across agentic search tasks, and what does this gap reveal about where to invest engineering effort?

Why

If most end-to-end failure comes from the retriever rather than the LLM, teams can budget retrieval improvements before reasoning-side tuning, and the oracle ceiling gives a concrete upper bound to measure how much accuracy is being left on the table.

When the exact evidence document is provided upfront in the context window, GPT-4 reaches 93% accuracy.
Open source video
Reasoning is not the bottleneck; retrieval quality determines overall task success.
Open source video
Source video

Ablating retrieval engine versus harness affordances in BM25+workspace agentic search

Research question

What fraction of the measured end-to-end gain comes from the BM25 retrieval engine versus the virtual file system and grep/cat/read tool affordances?

Why

Without an ablation, teams may over-invest in one component while the actual value driver is the interaction between them; isolating the contributions clarifies where to spend engineering effort.

Combining BM25 retrieval with file system workspaces and grep tools achieves superior end-to-end accuracy.
Open source video
Exposing retrieved documents in virtual file systems (vfs) enables progressive disclosure and inspectable reasoning.
Open source video
Source video

Machine query distribution shift and retrieval tuning

Research question

How do agent-generated query distributions differ from human queries, and what retrieval configuration changes are required to serve both populations without regression?

Why

The reported BM25 comeback is attributed to the searcher changing, not the algorithm; if agent queries are longer and operator-rich, search stacks tuned on human query logs are being evaluated against the wrong workload.

Comparing human search queries (median 2 terms) with GPT-5 search trajectories (median 10 terms).
Open source video
LLMs are powerful users capable of typing complex, multi-term queries and syntax operators.
Open source video
Source video

Trajectory-level evaluation for agent+retriever systems

Research question

What metric suite (task success, latency, tool-call efficiency) should replace static NDCG@10 for evaluating agentic search, and how strongly does it correlate with human judgments?

Why

When the querier is an adaptive policy that rewrites queries across turns, per-query ranking metrics lose validity and agent regressions become invisible without closed-loop telemetry.

Evaluation must measure end-to-end task success, latency, and tool call efficiency rather than static NDCG@10.
Open source video
Traditional IR evaluation metrics based on static single queries are obsolete for agents.
Open source video
Source video

Article ideas

4

The Searcher Changed, Not the Algorithm: Why BM25's Comeback Is a Query Distribution Story

BM25's resurgence proves that machine users issue a structurally different query distribution (longer, operator-rich, dynamically rewritten), so retrieval stacks must be re-benchmarked and re-tuned for machine traffic rather than assuming the algorithm itself improved.

Angle

Counterintuitive reframe: the model didn't get better at search, it got better at being a user; the durable lesson is about interface consumers, not ranking functions.

Source video

Retrieval Is the Bottleneck: Budgeting Agent Engineering Around the Oracle Ceiling

The oracle-evidence experiment showing GPT-4 reaching 93% with exact evidence should make retrieval quality the primary controllable variable; teams should measure the oracle-to-retriever gap before investing in reasoning-side prompt or model upgrades.

Angle

Use the 93% figure as a diagnostic and propose an engineering budget allocation rule based on the retrievable ROI.

Source video

Stop Measuring NDCG@10 for Agentic Search

Static single-query IR metrics are obsolete when the querier is an adaptive agent policy; agentic search requires trajectory-level metrics (task success, latency, tool-call efficiency) to catch regressions that per-query scores miss.

Angle

Methodological shift with concrete instrumentation implications for regression harnesses and telemetry.

Source video

From Top-K to Workspace: Redesigning the Retrieval Interface for Agents

The right abstraction for agentic retrieval is an inspectable workspace (virtual file system plus grep/cat/read tools) enabling progressive disclosure and verification, not a single ranked list; this shift changes harness design, tool schemas, and evidence budgeting.

Angle

Architecture pattern: BM25 candidates materialized into a navigable corpus surface that the agent explores iteratively.

Source video

Project ideas

4

Oracle Ceiling Diagnostic

beyond-evals

For agentic search tasks, the gap between oracle-evidence accuracy and retriever-mediated accuracy exceeds the gain from any reasoning-side model or prompt upgrade, and this gap can be measured with a fixed harness.

Proof of concept

Instrument a multi-hop benchmark to run three conditions with the same model: retriever-mediated, oracle-evidence, and reasoning-only; report the delta.

Measurement

Delta in task success between oracle and retriever conditions; ratio of retrieval ROI to reasoning ROI.

Source video

Workspace vs Snippet Ablation

movement-lab

BM25-with-vfs-tools beats BM25-only snippets on multi-hop tasks, but the gain is mediated by the number of tool calls rather than retrieval recall alone.

Proof of concept

Implement two harnesses over the same BM25 index: one returns top-k snippets, one exposes a vfs with grep/cat/read; fix model, token budget, and query generator.

Measurement

End-to-end task success at matched token budgets; tool-call count as a covariate.

Source video

Machine Query Profiler

new

Agent-generated queries differ systematically from human queries (length, operator use, rewriting), and retrieval configurations tuned on human query logs underperform on machine queries by a measurable margin.

Proof of concept

Log query trajectories from an agent harness across domains; compute distributions and replay them against BM25 configs tuned on human queries (BM25 parameters, tokenization, operator support).

Measurement

Retrieval recall and end-to-end success under human-tuned versus machine-tuned configurations.

Source video

Trajectory Eval Harness

beyond-evals

Static NDCG@10 has weak correlation with end-to-end agent task success; a trajectory-level metric (success, tool-call efficiency, latency) captures regressions that per-query metrics miss.

Proof of concept

Build a harness that records agent search trajectories and computes both static IR metrics per turn and closed-loop success; run controlled regressions (swap retrievers, change tool schemas).

Measurement

Correlation between static metrics and end-to-end success across configurations; detection rate of injected regressions.

Source video

Architectural implications

3

Retrieval is exposed to the agent as an inspectable workspace rather than a ranked list.

Before

Retriever API returns top-k scored chunks (or snippets) as opaque context.

After

BM25 candidates are materialized into a virtual file system that the agent explores with grep/cat/read tools.

Consequence

Retrieval becomes a stateful, multi-turn interface; the harness must manage workspace lifecycle, evidence accumulation, and tool-call budgets.

Source video

The oracle-evidence experiment locates the failure domain.

Before

Agent accuracy problems are attributed to model capability or prompting.

After

Retrieval quality is treated as the primary controllable variable, with an oracle ceiling used as the reference point.

Consequence

Teams instrument retrieval recall/evidence-placement metrics ahead of reasoning-side tuning.

Source video

Agent output distribution differs materially from human query distribution.

Before

Search stacks optimized and benchmarked on short human queries (median ~2 terms).

After

Stacks must handle long, operator-laden, machine-generated queries (median ~10 terms) with per-turn rewriting.

Consequence

Query planning, operator support, and caching layers need re-tuning for machine traffic patterns.

Source video

Tradeoffs and failure modes

3

BM25 effectiveness depends on the quality of agent-generated queries

Benefit

Interpretable, cheap, exact-term scoring that LLMs can reason about and exploit with operators and entity filters.

Cost or risk

The reported superiority over embedding models is conditional on sophisticated query generation; with weak query formulation the lexical baseline degrades rather than being inherently superior.

Outperforms complex embedding models when paired with sophisticated agent query generation.
Open source video
Source video

Progressive disclosure via workspace tools

Benefit

Inspectable reasoning and evidence verification inside the agent loop.

Cost or risk

Requires additional tool calls and multi-turn traversal, adding latency and token overhead relative to a single retrieval call.

enables progressive disclosure and inspectable reasoning
Open source video
Source video

Long context windows as a retrieval substitute

Benefit

Large context windows reduce the need to retrieve for small working sets.

Cost or risk

Corpus scale exceeds context capacity by orders of magnitude, so context growth does not eliminate retrieval requirements.

Corpora like BrowseComp-Plus have 736M tokens while model context windows hold ~370k tokens.
Open source video
Source video

Open questions

4

Does the BM25+grep+workspace advantage hold for semantically-phrased or paraphrase-heavy queries where exact term matching is weak?

Why unresolved

The summary reports a win on riddle-like multi-hop web questions but gives no breakdown of query types where lexical matching fails.

Research direction

Run a controlled benchmark crossing retrieval method (BM25, dense, hybrid) with query style (keyword/operator vs. natural-language paraphrase) on the same corpus and harness.

Source video

How much of the measured end-to-end gain comes from the retrieval engine versus the harness/tool affordances?

Why unresolved

The summary attributes success to the BM25+workspace combination without ablating workspace tools against plain BM25 snippets.

Research direction

Ablation study isolating BM25-only, vfs-only, and combined configurations with fixed model and budget.

Source video

What is the right methodology for evaluating agent+retriever as a system across query trajectories?

Why unresolved

The summary asserts static NDCG@10 is obsolete but does not specify replacement metrics or trajectory-level scoring.

Research direction

Define trajectory-level evaluation capturing task success, latency, and tool-call efficiency, then validate against human judgments.

Source video

How should search infrastructure adapt to machine-generated query distributions (longer, operator-heavy) without regressing human users?

Why unresolved

The summary notes the query-length shift but offers no mechanism for serving both populations.

Research direction

Study query-classification and routing so machine queries and human queries hit differently tuned retrieval policies.

Source video

Key claims

7
factualVerification not requested

Agentic search is search running inside an agent loop composed of an LLM model, a harness, and a retrieval engine.

Evidence

Agentic search is search inside an agent loop.

Source video
causalVerification needed

BM25's renewed effectiveness is caused by the change in the searcher (LLMs as power users), not by any change to BM25 itself.

Evidence

BM25 did not become magic; the user changed.

Question

Can gains in BM25-based retrieval be attributed to query characteristics rather than algorithmic change, holding corpus and evaluation fixed?

Source video
comparativeVerification needed

Providing the exact oracle evidence in context lets GPT-4 reach 93% accuracy on BrowseComp-Plus, implying retrieval, not reasoning, is the bottleneck.

Evidence

When the exact evidence document is provided upfront in the context window, GPT-4 reaches 93% accuracy.

Question

What is the retriever-mediated accuracy on the same benchmark, and how large is the gap to the 93% oracle ceiling?

Source video
comparativeVerification needed

Combining BM25 retrieval with file-system workspaces and grep tools achieves superior end-to-end accuracy compared with alternatives.

Evidence

Combining BM25 retrieval with file system workspaces and grep tools achieves superior end-to-end accuracy.

Question

Against which baselines (e.g., dense retrieval, BM25-only, long-context stuffing) and under what token/tool-call budgets?

Source video
comparativeVerification needed

Corpus sizes vastly exceed LLM context windows, keeping retrieval necessary despite large context windows.

Evidence

Corpora like BrowseComp-Plus have 736M tokens while model context windows hold ~370k tokens.

Question

Do these ratios hold for typical enterprise corpora, and how do they shift as context windows grow?

Source video
opinionVerification needed

Traditional static single-query IR metrics are obsolete for evaluating agents.

Evidence

Traditional IR evaluation metrics based on static single queries are obsolete for agents.

Question

How strongly does static NDCG@10 correlate with end-to-end agent task success across harnesses?

Source video
factualVerification needed

LLM-generated search queries are substantially longer and more operator-rich than human queries.

Evidence

Comparing human search queries (median 2 terms) with GPT-5 search trajectories (median 10 terms).

Question

Is the median 10-term figure stable across domains, models, and task types, or an artifact of one benchmark?

Source video

Connections

5