Synthetic RAG benchmark · v1

How we test RAG retrieval.

We scored an offline RAG baseline on synthetic contracts, policies, and support questions, measuring which sources it found, cited, or withheld.

Measured results

What did the baseline get right?

We ran 24 hand-labeled questions against 18 synthetic documents using three roles. Seventeen questions had an expected answer and seven called for abstention.

These scores describe the keyword retriever and its verbatim excerpts on this test set. All three access-denied cases withheld the restricted source and abstained. Each blocked source would have ranked in the unfiltered top three.

  • 16 of 17 (94.1%) had all expected sources in the top three.
  • 14 of 17 (82.4%) returned all expected answer phrases.
  • 14 of 17 (82.4%) returned the exact expected citation set.
  • 24 of 24 (100%) returned only sources allowed for the reader’s role.
  • 5 of 7 (71.4%) correctly returned neither an answer nor a citation.

Scoring rules

How did we run and score the evaluation?

Each case fixes the question, role, and expected outcome before the run. Only the scorer uses the expected evidence.

Filter and rank

Filter documents by role before ranking. Lowercase and tokenize the question and each source title and passage, remove common words, and count shared unique terms. Keep up to three positive matches in descending score order, breaking ties by document ID.

Answer or abstain

Return the highest-ranked passage verbatim with its source ID when at least two terms match. Otherwise return no excerpt and no citation.

Score answerable cases

Complete retrieval requires every expected source in the top three. The answer must contain all labeled phrases after lowercasing and tokenizing both texts. The citation set must match the expected source IDs exactly.

Score access and abstention

Check access on every case. All retrieved and cited sources must be allowed for the role. For a case labeled abstain, both the answer and citations must be empty.

Observed failures

Where did the baseline fail?

Each example shows the case label, expected evidence, and what the runner actually returned.

A superseded policy outranked the current one

C01 · Contracts role
What is the deadline for compliance review before contract renewal?

Expected · 30 calendar days from CTR-02.

Observed · The current policy ranked second. The older CTR-01 ranked first with five matching terms and supplied the answer of 20 business days.

A paraphrase missed the relevant policy

P06 · Operations role
When my credentials are stolen, what do I do to lock the intruder out?

Expected · Revoke active sessions and notify the security desk per POL-06.

Observed · The retriever found zero matching sources and returned an empty answer.

Retrieval found both sources, but the answer used one

C06 · Contracts role
For enterprise contract renewal, what is the review deadline and where should the deal owner submit the ticket?

Expected · Give the 30-calendar-day deadline and name the legal queue, citing CTR-02 and CTR-06.

Observed · Both sources ranked in the top three. The excerpt cited CTR-02 and gave the deadline, leaving out the legal queue.

A related policy triggered an unsupported answer

P08 · Operations role
What is the customer data transfer approval exception for Antarctica?

Expected · Abstain. The corpus contains no such exception.

Observed · The baseline cited POL-02 and returned its general subprocessor approval rule. The excerpt did not address Antarctica.

Reproduce the results

How can I rerun the benchmark?

Download the runner. It includes the synthetic corpus, expected outcomes, and scoring code and runs offline with Python 3.9 or later using the standard library.

python3 rag-evaluation-v1.py.txt > results.json