Tất cả báo cáo

LLM Wiki — Andrej Karpathy

Pattern xây dựng personal knowledge base bằng LLM — thay thế RAG với compounding wiki được duy trì liên tục.
Nguồn: GitHub GistCông bố: 4 April 2026Stars: 5,000+Forks: 4,711Kỹ thuật: 12

Tổng quan Intro

Đây là báo cáo tổng quan (lớp 1). Mỗi topic lớn có trang deep dive riêng — nhấn nút "Phân tích sâu" ở cuối mỗi section để xem chi tiết đầy đủ.

Ngày 4/4/2026, Andrej Karpathy — co-founder OpenAI, cựu Director of AI Tesla — đăng một GitHub Gist tên llm-wiki.md. Trong vòng vài ngày, bài này đạt 16 triệu lượt xem, 5,000+ stars và 4,711 forks, trở thành một trong những ý tưởng AI viral nhất năm 2026.

Ý tưởng cốt lõi: thay vì để LLM tái tạo kiến thức từ đầu mỗi lần bạn hỏi (RAG), hãy để LLM xây dựng và duy trì một wiki markdown có cấu trúc từ nguồn tài liệu của bạn. Wiki này tích lũy theo thời gian — mỗi nguồn mới được tích hợp vào những gì đã có, không phải đặt sang một bên để retrieval sau.

Obsidian graph view của một LLM Wiki với các entity pages được kết nối nhau qua wiki-links
Obsidian graph view sau khi ingest 5 papers. Node là entity pages, edge là [[wiki-links]]. Đây là knowledge graph được LLM xây dựng tự động. ↗ Data Science Dojo Tutorial
Pattern, không phải sản phẩm. LLM Wiki là một workflow pattern — không có server, không có database, không có embedding vector store. Chỉ là folder markdown files + LLM agent + CLAUDE.md schema. Bạn có thể bắt đầu trong 30 phút.

Bảng tóm tắt 12 kỹ thuật Overview

ID Kỹ thuật Theme
1 Compilation Metaphor Core Idea
2 Ba lớp kiến trúc Architecture
3 Three Operations Architecture
4 Index & Log Architecture
5 CLAUDE.md Schema Schema
6 Knowledge Lifecycle Memory
7 Knowledge Graph Scale
8 Hybrid Search Scale
9 Automation Hooks Automation
10 Folder Structure Impl
11 Use Cases Impl
12 Scaling Path Impl

RAG vs LLM Wiki Compare

AspectRAG (Traditional)LLM Wiki (Karpathy)
Knowledge persistenceNone — stateless, forgets every sessionFull — builds and compounds over time
Multi-doc synthesisPer query, rebuilt from scratchPre-compiled into interlinked pages
Contradiction detection❌ No✅ Yes — flagged during ingest
Source traceabilityHigh (chunk-level)Moderate (page-level)
Setup complexityLow (upload & go)Low-Medium (30 min setup)
Best forQuick Q&A on fixed docsDeep research over weeks/months
InfrastructureVector DB, embeddingsJust markdown files + LLM
Scale limitScales with infraindex.md tốt đến ~200 pages; hybrid search cho hơn
Khi nào dùng RAG thay vì LLM Wiki: Khi data thay đổi hàng ngày hoặc cần exact source traceability cho mọi claim. LLM Wiki tốt hơn khi bạn đang build expertise trên một topic qua nhiều tuần/tháng và muốn model reason across knowledge base, không chỉ retrieve.

Core — Kiến trúc & Operations Architecture

1. The Compilation Metaphor

1
Gist: llm-wiki.md — The core idea
Tại sao đây là insight quan trọng nhất. Karpathy đặt ra một metaphor rõ ràng giúp giải thích toàn bộ pattern: thay vì "retrieval", đây là "compilation". Một khi bạn hiểu metaphor này, mọi thứ còn lại trở nên hiển nhiên.

Vấn đề với RAG

Hầu hết mọi người trải nghiệm LLM + documents theo kiểu RAG: upload files, LLM retrieve relevant chunks khi query, generate answer. Cơ chế này hoạt động, nhưng LLM đang re-discover knowledge từ đầu mỗi câu hỏi. Không có accumulation. Hỏi câu hỏi cần tổng hợp 5 tài liệu → LLM phải tìm và ghép fragment mỗi lần.

Compilation: compile once, query many times

RAG (Retrieval): Query ──▶ Vector Search ──▶ Chunks ──▶ LLM ──▶ Answer Query ──▶ Vector Search ──▶ Chunks ──▶ LLM ──▶ Answer (lặp lại mãi) Query ──▶ Vector Search ──▶ Chunks ──▶ LLM ──▶ Answer LLM Wiki (Compilation): Source ──▶ LLM Ingest ──▶ Wiki Pages (persistent) Source ──▶ LLM Update ──▶ Wiki Pages (growing) Query ──▶ Read Index ──▶ Wiki Pages ──▶ Answer (fast, rich)

Cũng giống như compiler: source code không được execute trực tiếp mỗi lần — được compile thành optimized binary. Compilation tốn kém nhưng bù đắp qua mọi lần execution tiếp theo.

Key insight của Karpathy: "The wiki is a persistent, compounding artifact. The cross-references are already there. The contradictions have already been flagged. The synthesis already reflects everything you've read."

2. Ba lớp kiến trúc

2
Gist: Architecture section
Ba lớp tách biệt rõ ràng trách nhiệm. Sự phân chia này đảm bảo raw sources không bao giờ bị corrupted, wiki luôn có structure nhất quán, và LLM biết chính xác phải làm gì.
┌─────────────────────────────────────────┐ │ Layer 1: Raw Sources (IMMUTABLE) │ │ PDFs, articles, notes — bạn curate │ │ LLM chỉ ĐỌC, không bao giờ MODIFY │ └────────────────────┬────────────────────┘ │ ingest ▼ ┌─────────────────────────────────────────┐ │ Layer 2: The Wiki (LLM-OWNED) │ │ Markdown pages, entity pages, index │ │ LLM creates, updates, cross-references │ │ Bạn ĐỌC; LLM VIẾT │ └────────────────────┬────────────────────┘ │ guided by ▼ ┌─────────────────────────────────────────┐ │ Layer 3: CLAUDE.md Schema │ │ Conventions + workflows + types │ │ "Bản hợp đồng" giữa bạn và LLM │ │ Co-evolved theo thời gian │ └─────────────────────────────────────────┘
Ưu điểm
  • Raw sources immutable → không bao giờ mất nguồn gốc
  • LLM owns wiki layer → bạn không cần manually maintain
  • Schema file → LLM disciplined, nhất quán qua nhiều sessions
  • Simple infrastructure — chỉ cần folder + markdown
Nhược điểm
  • LLM errors có thể propagate vào wiki nếu không lint
  • Schema cần time để co-evolve và stabilize

3. Three Operations: Ingest / Query / Lint

3
Gist: Operations section
Ba operations này là toàn bộ giao diện bạn cần. Không phức tạp hơn. Mọi workflow trong LLM Wiki đều là biến thể của ba operations cơ bản này.

Ingest — Thêm source mới

Drop source vào raw/ → tell LLM process. LLM sẽ:

1. Đọc source 2. Thảo luận key takeaways với bạn 3. Viết summary page trong wiki/ 4. Update index.md 5. Update relevant entity + concept pages → 1 source có thể touch 10-15 wiki pages! 6. Append entry vào log.md

Query — Hỏi câu hỏi

LLM đọc index.md → tìm relevant pages → đọc pages → synthesize answer với citations. Answers có thể là: markdown page, comparison table, Marp slides, matplotlib chart.

Key insight: Good answers có thể filed back vào wiki như new pages. Một analysis, một comparison, một connection bạn discover — đây là valuable content, không nên chỉ tồn tại trong chat history.

Lint — Health check định kỳ

Sau mỗi ~20 pages mới, chạy lint để tìm:

• Contradictions giữa các pages • Stale claims bị supersede bởi newer sources • Orphan pages (không có inbound links) • Concepts được mention nhưng thiếu page riêng • Missing cross-references • Data gaps → suggest new sources để investigate

Phân tích sâu: Architecture & Operations — schema co-evolution, ingest prompt templates, lint automation

4. Index & Log — Navigation Infrastructure

4
Gist: Indexing and logging section
Hai file đặc biệt này là "hệ thống thần kinh" của wiki. Không có chúng, LLM sẽ phải brute-force read tất cả pages mỗi lần query — tốn tokens và không scale.

index.md — Content catalog

wiki/index.md (ví dụ)

MD
# Wiki Index

## Entities
- [[Transformer Architecture]] — Attention mechanism, encoder-decoder design (2 sources)
- [[BERT]] — Bidirectional pre-training for NLP (3 sources)
- [[GPT-3]] — Large-scale language model with emergent capabilities (1 source)

## Concepts
- [[Attention Mechanism]] — Scaled dot-product attention, multi-head attention
- [[Scaling Laws]] — Relationship between compute, data, parameters

## Comparisons
- [[BERT vs GPT]] — Bidirectional vs autoregressive comparison

log.md — Chronological audit trail

wiki/log.md

MD
## [2026-04-10] ingest | Attention Is All You Need (2017)
Created: transformer-architecture.md, attention-mechanism.md, positional-encoding.md
Updated: index.md (+3 entries)

## [2026-04-11] query | "How does multi-head attention differ from single-head?"
Filed answer as: wiki/attention-multi-head-comparison.md

## [2026-04-12] lint | routine health check
Fixed: 2 orphan pages linked, 1 contradiction flagged in scaling-laws.md
Scale claim từ Karpathy: index.md approach hoạt động tốt đến ~100 sources, ~hundreds of pages mà không cần embedding-based RAG infrastructure. Karpathy's own wiki: ~100 articles, ~400,000 words.

5. CLAUDE.md Schema — The Real Product

5
Gist: The schema section
Schema là thứ quan trọng nhất trong cả hệ thống. Karpathy viết: "The schema document is the most important file in the system. It's what turns a generic LLM into a disciplined knowledge worker." Bạn có thể share schema với người khác cùng domain → họ nhận được running start ngay lập tức.

Ví dụ CLAUDE.md cho research wiki

CLAUDE.md (schema file)

MD
# Wiki Schema — AI Research

## Structure
- wiki/ — entity pages (one concept per file)
- raw/ — immutable sources
- wiki/index.md — catalog
- wiki/log.md — chronological log

## Entity Page Format
```markdown
# [Entity Name]
**Type**: Concept | Person | Project | Library | Decision
**Summary**: One sentence.
**Sources**: [[source-1]], [[source-2]]
**Confidence**: 0.85 (2 sources, last confirmed 2026-04-10)
---
## Overview
## Key Properties / Arguments
## Relationships
- uses: [[Entity A]]
- contradicts: [[Entity B]]
## Open Questions
```

## Ingest Workflow
1. Read source
2. Identify entities (list them before writing)
3. Create/update entity pages
4. Update cross-references
5. Update index.md
6. Append to log.md

## Lint Rules
- Every entity page must have ≥1 inbound link
- Confidence <0.5 → flag for verification
- Contradiction found → mark both pages, log decision
Ưu điểm
  • Schema transferable — share với người khác cùng domain, họ có running start
  • LLM consistent qua nhiều sessions — không phải "nhắc nhở" format mỗi lần
  • Co-evolve theo thời gian — schema reflect cách domain thực sự work
  • Separates concerns — bạn curate sources; LLM handles bookkeeping
Nhược điểm
  • Cần time để phát triển schema đủ tốt (vài dozen sources đầu tiên)
  • Schema phải được update khi domain evolve

Phân tích sâu: Architecture & Operations — toàn bộ CLAUDE.md template, ingest prompts đầy đủ, lint automation

Advanced — Memory & Scale (LLM Wiki v2) Scale

LLM Wiki v2 là extension của rohitg00 (agentmemory project), build trên pattern gốc của Karpathy. Phần này tổng hợp những gì original gist chưa có nhưng cần thiết khi wiki grow past ~200 pages.

6. Knowledge Lifecycle — Confidence & Forgetting

6
LLM Wiki v2 — Memory lifecycle section
Wiki không có lifecycle management sẽ trở thành junk drawer. Original LLM Wiki treat tất cả content như equally valid forever. Trong thực tế, knowledge có lifecycle — bug từ 6 tháng trước ít quan trọng hơn tuần rồi; pattern thấy 12 lần đáng tin hơn thấy 1 lần.

Confidence Scoring

Mỗi fact trong wiki có confidence score: bao nhiêu sources support, lần xác nhận gần nhất, có contradictions không. Confidence decays với time, strengthens với reinforcement.

Supersession — Version control cho knowledge

Khi info mới contradicts/updates existing claim: old claim được marked stale với link tới claim mới. Không xóa, không chỉ thêm note — explicitly supersede với timestamp.

Forgetting — Ebbinghaus curve

Facts không được access/reinforce nhiều tháng → fade (không xóa, nhưng deprioritized). Architecture decisions decay chậm; transient bugs decay nhanh.

Consolidation Tiers

Working Memory → Episodic Memory → Semantic Memory → Procedural Memory (recent obs) (session summaries) (cross-session facts) (workflows/patterns) volatile compressed confident long-lived

Phân tích sâu: Knowledge Lifecycle & Memory — confidence scoring implementation, Ebbinghaus model, consolidation pipeline

7. Knowledge Graph — Entity + Typed Relationships

7
LLM Wiki v2 — Beyond flat pages
Flat pages với wikilinks đang bỏ phí structure. Knowledge graph với typed relationships cho phép queries kiểu "impact of upgrading Redis?" đi qua dependency edges — catches connections keyword search miss.

Entity Extraction

Khi ingest source: extract structured entities — people, projects, libraries, concepts, files, decisions. Mỗi entity: type, attributes, typed relationships to other entities.

Typed Relationships

"React" ──[uses]──▶ "Fiber reconciler" "Auth migration" ──[caused]──▶ "Performance regression" (confidence: 0.9, 3 sources) "Redis v7.0" ──[supersedes]──▶ "Redis v6.x" "Sarah" ──[owns]──▶ "Auth migration"

Phân tích sâu: Knowledge Graph & Hybrid Search — entity extraction, BM25 + vector + graph fusion, RRF

8. Hybrid Search — Scale Beyond 200 Pages

8
LLM Wiki v2 — Search that actually scales
index.md breaks around 200-500 pages vì brute-force matching. Hybrid search kết hợp ba streams để catch connections mà single approach miss.
Query │ ├── BM25 search ──▶ exact terms, stemming, synonyms ├── Vector search ──▶ semantic similarity via embeddings └── Graph traversal ──▶ entity-aware relationship walking │ ▼ RRF Fusion (Reciprocal Rank Fusion) │ ▼ Ranked results (agentmemory: 95.2% trên LongMemEval-S)
Ưu điểm
  • BM25 catches exact terms (hiệu quả với technical jargon)
  • Vectors catch semantic similarity (same concept, different words)
  • Graph catches structural connections (downstream dependencies)
  • RRF fusion: không cần tune weights, robust với noisy results
Nhược điểm
  • Setup phức tạp hơn index.md approach
  • Overkill với wiki nhỏ (<200 pages)
  • Need to maintain vector index khi wiki update

9. Automation Hooks — Event-driven Maintenance

9
LLM Wiki v2 — Automation section
Biggest gap trong original LLM Wiki: mọi thứ đều manual. Bookkeeping là lý do chính khiến người ta abandon wikis. Automation hooks đưa bookkeeping về gần zero.
Events → Hooks: on_new_source → auto-ingest, extract entities, update graph, update index on_session_start → load relevant context dựa trên recent activity on_session_end → compress session thành observations, file insights on_query → check if answer worth filing back (quality score > threshold) on_memory_write → check contradictions, trigger supersession on_schedule → periodic lint, consolidation, retention decay
Human vẫn trong loop cho curation và direction. Automation chỉ handle bookkeeping — phần mà người ta hay abandon wikis vì quá tốn công.

Phân tích sâu: Automation, Memory Lifecycle & Privacy — hook implementation, governance, multi-agent sync

Implementation Impl

10. Folder Structure — Minimal Viable Setup

10
Data Science Dojo Tutorial + original gist

Cấu trúc chuẩn

Minimal viable wiki structure

SH
my-wiki/
├── raw/ drop PDFs, articles, notes đây (immutable)
   ├── paper1.pdf
   └── article1.md
├── wiki/ LLM-generated entity pages
   ├── index.md catalog of all pages
   ├── log.md chronological audit trail
   ├── attention-mechanism.md
   ├── transformer-architecture.md
   └── bert.md
└── CLAUDE.md schema: conventions + workflows (bạn + LLM co-evolve)
Folder structure của LLM Wiki với raw và wiki directories
Cấu trúc folder minimal viable wiki. raw/ chứa sources, wiki/ chứa entity pages của LLM. ↗ Data Science Dojo Tutorial

Note template chuẩn

wiki/_template.md

MD
# [Entity Name]
**Summary**: One sentence describing this concept.
**Tags**: #topic1 #topic2
**Created**: 2026-04-20
**Last Updated**: 2026-04-20

---

## Overview

## Key Properties

## Related Notes
- [[Related Entity A]]
- [[Related Entity B]]

11. Use Cases — Contexts LLM Wiki Shines

11
Gist + tutorial

5 use cases Karpathy đề xuất

1. RESEARCH: Papers, articles → wiki với evolving thesis "Tolkien Gateway built by volunteers → bạn build cá nhân trong vài ngày" 2. READING BOOKS: Mỗi chapter → character pages, theme pages, plot threads → rich companion wiki khi đọc xong 3. PERSONAL GROWTH: Journal entries, podcast notes, articles → structured picture của bản thân theo thời gian 4. BUSINESS/TEAM: Slack threads, meeting transcripts, customer calls → internal wiki luôn current vì LLM maintain 5. COMPETITIVE ANALYSIS, due diligence, trip planning, course notes
Real-world scale: Karpathy's own wiki: ~100 articles, ~400,000 words. LLM vẫn navigate hiệu quả bằng index + summaries — faster và accurate hơn RAG pipeline.

12. Scaling Path — Từ Minimal đến Enterprise

12
LLM Wiki v2 — Implementation spectrum

6 tầng scaling

Tầng 1 — Minimal Viable (bắt đầu ở đây) raw/ + wiki/ + index.md + CLAUDE.md → works tốt đến ~200 pages Tầng 2 — Add Lifecycle + confidence scoring + supersession + basic retention decay → prevents wiki thành junk drawer Tầng 3 — Add Structure + entity extraction + typed relationships + knowledge graph → queries richer, connections visible Tầng 4 — Add Automation + event-driven hooks (auto-ingest, auto-lint) + context injection on session start → maintenance burden → near zero Tầng 5 — Add Scale + hybrid search (BM25 + vector + graph) + consolidation tiers + quality scoring → 200+ pages với no degradation Tầng 6 — Add Collaboration + mesh sync cho multi-agent + shared/private scoping + work coordination → team hoặc multi-agent setups
Recommendation: Start ở Tầng 1. Add Tầng 2 sau vài dozen sources khi bạn notice content bắt đầu stale. Chỉ move lên Tầng 3+ khi bạn thực sự cần — mỗi tầng có giá trị độc lập.

Tổng kết Wrap

LLM Wiki là một trong những ý tưởng đơn giản nhất nhưng powerful nhất trong AI workflow 2026. Insight cốt lõi — thay vì re-derive, hãy compile — khiến knowledge compounding thực sự khả thi với một người dùng đơn lẻ và không cần infrastructure phức tạp.

Karpathy không viết code, không build sản phẩm — ông viết một markdown file 500 dòng mô tả một pattern. Đó là sức mạnh của ý tưởng đúng đắn ở đúng thời điểm.

Bắt đầu ngay: Tạo folder my-wiki/, thêm 5 PDFs về topic bạn đang research, paste ingest prompt vào Claude Code — bạn có working wiki trong 30 phút.