Awesome Testing

RAG lesson 02 · Build the evidence corpus

How should documents become retrievable units without losing meaning or authority?

Versioned evidence corpus · deterministic retrieval fixtures

Lighthouse Policy Evidence Assistant. A fictional support assistant answers questions from a versioned product-policy corpus. It must retrieve current, authorized evidence, cite exact source spans, and abstain when evidence is missing or conflicting.

01 · Smallest useful mechanism

Preserve document structure, provenance, and lifecycle through ingestion.

Parsing and chunking decide which facts coexist, which headings survive, and whether a retrieved span can be traced back to an authoritative source. Stable identities and deletion propagation matter as much as token size.

A chunk is a derived evidence unit, not an anonymous bag of tokens.

02 · Experiment

Test the prediction

Deterministic retrieval fixture

This workbench uses inspectable ranking and evidence fixtures and injected failures. It does not make live calls or execute external effects.

Retrieval workbench · lighthouse-chunks-v2

Choose the chunk build that keeps a policy rule and its exception auditable.

Injected failure

The exception begins 12 tokens after a fixed 800-token boundary; the previous version must also be deleted from search.

Choose the implementation

The trace has not run.

Commit to an implementation, then inject the failure and inspect the actual state transitions.

03 · Implementation brief

Build it, break it, prove the outcome.

Implement
Define a chunk record, build manifest, stable ID rule, parent-child strategy, and deletion propagation path.
Break it on purpose
Split a rule from its exception, add repeated headers, change one ACL, replace the source, and delete the previous version.
Completion evidence
Golden fixtures preserve the clause, every chunk reconciles to one source span, access changes propagate, and no deleted chunk remains searchable.

Your learning artifact

Write the argument you would defend

Stored only in this browser. No account required; course reset does not delete it.

04 · Check your understanding

Which property makes a retrieved chunk usable as audit evidence?

Primary sources · verified 2026-08-02

What the fixture does not prove

Naive fixed windows can separate exceptions from rules, duplicate evidence through overlap, leak headers across tenants, and leave deleted content searchable after the source changed.

Common mistake: There is one universally optimal chunk size. Useful granularity depends on document structure, query type, embedding model, reranker, context budget, and the evidence span required by the product claim.

Transfer exercise: Split one policy by fixed tokens, headings, and parent-child sections; inspect which strategy keeps the exception attached to its rule.

Optional referenceDeep dive / reference chapterOpen the complete essay, diagrams, mathematics, exercises, glossary, and sources when you want more depth.

Next: Once the corpus is trustworthy, candidate retrieval must combine lexical precision, semantic recall, filters, and query behavior without confusing scores.