Knowledge Compilation
An ingestion-time layer that uses LLMs to enrich source documents with context no single chunk contains — atomic claims with verbatim evidence, entity relations, timelines, ontology labels, synthesized articles, durable memory — and stores each result as a typed, versioned artifact linked to the exact source spans it came from. Retrieval then consumes those artifacts instead of raw text. Defined in Context as Infrastructure - Knowledge Compilation for Retrieval in Agentic Systems with Harnesses (InfiniFlow, 2026), and implemented in RAGFlow.
Not the classical sense
The name follows the “LLM wiki” pattern of compiling a corpus into a maintained, linked artifact that is read instead of retrieved. The paper explicitly distinguishes it from the formal knowledge-compilation tradition, where a logical knowledge base is compiled into a target language on which queries become tractable.
Supply, control, interface
The paper’s architecture splits three roles:
- Compilation is the supply side — what context exists, compiled once, upstream of queries.
- The harness is the control side — which artifact, if any, enters the window and when the loop stops (Search Strategy Optimization).
- Tools are the contract between them.
Compilation is explicitly not a better retriever: it does not choose queries, rank candidates, or decide when to stop.
The pipeline
Six stages, each replaceable:
- Parse — PDF, Office, HTML, Markdown, tables, logs into a canonical form keeping headings, lists, tables, page anchors.
- Chunk — at natural boundaries. “The chunk is a unit of recall, not a unit of meaning”; no template needs its own chunk size, and the uncompiled baseline sees the same chunks.
- Enrich — a model reads each chunk in document context and emits artifacts (in the paper, glm-4-flash; no frontier model was needed).
- Validate — evidence spans against the source, entity types against the ontology, dates against the document. Invalid units are dropped, not repaired.
- Assemble — cluster claims into a carrier tree, resolve entities into a graph, order events into a timeline, link articles into a wiki.
- Register — store each artifact with source version, offsets, extractor version, validation status and access labels, which makes fallback, citation, audit and incremental update possible.
Templates (Tree, Graph, Ontology, Wiki, Timeline, Mind-map, Memory) share the parser, validator and registry, so one corpus can carry several artifacts and switch between them without re-ingesting.
Channel separation
Raw and derived channels stay separate: derived artifacts are read-only, typed and never written back into the source. A model reading a claim can fall back to the original text, and an auditor can see the claim is a derived object. This blocks the most common failure of LLM-maintained corpora — a generated summary becoming the source for the next generation.
Two ledgers
The paper judges each artifact on the ledger it is built for:
| Artifact | FRAMES result | Claimed deployment value |
|---|---|---|
| Claim-leaf navigation tree | accuracy neutral, tokens −38% | token cost, audit, organization |
| RAPTOR / PageIndex trees without claim leaves | neutral; PageIndex negative at scale | organization only, no evidence value |
| Entity–relation graph | neutral | related-source discovery, compliance |
| LLM wiki | neutral | onboarding, documentation |
| Ontology, timeline, mind map, session memory | not measured | governance, temporal orientation, briefing, continuity |
The deployment column is a pre-registered measurement protocol, not a result: at the time of writing no row had an observation. Only the claim-leaf tree has a measured effect — see Verified Evidence and Evidence Sufficiency.
Agent-native database
The authors’ name for a compilation layer plus harness: a store that supplies the agent with “the smallest sufficient set of verified facts”, compiled once, reused across queries and sessions, and governed like data — rather than returning a ranked list of passages. They are explicit that it is not a relational database and not a new retrieval paradigm.
Related Concepts
- Verified Evidence · Evidence Sufficiency · Search Strategy Optimization
- Context Engineering — compilation is a corpus-level, query-independent form of it
- Prompt Compression — query-time context reduction; compilation pays its compression once and keeps a pointer to the source span
- GraphRAG — the paper’s graph artifact deliberately avoids community reports
- Text Chunking · RAG · Agentic Search