SHEN YIFull-Stack & AI

Paris • Singapore • Shanghai

RAG Formation · Reference

Context assembly and evidence budgets

A standalone cheat sheet for learning and testing RAG quality on this site.

$ reference --status
▸ course RAG Formation
▸ mode standalone reference
▸ status Complete
● learn → test → verify

Reference sheet

Context assembly and evidence budgets

The guided RAG Formation course content is complete; this reference is available for self-directed practice.

One-line rule

A retrieved source is not useful evidence if truncation removes it before the model sees it.

Core terms

TermMeaning
Context assemblyTurning backend results into the text sent to the answering model — across four channels (summary/vector/fulltext/graph), each given a fair share of the budget by a max-min allocation algorithm.
Evidence budgetThe maximum context allowed by characters, tokens, latency, or cost.
Source survivalWhether the evidence needed for an answer is still present after formatting and truncation. Channel order is fixed (summary→vector→fulltext→graph) — budget fairness, not relevance ranking, decides how much of each survives.
Not the same path as Lessons 5–8--mode retrieval hits /api/v1/search (no fusion). --mode answer hits /api/v1/qa (real per-channel allocation) — this lesson uses the latter.

Evidence card

NeedRecordDon't claim
BaselineCommand, configuration, observed resultThe baseline is a target.
ChangeOne hypothesis or decisionYou can tell what caused the result when several things changed.
MetricPer question: answer.stats.context_chars_by_index, .context_items_included/.context_items_dropped, .context_hard_truncated, answer.sources and .source_hit.all. For multi-hop, check context_chars_by_index.graph first.One metric tells you everything about quality.
SafetyA failure and a regression caseA fluent answer proves the system is reliable.

Local command

cd demo
python3 eval.py run --mode answer --workspace meridian_demo --category multi_hop --tag lesson-09-context

Artifact: An evidence-survival map for one multi-hop answer, plus a bounded context-budget recommendation.

Continue learning: Open the matching standalone lesson · Course roadmap