LLM Wiki: Turning LLMs into a Knowledge Compiler

    This article explains why traditional RAG struggles to accumulate knowledge and introduces LLM Wiki, an approach that treats large language models as a knowledge compiler rather than a one-time retriever. It covers the three-layer architecture (Raw, Compiled, and Schema layers), four core operations (Ingest, Query, Backfill, and Self-audit), key engineering practices, and the scenarios where this approach fits best. Readers will learn how to build a maintainable, traceable knowledge base that grows continuously instead of rediscovering the same answers.

    1. The Problem: Why Traditional RAG Fails to Accumulate Knowledge

    Retrieval-Augmented Generation (RAG) has become the dominant pattern for LLM applications over the past few years. When a user asks a question, the system retrieves relevant fragments from a vector store or full-text index, stitches them into the context, and lets the model generate an answer. This flow is simple and direct from an engineering standpoint, but it has a structural flaw: knowledge is never consolidated.

    This shows up in three ways:

    1. Repeated discovery: When the same question is asked again, the system re-retrieves and re-reasons every time. Yesterday’s conclusion does not automatically become today’s input.
    2. Fragmented knowledge: Raw documents, meeting notes, and code comments are scattered across different systems with no explicit links between them, so the model only ever sees a partial view.
    3. No maintenance mechanism: Documents go stale, conclusions get overturned, and terminology shifts. The RAG pipeline itself is not responsible for corrections, so errors can stay hidden and keep getting retrieved.

    The core premise of LLM Wiki is to treat the large language model as a knowledge compiler rather than a one-shot retriever. The compiler continuously reads raw material and compiles, merges, deduplicates, and links it into a structured Markdown wiki that it outputs and maintains. Queries are answered directly from this compiled knowledge, and the arrival of new material triggers incremental recompilation. Knowledge management shifts from “repeated discovery” to “continuous growth.”

    2. Three-Layer Architecture

    A working LLM Wiki typically consists of three layers with strictly separated responsibilities.

    Layer 1: Raw Layer (immutable)
    Stores the original material users import: notes, PDF text, archived web pages, code snippets, audio and video transcripts. This layer is append-only and never modified. It preserves the source and an import timestamp, serving as a traceable factual baseline. Immutability is the root of trust for the whole system: any compiled conclusion can be traced back to specific source text.

    Layer 2: Wiki Layer (compiled)
    A collection of model-generated and model-maintained Markdown files. This is the actual knowledge carrier that gets queried. It contains topic pages, entity pages, a concept index, and cross-links. This layer may be rewritten, but every rewrite must be explainable by the Raw Layer.

    Layer 3: Schema Layer (rules)
    Defines the working rules: file naming and directory conventions, front-matter fields for pages, linking standards, how confidence is annotated, conflict resolution strategy, and conditions that trigger self-audits. The Schema is effectively the compiler’s grammar definition, and it determines the consistency and maintainability of the output.

    An illustrative page structure looks like this:

    1. ---
    2. title: Distributed Consistency
    3. type: concept
    4. sources: [raw/2026-04-12-notes.md, raw/2026-05-03-paper.txt]
    5. confidence: 0.8
    6. updated: 2026-07-20
    7. supersedes: []
    8. ---
    9. ## Conclusion
    10. Consensus algorithms cannot guarantee both safety and liveness in asynchronous networks.
    11. ## Evidence
    12. - See raw/2026-05-03-paper.txt, Section 3
    13. - Consistent with the constraint boundaries of [[CAP Theorem]]
    14. ## Disputes and To Be Verified
    15. - Engineering trade-offs under specific timeout assumptions have not been archived yet

    3. Four Core Operations

    1. Ingest
    When a new document enters the Raw Layer, the model extracts entities, assertions, and data points, retrieves relevant pages in the Wiki Layer, and decides whether to create a new page, append to one, or revise one. The key design property is idempotency: importing the same material repeatedly should not produce duplicate pages.

    2. Query
    A query first locates candidate pages, then expands context along the links, and finally generates an answer with a traceable path back to the Raw Layer. The difference from RAG is that the retrieval target is compiled, structured knowledge rather than isolated text chunks.

    3. Backfill
    Write newly produced conclusions back into the wiki: update page bodies, maintain cross-links, and mark superseded old conclusions (rather than deleting them outright), preserving the trajectory of how knowledge evolved.

    4. Self-audit
    Periodically scan for orphan pages, broken links, assertions with no source, long-stale entries, and contradictory statements, then generate a to-do list that drives fixes. Self-auditing is the critical step for preventing entropy growth in the knowledge base.

    4. Engineering Implementation Notes

    • Traceability first: Every assertion must carry a source identifier. Content without a source goes into a to-be-verified area rather than the main body.
    • Control compilation granularity: Compile in batches by topic. Rewriting the entire knowledge base at once leads to context overflow and quality variance.
    • Make conflicts explicit: Keeping old and new conclusions side by side with a supersedes relationship is safer than silently overwriting.
    • Permissions and isolation: Enterprise scenarios need knowledge domains divided by department or project, with access control enforced on both the storage and retrieval sides.
    • Keep costs under control: Incremental compilation, change detection, and caching can significantly reduce repeated inference overhead. The Raw Layer and indexes can be hosted on general cloud capabilities such as object storage, message queues, container platforms, log services, and monitoring and alerting, enabling asynchronous pipelines and observability.
    • Close the evaluation loop: Maintain a fixed set of questions and continuously measure answer accuracy, citation coverage, and knowledge base health metrics.

    5. Suitable Scenarios and Boundaries

    LLM Wiki fits scenarios where knowledge accumulates over the long term, the terminology system is stable, and auditability is required, for example personal research notes, enterprise policy and process documentation, legal and education knowledge bases, and design decision records for R&D teams.

    It is not a universal solution. For highly time-sensitive, fast-changing information such as real-time market data, online retrieval is still the right choice. For one-off, low-reuse Q&A, plain RAG is cheaper. In practice, a hybrid architecture is more common: LLM Wiki handles the consolidation of stable knowledge, real-time retrieval fills in the latest facts, and the two are orchestrated together at the query layer.