← Back to Blog

Building For The Messy Real World: EnterpriseRAG-Bench

Anatomy of a 99% Recall RAG System: Beating the 500,000-Document Haystack on EnterpriseRAG-Bench

If you have built a Retrieval-Augmented Generation (RAG) prototype in the last two years, you know the seductive lie of the 1,000-document demo.

You chunk a few dozen clean PDFs, embed them with a 1536-dimensional vector model, drop them into a managed vector database, and wire up a frontier LLM. You ask a question. It answers perfectly. Everyone in the room seems thrilled.

Then you point that exact same architecture at a real company’s data.

Suddenly, your clean PDFs are replaced by 275,000 fragmented Slack messages, 120,000 sprawling email threads, thousands of unmerged GitHub pull requests, conflicting Jira tickets, and automated meeting transcripts where people interrupt each other mid-sentence. Projects go by three different internal codenames depending on which quarter the message was sent. Worse, every major engineering decision has four draft specifications that look 98% identical to the final signed-off record—except the final record changed the retention policy from 30 days to 90 days in a Tuesday afternoon comment.

When UC Berkeley and Onyx released EnterpriseRAG-Bench to test this exact reality across a simulated 511,962-document company called Redwood Inference, the industry’s standard playbook collapsed. Out-of-the-box vanilla vector search scored 51.4% correctness and a dismal 46.0% document recall, losing by nearly 20 percentage points to fifty-year-old BM25 keyword search (68.8%). Major enterprise cloud offerings from OpenAI, Google, Amazon, and Microsoft landed between 41.8% and 61.0%.

Over the past several months, a fierce arms race has played out at the top of the official EnterpriseRAG-Bench leaderboard among funded AI search startups and research labs—teams like PipesHub (93.24 overall / 95.0% correctness), Neurond (92.74 / 94.2%), Codos (92.64 / 94.4%), and Flexor (91.48 / 93.0%).

I wanted to see how far a single systems-obsessed AI engineer could push the ceiling.

By treating RAG not as a prompt-engineering exercise, but as a deterministic systems and information-retrieval problem, I built an agentic pipeline that completes EnterpriseRAG-Bench at 97.0% correctness, 95.88% completeness, and a 94.24 combined score (correctness × completeness).

The engine behind those numbers is the search layer: out of 742 required gold documents scattered across 511,962 noisy enterprise records, our retrieval system surfaces the relevant portions and hands 737 of them (99.3%) directly to the answering agent—missing only 5 documents across the entire benchmark. Of those 5 missed documents, 3 were subsequently recovered by the answering agent in enumerate mode (a code-loop agent equipped with dedicated search and tally tools). After look-alike arbitration and final citation selection, the submitted run finishes with 97.46% evaluated recall and just 0.93 invalid extra documents per question.

In maxxed-out benchmark mode (running Claude Opus 5.5, which produced the submitted score), median answer latency is 68 seconds. In Fast Mode—swapping in faster synthesis models like Muse Ember / Muse Spark behind the same core search engine—median answer time drops to 22 seconds.

This is the story of how that system was built—and why the retrieval architecture, not the LLM prompt, is the real reason it wins.


1. The Battlefield: Why “Redwood Inference” Breaks Standard RAG

To understand why every architectural decision in this system exists, you first have to appreciate how adversarial the EnterpriseRAG-Bench corpus actually is.

The benchmark simulates Redwood Inference, an AI-inference-as-a-service company, across 511,962 documents spanning nine heterogeneous data sources:

  • Slack (~275,000 messages across public and noisy private channels)
  • Gmail (~120,000 emails, automated alerts, and customer threads)
  • Linear & Jira (~41,000 combined engineering tickets and status updates)
  • Google Drive & Confluence (~30,000 design docs, spreadsheets, and wiki pages)
  • HubSpot (~15,000 CRM records and deal notes)
  • Fireflies (~10,000 raw, conversational meeting transcripts)
  • GitHub (~8,000 pull requests, code reviews, and commit histories)

Across this half-million-document haystack, the benchmark poses 500 complex questions divided into 10 failure-prone categories: Semantic (where the query shares zero keywords with the target document), Constrained (where a single date, version, or customer tier disqualifies 99% of matching docs), Project Related, Intra-Document, Completeness (requiring exhaustive enumeration across scattered records), Conflicting Info, and Info Not Found (20 trap questions where the answer does not exist in the corpus and any helpful guess scores a flat zero).

System / TeamCombined (Corr × Comp)CorrectnessCompletenessDocument RecallArchitecture / Approach
This Build (Submitted Run)94.2497.0%95.88%97.46% (99.3% delivered)Custom hybrid retrieval + Calibrated Router + Code loop agent (0.93 extra docs)
PipesHub93.2495.0%95.63%~96%+Hybrid search + knowledge graph + agent loop (gpt-6.1-sol)
Neurond / Orient92.7494.2%—96.69%High-recall enterprise retrieval (0.81 extra docs)
Codos (Aethos)92.6494.4%95.16%96.45%Graph-based memory; “rank globally, read locally”
Flexor.ai91.4893.0%94.37%93.62%Agentic search + gpt-6.1-sol
Mixedbread86.5889.8%90.62%94.28%Reranker-heavy pipeline + Opus 5
BM25 Baseline (Paper)—68.8%—68.4%Pure lexical keyword matching
OpenAI File Search61.03———Managed vector RAG
Vanilla Vector Search—51.4%—46.0%Standard dense embedding top-k

Why do standard systems fail so reliably here? Two reasons: Look-Alike Noise and Granularity Mismatch.

In a real enterprise, nobody deletes old drafts. A single outage template spawns 400 nearly identical Slack threads. A pricing change gets debated in Fireflies, drafted in Google Drive, argued over in Gmail, and quietly finalized in a Linear comment. If your retrieval system hands your LLM three look-alike drafts and misses the one Linear comment—or if your LLM hedges and says “Some documents say 30 days while others say 90 days” when one clearly superseded the other—the benchmark’s evaluation judge marks you wrong.

To beat a benchmark like this, you cannot rely on “vibe-checking” prompts on five sample questions. You need an engineering harness built for surgical failure analysis.


2. Rule #1: Never Debug an Agent with grep and .txt Files

The single best decision I made on this project happened before I tuned a single prompt or embedded a single document: I refused to log to text files.

When you are running 500 questions through a multi-stage agentic pipeline, standard stdout streams or JSONL dump files become a graveyard for engineering velocity. When a run finishes and your accuracy drops by 1.2%, a folder full of .txt logs forces you into “debugging by anecdote.” You open three failed logs, read 40,000 tokens of context, convince yourself you see a pattern, tweak a prompt, and kick off another multi-hour run—only to discover your fix broke six other questions you didn’t inspect.

From Day 1, I built the entire evaluation and execution harness around a relational SQLite telemetry and run-log database.

Every run, every question, every incremental stage transition, every router confidence distribution, every candidate document ID at every rank depth, and every LLM call (latency, token counts, cache hits, and cost) was written directly into structured SQLite tables.

Turning Debugging into a 1-Second Query

Having SQLite as the spine of the architecture transformed how I iterated. Instead of reading logs, I asked questions of the telemetry database:

  • “Show me every question in the Constrained category where the ground-truth gold document was present in the raw retrieval pool at rank ≤ 500, but was dropped before reaching the answering agent.”
  • “Compare Run #14 and Run #15: which exact questions flipped from pass to fail, and did the retrieved document set change, or did only the synthesis output change?”
  • “What is the p50 and p95 latency contribution of each stage across questions routed to the enumerate code-loop versus one-shot synthesis?”

In seconds, SQLite tells you where your engineering hours actually belong. Early on, competitors like PipesHub noted in their engineering blogs that in ~90% of their wrong answers, the right document had already been retrieved—leading many teams to treat retrieval as “good enough” around 94–96% recall.

My SQLite telemetry told a subtler story. Yes, look-alike reasoning errors were huge—but on a 500-question benchmark, pushing retrieval delivery from ~96% up to 99.3% (737 of 742 gold documents) rescues more than a dozen entire questions from guaranteed failure before the answering model even wakes up. In a leaderboard race where #1 and #3 are separated by a single percentage point, eliminating missing-document failures at the search layer is the difference between winning and losing.


3. Taming Cost & Variance: The Replayable Stage-Gate Pipeline

There is an ugly secret in frontier AI benchmarking that rarely makes it into marketing blog posts: evaluating 500 complex enterprise queries is brutally expensive and noisy.

In the submitted benchmark run, the heavy lifting at the answering stage is dominated by a single call to Claude Opus 5.5, which costs roughly $0.70 per question. Multiply that by 500 questions, and a single full evaluation pass costs $350 just for the final generation step.

If you run an end-to-end pipeline every time you want to test a search tweak, adjust a rank-fusion weight, or refine a router threshold, two disastrous things happen:

  1. You burn thousands of dollars re-computing answers or re-running searches that didn’t need to change.
  2. Upstream variance masks downstream signal. If your upstream retrieval pool shifts slightly between runs, you have no idea whether a +1% score bump came from your new synthesis prompt or from lucky retrieval variance.

Stop, Start, Branch, Replay

To solve this, I engineered the answering pipeline as a series of discrete, serialized stage-gates backed by SQLite state snapshots:

[Stage 1: Gates & Routing (~1.5s total; Perplexity Decider 1.2 in 0.3s)]
       │  (Serialized state written to SQLite)
       ▼
[Stage 2: Hybrid Retrieval (~21.0s)]
       │  (Ranked context & gold candidates frozen in SQLite)
       ▼
[Stage 3: Answering Gate (Question-Type & Confidence Routing)]
       │
       ├──► One-Shot Path: Direct Synthesis (Opus 5.5 in submitted run; Muse Ember/Spark in Fast Mode)
       └──► Enumerate Mode: Code-Loop Agent + Monty Sandbox (Search & Tally Tools)

Every stage was built to be stopped at, started at, replayed, and controlled with surgical granularity:

  • Tuning Retrieval for $0 in Opus Spend: When I was working to push retrieval delivery from 94% to 99.3%, I stopped the pipeline entirely at the end of Stage 2. I could run 500 questions through Stage 2 in minutes, compute exact recall against the 742 gold document IDs in SQLite, tweak fusion logic, and re-run—paying $0.00 in Opus synthesis costs until retrieval was locked in.
  • Deterministic A/B Testing of Prompts & Effort Tiers: Once Stage 2 was frozen in SQLite, I could replay Stage 3 from those exact saved retrieval states. Every downstream experiment saw the exact same documents in the exact same order.
  • The -med vs. -high Effort Ablation: A great example of stage-gate replay in action was our cost-optimization experiment on Opus 5.5. Could we drop Opus from -high effort to -med effort to slash that $0.70/query cost and shave seconds off synthesis time? Because retrieval was frozen in SQLite, we replayed the exact same retrieved contexts through -med and -high. The result was unambiguous: **-high delivered a full +3% correctness uplift over -med**.

Without frozen stage-gates, a 3% difference can easily get lost in run-to-run retrieval noise. With deterministic replay, we knew for a fact that those extra reasoning tokens were resolving subtle temporal contradictions and constraint traps across roughly 15 questions. While further cost optimization is straightforward for production deployments (and powers our Fast Mode), sticking with -high for the submitted run was a clean, data-backed decision to avoid cross-variable regressions.


4. Why Search Is the Entire Game: 737 of 742 Gold Docs Found (99.3%)

If you only take one architectural lesson from this build, make it this: the search engine is why this system wins.

There is a popular narrative in enterprise AI right now that retrieval is “mostly solved”—that once you hit 93%–95% recall, the real battle is writing better system prompts or giving an agent more tool-calling turns.

My telemetry showed the exact opposite. Search doesn’t just set your recall ceiling; it determines your reasoning accuracy, your hallucination rate, your token cost, and your speed.

Out of 742 required gold documents buried across 511,962 Slack messages, emails, tickets, PRs, and transcripts, our retrieval pipeline surfaced the relevant portions and passed 737 of them (99.3%) directly to the answering agent. Only 5 gold documents went unfound across the entire 500-question benchmark—and even then, 3 of those 5 were recovered by our answering agent in enumerate mode, bringing total end-to-end document discovery to 740 of 742 (99.7%).

Why Off-the-Shelf Retrieval Breaks Here

The standard playbook—chunk everything and drop it into one big embedding index—quietly sabotages everything downstream on enterprise data:

  • Look-alike crowding: A single incident or status template spawns hundreds of near-identical threads that pack the top-k of a standard vector store, shoving the one governing record out of view.
  • Semantic smoothing: Dense embeddings blur the exact tokens that separate look-alikes—30 days vs. 90 days, a date, a ticket ID, or a version string.
  • The granularity trap: No single vector representation can capture both a document’s overall topic and the single buried paragraph in a 90-message Slack thread that decides the answer.

When weak retrieval hands an LLM a noisy, incomplete pile of look-alikes, teams are forced to compensate with bloated multi-turn agent loops that burn 5+ minutes trying to dig themselves out of a bad initial search.

Lightweight Indexing, Multi-Index Hybrid Fusion

Instead of patching weak search with heavier agents—or running a 24-hour LLM knowledge-graph extraction marathon at index time—I designed a purpose-built retrieval architecture from the ground up.

At the highest level, the indexing and search pipeline was designed for inexpensive indexing and combines four clean building blocks:

  • Lightweight entity extraction to anchor people, projects, codenames, and identifiers without heavy index-time LLM overhead.
  • Intelligent segmenting so buried decisive paragraphs aren’t diluted by long documents—while short records stay intact.
  • Multiple specialized vector indexes rather than forcing a single monolithic embedding to do every job.
  • Traditional BM25-style lexical search fused with those vector indexes—letting BM25 lock onto exact dates, ticket IDs, and version strings while the vector side bridges vocabulary mismatch when the target document never uses the query’s words.

(To be clear, this is a deliberately simplified overview. The actual indexing and retrieval engine relies on several novel techniques that, to my knowledge, haven’t been applied to enterprise search before. I’m keeping those details private for now, but may publish a full technical breakdown in the future.)

From 99.3% Retrieval Delivery to 97.46% Final Recall

Looking closely at the funnel reveals where the real work happens:

  • 99.3% Retrieval Delivery (737 / 742 gold docs): The search engine virtually eliminates “missing needle” failures before the answering agent even wakes up (with enumerate mode catching 3 of the remaining 5).
  • 97.46% Final Evaluated Recall (0.93 Invalid Extra Docs): The ~1.8% drop between what retrieval delivers and what gets cited in the final graded answer isn’t a search miss—it is look-alike arbitration and agent decision-making, where the answering model decides which sibling record to trust and cite as the governing truth.

Still, 97.46% final recall beats the highest published recall on the leaderboard (Neurond’s 96.69%) while keeping invalid extra documents under 1.0 per query. When your search layer consistently hands the LLM 99.3% of the ground truth without drowning it in noise, the answering model stops fighting clutter—unlocking 97.0% correctness, 95.88% completeness, and our 22-second Fast Mode.


5. The Router Side-Quest: Calibrating Perplexity Decider 1.2

Once your retrieval engine is delivering 99.3% of the gold documents, a tempting mistake is to dump every single query into a multi-turn autonomous agent loop.

In practice, running an open-ended agent loop on every question is a trap:

  1. Most questions don’t need it: When the right documents are already sitting at the top of your context window, a huge portion of EnterpriseRAG-Bench questions are straightforward one-shot lookups or two-document cross-checks.
  2. Loops amplify look-alike overthinking: Give an autonomous agent five turns on a simple lookup, and it will often talk itself out of the governing record by digging up obsolete draft documents.
  3. Latency and cost explode: Multi-turn tool loops wreck your median latency.

On the flip side, some questions on EnterpriseRAG-Bench genuinely cannot be solved reliably in a single pass. Questions in the Completeness or Project Related categories might ask you to enumerate every customer affected by a series of incidents, or count and aggregate entities across 15 scattered status reports.

Two Lanes of Traffic: One-Shot Synthesis vs. Enumerate Mode

To get the best of both worlds, I placed a fast decision gate—powered by Perplexity Decider 1.2, which executes in just 0.3 seconds—to inspect the question type and route traffic down one of two paths:

  • The One-Shot Path: For direct lookups, constrained fact retrieval, and standard disambiguation, the gate sends the curated context straight to a single synthesis call.
  • Enumerate Mode (Code-Loop Agent + Monty Sandbox): When the gate detects an enumeration problem or gnarly multi-document synthesis question, it routes the query into a code-loop agent running inside a Monty sandbox—a lightweight, secure Python execution environment equipped with dedicated search and tally tools built specifically for counting entities and documents. Not only does this prevent the LLM from losing count in its natural-language scratchpad, it also acts as a retrieval safety net: 3 of the 5 gold documents missed by initial search were found by this enumerate-mode agent.

The Calibration Discovery: Why Descriptive Confidence Beats a Bare Probability

Building the router triggered one of my favorite engineering side-quests of the entire project: decision model calibration.

A decision model like Decider doesn’t generate text. You pass it the question as state plus typed questions, and it returns probabilities: a noul—a yes/no check—gets a single probability of yes, from 0 to 1, and a choice question gets a probability for each named option.

Initially, we used the obvious setup: one noul (“Can a single pass answer this?”) with a float cutoff on the probability.

When we inspected the SQLite telemetry, that format was brittle on boundary questions. A query that blends a lookup with multi-doc synthesis lands in the middle of the range, and a cutoff like greater than 0.78 drifted every time the prompt changed.

So we ran a calibration experiment across our saved SQLite stages and found a much more reliable pattern: asking for confidence as four distinct, descriptively phrased options—from “highly confident” down through progressively weaker levels—instead of one bare number. Decider returns a probability for each level, so the router sees where the probability mass sits rather than thresholding a single float.

Why did this work so much better?

  • It matches how mixed-intent questions actually behave: An enterprise query isn’t always purely a “lookup” or purely an “enumeration.” Graded, descriptive levels show when a question straddles the line instead of collapsing it into one number.
  • Policy thresholds become deterministic rules: Instead of tuning an arbitrary float cutoff that drifts with prompt changes, our gate triggers enumerate mode cleanly based on which confidence level the decider selects.

6. The Last Mile: Resolving Look-Alikes & Committing to the Governing Record

Even with 99.3% retrieval delivery and a calibrated router, the final synthesis stage has to survive the minefield that killed 90% of other teams’ answers: choosing the single governing record among look-alikes.

When Opus 5.5 receives the ranked document pack (taking a median of 44 seconds in the submitted run), its primary job isn’t summarizing—it is adjudicating authority.

Consider what happens in Redwood Inference when a policy or metric changes:

  • An early Google Doc specification proposes a 30-day data retention window.
  • A Slack thread two weeks later debates whether 30 days violates a compliance requirement.
  • A finalized agreement or updated configuration record moves the window to 90 days.

If your retrieval stage drops the final record, you lose. If your retrieval stage surfaces all three and your answering model hedges (“Depending on the document, it is either 30 or 90 days”), the benchmark judge penalizes you for failing to commit or including invalid facts.

The same discipline applies to the 20 Info Not Found trap questions. When the corpus contains plausible nearby documents that never actually answer the specific constraint being asked, a model that tries to be “helpful” by guessing from partial evidence gets zero credit. Committing cleanly to the single governing record—or issuing an unambiguous refusal when the evidence isn’t there—is exactly where Opus 5.5 -high earned its +3% uplift over -med.


7. By the Numbers: Scorecard, Speed, and Fast Mode

When I talk to engineering leaders and founders, two questions always follow any accuracy claim: “How fast is it?” and “What does it cost?”

Here is the full performance profile from our submitted 500-question run (Opus 5.5), pulled directly from SQLite, alongside our Fast Mode latency profile:

MetricLatest RunWhy It Matters
Combined Score (Corr × Comp)94.24+1.0 point above the top published leaderboard score (93.24)
Correctness97.0%Only ~15 misses across 500 adversarial enterprise questions
Completeness95.88%Captures required supporting facts without hedging
Retrieval Delivery Recall99.3%737 of 742 gold docs passed to the answering agent (3 of 5 missed recovered in enumerate mode)
Final Cited Recall97.46%Post-arbitration evaluated recall (beats leaderboard-high 96.69%)
Invalid Extra Docs0.93 / querySub-1.0 noisy citations—high recall without context pollution
Submitted Run Latency (p50)68.0 secFull accuracy ceiling (Opus 5.5 + Monty Sandbox on enumerate queries)
Fast Mode Latency (p50)22.0 secProduction-speed profile—more than 2× faster end-to-end
Average Cost (Submitted Run)~$0.70 / queryDominated almost entirely by the final Opus 5.5 synthesis call

The Speed Story: 68-Second Benchmark Mode vs. 22-Second Fast Mode

In the submitted benchmark run (Opus 5.5), our 68-second median breaks down roughly:

  • ~3.0s — Gates & Routing Prep: Question-type gating and routing (with Perplexity Decider 1.2 itself taking just 0.3s).
  • ~21.0s — Hybrid Search: High-recall, low-noise retrieval across 511,962 documents.
  • ~44.0s — Synthesis / Enumerate Loop: One-shot Opus 5.5 synthesis or the Monty sandbox code-loop for counting/enumeration queries.

Sixty-eight seconds is great for an asynchronous deep-research benchmark, but interactive enterprise search needs to feel snappy.

That’s where Fast Mode comes in—delivering answers in a 22-second median. Fast Mode relies on the exact same question-type gate (sending most queries straight to one-shot synthesis while reserving the code-loop for true enumeration tasks), and its speed is dominated by model selection: in our fastest Fast Mode configuration, lightweight frontier models like Muse Ember / Muse Spark produced reliable answers very quickly over the clean context handed to them by the search layer.

Because the search engine does the heavy lifting upfront—delivering 99.3% of the required documents with fewer than one invalid extra document per query—the pipeline doesn’t need a 44-second reasoning marathon just to stay accurate. You get a clean dial to tune latency and cost for interactive user queries (22s) or crank it up to Opus 5.5 (68s) for maximum benchmark precision, without rebuilding the underlying engine.

What About the Final 3%?

At 97.0% correctness on a 500-question benchmark, there are only ~15 misses left across half a million documents. They fall into two main buckets:

  1. Under-Specified Questions & Judge Variance: As both Codos and PipesHub noted in their post-mortems, roughly 6 to 10 questions in the benchmark are genuinely under-specified (where two interpretations of a vague prompt point to two valid document clusters), and LLM-as-a-judge scoring carries ~1–1.5% natural variance.
  2. Look-Alike Arbitration & The Residual Retrieval Tail: The narrow ~1.8% gap between the 99.3% of gold docs delivered to the agent and the 97.46% ultimately cited—plus the 2 remaining documents out of 742 that evaded both initial search and enumerate mode.

8. Four Takeaways for Building Production AI Systems

Building a system that beats the top published scores on EnterpriseRAG-Bench taught me that the gap between a 60% demo and a 97% production-grade system has almost nothing to do with “magic prompts.” It comes down to disciplined software and systems engineering:

  1. Instrument First, Optimize Second: If you are still debugging multi-step AI workflows by scrolling through .txt logs or terminal output, you are flying blind. Spinning up a structured SQLite telemetry database on Day 1 lets you treat failure analysis as a data query rather than a guessing game.
  2. Make Stochastic Pipelines Deterministically Replayable: When frontier reasoning calls cost $0.70 a pop, end-to-end re-runs are an anti-pattern. Designing incremental stage-gates that can be stopped, inspected, and replayed from SQLite snapshots eliminates upstream variance and saves thousands of dollars in wasted compute.
  3. Treat Search as the Core of the System: Retrieval is the ceiling on everything downstream—accuracy, cost, and speed. Combining lightweight entity extraction, intelligent segmenting, multiple specialized vector indexes, and BM25 lexical fusion delivered 737 of 742 gold documents (99.3%) to the agent with fewer than one noisy document per query, unlocking both our 94.24 submitted score and our 22-second Fast Mode.
  4. Calibrate Your Routers and Earn Your Latency: Not every query needs a code-execution sandbox, and not every router should threshold a bare probability. Using a 0.3-second decision model with descriptive confidence levels lets you fast-track one-shot lookups while reserving the Monty sandbox enumerate loop (with its search and tally tools) for the problems where it actually moves the needle.

I built this system to push the ceiling on enterprise retrieval and agentic reliability. I’m currently exploring Founding AI Engineer, AI Research, Principal/FDE roles, or strategic partnerships with teams tackling hard search, retrieval, and agent infrastructure problems—if you’re building in this space (or want to talk shop about how to take your retrieval past 99%), I’d love to chat at [email protected].