Context as infrastructure · an interactive reading

Keep search; compile what the agent reads into source-bound evidence

RAGFlow separates reusable evidence supply from query-time control. Its measured benefit is less reading—not better tree search, guaranteed truth, or automatically lower latency.

Read the original paper · PDF
Zhichang Yu and colleagues · InfiniFlow and East China Normal University

Maya found the policy. Why is the answer still expensive?

Maya maintains an agent answering retention-policy questions. In our tiny teaching corpus, Atlas says Atlas logs: 30 days. and Billing says Billing logs: 90 days. She asks: How long does Atlas retain logs?

In the paper’s much larger FRAMES setting, the uncompiled harness already reaches 91.0% accuracy while averaging 324,479 tokens per query. Table 4

Finding the document does not determine how much the agent reads. An undisciplined loop can repeat searches, reopen documents, and accumulate unused passages. Abstract; §1

Maya wants a smaller reading bill without replacing working search or losing the original policy.

What controls an iterative retrieval loop?

An agent can search, read, rewrite the query, and search again. The harness owns that loop and its stopping rules; retrieval need not be a single lookup. §1

Keep search; change the reading object

Compile query-independent, source-bound claim–evidence units upstream, then let a budgeted harness substitute them for lexically located chunks, admit them only when judged sufficient, and fall back to raw text otherwise. §3.1; §4.1; E2; §6.3

Keep the search that already finds useful text. Change what the agent reads: store compact claims beside exact quotations and source pointers. A separate harness decides whether that evidence is enough.

Before Maya asks anything, the compiler stores Atlas retains logs for 30 days. with the exact quotation Atlas logs: 30 days. and A/v1/[0,20). A locate result for Atlas can supply this record instead of the raw chunk. Acceptance can answer from evidence; rejection removes the prefetch and permits raw reading.

Reusable compilation, not query-time compression

Unlike query-time prompt compression, compilation is corpus-level and query-independent: pay once, reuse the representation, keep exact-source pointers. The structural comparison changes leaf content, not the retrieval hierarchy. “Knowledge compilation” here is not the formal-logic usage. §2.2; §5.1

Keep raw and derived channels separate

Derived artifacts are typed, read-only, and never written back into sources. This keeps original-text fallback possible and avoids silently making a generated summary the source for the next generation. §3.4

Supply, project, admit, bind

At ingestion, glm-4-flash proposes claims and quotations. Exact matching drops unlocatable pairs; a registry retains versions, offsets, validation status, and access labels. §3.2; Extract; Validate

Separate evidence supply and query control Ingestion bandINGESTION · query independent Preserved sourcesRaw sources remain unchangedA/v1 · Atlas; B/v1 · Billing Source supplies proposalsproposes Enrich and exact span checkProposals → exact span checkKept: source-located proposalsDiscard: absent quotationAbsent quote is not repaired Validation supplies carrier leavesassembles Carrier treeCarrier root → labeled leavesStored units; no query route Carrier registers lineageregisters Versioned registryRegistry · source/version/offsetsSource-bound evidence recordsRead-only derived channel Query bandQUERY · lexical finding, not tree routing Lexical recallLocate Atlas lexically Recall locates chunkslocates Chunk-anchored evidence substitutionProjector looks up stored evidence Projector looks up units for admissionlooks up → offers Harness admission gateEvidence gateSupplied accept Gate admits or discardsadmitsdiscards Discard then raw fallbackDiscard → opens rawFallback available Admitted evidence delivery pathEvidence-only pathAdmitted source units Delivered paths bind citationsdelivers Delivery bindingCitation binds delivered sourceCandidate answer with live lineage Unresolved semantic sufficiency and supportEnough evidence? Claim supported? Not proved here.

Exact matching keeps source-located units and drops the invented quotation.

Notice: search still finds Atlas; compilation changes the reading object, and the harness controls admission. Teaching fixture, not a token-cost model.

Enrich and validate: propose atomic claims; locate their copied support. Extract; Validate

Register: store lineage and versions in a content-addressed store. §3.2; Supply layer and harness

Navigation tree: embedding clusters organize labels above evidence leaves. It is not the query-time retriever. Assemble

Lexical recall: BM25/grep over chunks plus lexical claim-text recall. No measured serving condition exposes a dense leg. Systems; Recall ablations

Projector: chunk identifier in, stored evidence units out. E2

Evidence gate: count, source diversity, and question coverage inform admission. The five stations

Tool loop: after rejection, admissible actions run in parallel under step and wall-clock budgets. The five stations

Citation binding: identifiers assigned at delivery must resolve to delivered evidence and a live source version. §6.4; Supply-layer seam

The full pipeline and the outer harness

Parse → chunk → enrich → validate → assemble → register. Templates share parser, validator, and registry; baseline and compiled arms use the same parser/chunker. Changed chunks can be re-extracted incrementally. §3.2; Cost

The five stations are capability check, corpus-wide flat evidence prefetch, evidence gate, budgeted tool loop, deterministic close. Capability checks hide unsupported tools. Abnormal termination still produces an answer from available evidence or an explicit failure. §6.3–6.4

E1, E2, E3—and where embeddings belong

E1 recalls evidence directly with lexical search. E2, the default, substitutes evidence after localization. E3’s lightweight Qwen decision model controls deep reading, not candidate ordering. Claim embeddings organize ingestion-time clusters; that is not vector search at query time. Assemble; §4.3

Trace one answer, including the rejected extraction

Atlas’s raw text says “Atlas logs: 30 days.” The extractor proposes the quotation “Atlas logs: 60 days.” What will be stored for that proposal?

Teaching fixture, not a paper experiment. Both raw sources are current. Search is fixed to Atlas and the supplied gate verdict is accept. Here are the actual records:


  1. Validate proposed quotations against their named source.
  2. Register surviving records and organize their leaves.
  3. Locate Atlas with the fixed lexical fixture.
  4. Project Atlas’s evidence.
  5. Admit under the supplied verdict.
  6. Bind the delivered evidence to a current source.

The source-located Atlas record supplies a candidate answer without raw fallback.

Offsets are not token savings

Offsets are half-open character intervals: start included, end excluded. These literal strings are already tiny. Neither their character lengths nor their unit counts demonstrate compression or reproduce the paper’s token percentages.

Reject the block—not just its answer

The gate rejects Atlas’s prefetched [U1] block. What enters the next tool-loop prompt from that rejected block?

Same locate result, different reading payload

Both sides receive Maya’s Atlas question and the same locate result [A].

Without compilation

Read raw Atlas: Atlas logs: 30 days. It is already short in this fixture; no compression benefit is asserted.

With substitution

Look up the Atlas unit; acceptance avoids raw reading.

Rejection removes the block before the raw fallback read.

One difference: the reading payload changes, not the located source. E2; §6.3–6.4

Organized pointer versus evidence-bearing leaf

Input on both sides: the same located Atlas chunk and underlying text.

Carrier only

Organization or a pointer, but no stored claim with supporting quotation.

Carrier with evidence

A chunk-keyed lookup can return the Atlas claim, its exact quote, and its source pointer.

One difference: evidence-bearing leaf content—not a more accurate hierarchy—supplies the reading object. Assemble; §5.1; Table 3

Zero hits do not establish absence

A zero-hit result is a tool observation, not a fact about the corpus. Relax filters, try raw lexical search, or widen the time window before concluding silence. Diagnostic messages never receive citation numbers. The zero-hit principle

Make the checks pass while the claim fails

Admission says a block entered the context. Citation binding says delivered evidence resolves to a source. Neither guarantees truth. §8.6

Existence is not entailmentNormalized claim disagreesNormalized claimClaim disagrees with quotationExact supporting quotationQuotation found · span check passesExact original quotationResolved source pointer and admissionLive source pointerGate admitted · lineage resolvesUnanswered support and real-world truth questionsClaim supported? Source true? Unchecked.
Our inference: a source pointer can resolve perfectly while the normalized claim misstates its quotation. This is a logical teaching counterexample, not a paper failure-rate measurement.

Goal: produce an evidence-only answer, a raw fallback, and a source-linked answer that should not be trusted. Explain which check distinguishes each.

Teaching sandbox · no token estimates
Try these changes
  1. Keep valid; reject. Same candidate, different reading path?
  2. Remove Atlas extraction; leave accept. Does fallback preserve access?
  3. Admit the misleading claim. Which check is missing?
  4. Make the valid accepted source stale. Should anything be released?

Invariants: quotations must be locatable; rejected prefetch is absent from admitted context; delivery requires a current delivered-source binding. These rules alone do not establish truth. Validate; §6.4; Supply-layer seam

What the sandbox deliberately does not simulate

Parsing, extraction, clustering, search ranking, and answering are fixed fixtures. The admission verdict is supplied by you—not a semantic judge. Empty blocks always fall back. Fallback is one successful raw read, not a real parallel, budgeted multi-turn loop. That raw read is a delivered source record, not a newly extracted claim unit. Permissions stay allowed; updates, abnormal stops, and shadow evaluation are not simulated. The two short chunks demonstrate no compression ratio.

The false-accept audit remains unfinished

Acceptance is observable without labeling whether evidence actually suffices. The paper specifies a stratified labeled audit but has not run it at benchmark scale; it reports no measured false-accept value. A high acceptance rate or low token cost cannot fill that gap. §8.6; The minimum audit; §8.8

Name the records; price the reuse

The paper considers 1,000 future queries, compilation cost of 10 baseline-query equivalents, and 2.5% acceptance. What does its finite token model recommend?

Occasional large savings can outweigh frequent small penalties. But compile-once still means pay once: enough future queries must recover that expense. A baseline-query equivalent is the token cost of one uncompiled query. Amortization; The no-compile boundary

κ:𝒟⟶𝒜={a1,…,am}\kappa:\mathcal D\longrightarrow\mathcal A=\{a_1,\ldots,a_m\}

Compilation transforms a corpus into reusable typed artifacts before queries arrive. Eq. (1), §3.1

SymbolMeaning → worked example
κ\kappaCompilation → fixture validation, assembly, registration.
𝒟\mathcal DCorpus → raw A and B.
𝒜\mathcal AArtifact set → the registered carrier containing the surviving units.
a1,…,ama_1,\ldots,a_mIndexed artifacts → the toy has one carrier artifact, not one artifact per unit.

This names the ingestion state after trace step 2.

u=⟨c,e,s,τ⟩u=\langle c,e,s,\tau\rangle

A stored unit combines a normalized claim, exact support, a source location, and validity metadata. Eq. (2), §4.1

SymbolMeaning → worked example
uuClaim–evidence unit → U1.
ccNormalized claim → Atlas retains logs for 30 days.
eeVerbatim span → Atlas logs: 30 days.
ssChunk and offsets → A/v1/[0,20); version is registered separately.
τ\tauValidity metadata → current at the fixture snapshot; no document date supplied.

The claim and quotation are separate fields, as in trace steps 1–2.

𝔼[Δ]=ph(−0.91)+(1−ph)(0.019)=0.019−0.929ph\mathbb E[\Delta]=p_h(-0.91)+(1-p_h)(0.019)=0.019-0.929p_h

The paper’s token model weights a large accepted-branch saving and a small rejected-branch penalty by acceptance rate. Eq. (4), §4.4; Table 4

SymbolMeaning → relation to Atlas
𝔼[Δ]\mathbb E[\Delta]Expected fractional token change against uncompiled cost; not measured in the toy. Negative means saving.
php_hGate acceptance rate, not correctness probability; a single trace does not estimate it.
−0.91-0.91Reported accepted-branch change; not a token count assigned to U1.
0.0190.019Reported rejected-branch change; not the cost of the toy raw read.
0.9290.929Sum of saving magnitude and miss penalty; fixed model coefficient.

These empirical query-level inputs price the branches at trace step 5, not the toy’s record sizes.

B(Q,c,ph)=Q(0.929ph−0.019)−cB(Q,c,p_h)=Q(0.929p_h-0.019)-c

Finite-deployment token benefit subtracts upfront compilation expense from accumulated query savings. Positive benefit means saving after compilation. Eq. (8), The no-compile boundary

SymbolMeaning → paper’s economic example
BBNet benefit in baseline-query equivalents → a reported loss of 5.8. Not measured for Atlas.
QQFuture queries → 1,000; not set by the single Atlas trace.
ccCompilation expense → 10 query-equivalents; not the normalized claim in the unit equation.
php_hAcceptance → 2.5%; not estimated by Atlas.
0.929,0.0190.929,\;0.019Conditional-cost coefficients; no latency term.

This prices the decision to build reusable units at all. It is a calculation, not another experiment.

Implied acceptance and payback—not truth rates

The reported −38% average implies near-43% acceptance under this model, not independently measured true sufficiency. At approximately 43%, the paper calculates that compilation costing ten query-equivalents pays back after about 26 queries. Eq. (6); Amortization

Our reading of the sign convention: the amortization prose contains a sign inconsistency. We use the paper’s finite-benefit equation above, where savings are positive, rather than treating negative token change as positive net saving directly.

Three comparisons, not one speedup

Table 4’s token/accuracy results use 200 FRAMES questions, official answer protocol, and an LLM judge. The answering model is fixed. The uncompiled BM25/grep baseline reports 91.0% accuracy, 324,479 average tokens, and 46.7 s latency. §8.1; Table 4

Conditioning matters: accepted queries are a subset, not the full-query average. An arm mean is another comparison again. No reliable accuracy change is not proof of equal accuracy.

Separate token and latency comparisonsToken changes relative to uncompiled harnessQUERY TOKENS · vs uncompiled0%AcceptedAccepted evidence saves 91 percent−91%RejectedRejected evidence adds 1.9 percent+1.9%FRAMES averageFRAMES average saves 38 percent−38%Separate latency comparison with evidence presentLATENCY · evidence presentNo decision gateNo decision gate takes 140 seconds140 sDecision gateDecision gate takes 30 seconds30 sSmall substitution ablation is separateServing ablation · seven successful pairsRoughly half the tokens;roughly triple the latency.

Token panel: accepted/rejected are gate-defined splits; the average covers all evaluated FRAMES questions (N=200 for the main token/accuracy measurements).

Latency panel: a separate gate comparison with claim-leaf trees present; gate-arm query counts are not reported separately. The seven-pair serving ablation is not the 200-question headline comparison.

Notice: 140→30 s does not show that substitution alone makes answers faster. Figure 2; Table 4; §8.4–8.5

Token substitution: −91% on accepted evidence, +1.9% on rejected evidence, −38% overall; accuracy is “no reliable change/gain.” These are descriptive operating points, not confidence-bounded population effects or established accuracy equivalence. Near-43% acceptance is model-implied. Table 4; §4.4; §8.8

Substitution’s latency cost: seven jointly answered questions, with one failure in the uncompiled arm. Smaller pages needed more retrieval rounds; tokens roughly halved while latency roughly tripled. This small paired ablation is not a precise population estimate. The latency cost of substitution

Decision-gated reading: with evidence, 140→30 s and an arm-mean −52% tokens (155,305 average tokens); without evidence, −30% tokens. Neither arm mean can be compared directly to −91% accepted or −38% overall. Arm-specific counts are unreported. Table 4; §8.5

Structural audit: directions, not a leaderboard

On full FRAMES, each variant ran once. RAPTOR summaries, wiki, and graph were neutral; PageIndex was neutral at small scale and harmful at FRAMES scale. Claim leaves were accuracy-neutral but reduced reading. “Neutral” excludes neither small effects nor gains elsewhere. The wiki was expensive to build and lost verbatim provenance; summaries consumed a turn before grep; outlines could misroute. Table 3; §8.2

Serving settings and what their ablations establish

Retained: topN=20, k=100k=100, both chunk-anchored and claim-text lexical legs, no count-based truncation. Anchor depth 10→20 improved hits; 30 added no gain. Caps 16 and 32 reduced recall; the larger page did not reduce rounds. The paper gives directions, not hit counts. Recall ablations; Page composition ablations

BrowseComp-Plus is not a compilation experiment

The harness-only scale check reports 85.0% accuracy at approximately three million tokens per question with BM25, grep, and MiniMax M3. It neither validates compilation savings nor provides a score directly comparable with FRAMES. Table 4; §8.7

Other artifacts have other consumers

Ontologies provide classes, properties, constraints, and vocabulary mappings. Graphs resolve entities and relations; PageRank ranks chunks whose evidence is fetched first. Wikis synthesize prose, timelines order events, mind maps orient navigation, and memory keeps durable session state. These functions are not additional facts or demonstrated production gains. §5.2; Table 1

What the results do not show: every deployment-ledger outcome remains “no measured effect”; no row has met its pre-registered instrumented target. Named metrics and architectural plausibility do not demonstrate ontology, graph, wiki, timeline, or memory commercial value. Audit coverage is an invariant, not a completed deployment result. Table 2; §5.3

What would justify shipping this?

Measure in shadow before enforcing a gate

On hash-bucketed traffic, compute and log decisions without enforcing them; queries proceed through the uncompiled path. This preserves outcomes hidden by enforcement. Promote only when the accepted branch is non-inferior in accuracy and meets a token or latency target. Otherwise, remain a logger. Shadow comparison

For production artifacts, compare the same collection or reviewer team under shadow/A/B conditions, pre-register targets, and require resolvable current-source spans for all delivered claims. Otherwise block delivery. Table 2; §5.3

Open questions

Explain it, transfer it, find the boundary

Answer each in your head before opening it.

1 · Reconstruct the mechanism

After search finds Atlas, trace acceptance and rejection. What is delivered, and what must be removed?

Answer and reasoning

Accepted: look up Atlas’s unit, admit and deliver it, bind its current span, no raw read. Rejected: remove the whole prefetch and its citation entries, enter the budgeted tool path, and bind subsequently delivered evidence. The compiler supplies records; the harness owns admission and fallback. E2; §6.3–6.4; Supply-layer seam

2 · Transfer to a new policy

A source says “Export is allowed only after approval.” The exact quote is stored, but the normalized claim says “Export is allowed.” Which checks can pass? What is missing?

Answer and reasoning

Our inference: the quote can pass exact matching and the source/version pointer can resolve. A permissive admission verdict could accept it too. None detects removal of the approval condition. A support/entailment check preserving that qualification is missing: existence and lineage are not logical support. Validate; §8.6

3 · Predict a cost change

Hold acceptance, conditional token costs, and query horizon fixed. Double compilation expense. What happens to finite benefit and the acceptance requirement? Why might token profitability still not justify shipping?

Answer and reasoning

Net benefit falls by the added expense; the required acceptance rate rises. Extra-round latency or an unmeasured false-accept problem can still block shipping. The token expression subtracts upfront cost but includes neither a correctness guarantee nor a latency guarantee. Eq. (8); §8.6; When compilation pays

Compact glossary
Knowledge compilation
Query-independent production of typed, versioned artifacts with exact-source lineage; not the formal-logic usage. §2.2; §3.1
Search harness
Program owning the query, read, reformulate, and stop loop and its operational rules. §1; §6.3
Claim–evidence unit
Normalized claim, verbatim support, source location, and validity metadata stored together. §4.1
Carrier tree
Organizes evidence leaves under navigational labels; not the retrieval mechanism. Assemble
Evidence substitution
A located chunk’s payload becomes stored evidence units before admission, with raw fallback. E2
Decision-gated reading
A lightweight model decides whether to deep-read, not how to rank candidates. E3
Acceptance rate php_h
Fraction of queries with admitted prefetch, not a truth rate. §8.6
Query-equivalent compilation cost
Upfront expense in multiples of baseline-query token cost. Cost cc is not the claim field cc. Amortization
Two ledgers
Benchmark accuracy/tokens/latency and production usefulness are evaluated separately. Production has no qualifying outcomes yet. §3.3; §5.3
Ontology
Classes, properties, constraints, and vocabulary mappings; distinct from concrete entities and relations in a graph. §5.2