LLM Wiki 101

Knowledge base ที่ LLM ดูแลให้ — Karpathy's pattern

v1 · 9 พ.ค. 2569 · 2 tracks · ~45 นาที

THมี English ด้วย

สิ่งที่จะได้เรียนรู้

Track A

พื้นฐาน

  • LLM Wiki คืออะไร?
  • ทำไมไม่ใช้ RAG อย่างเดียว?
  • บรรพบุรุษ Zettelkasten
  • 3 layers
  • Page template + citation
  • ลองทำมือ
Track B

Engineering

  • Schema design
  • Obsidian + Git
  • Failure modes (drift)
  • Integration กับ agents
  • Evaluation
  • Cheatsheet

ใจความสำคัญ

"The wiki is a persistent, compounding artifact." — Karpathy

  • RAG: stateless — re-derive ทุก query
  • LLM Wiki: stateful — สะสม synthesis
  • ความใหม่ไม่ใช่ architecture (เก่า 70 ปี)
  • ความใหม่คือ delegate maintenance ให้ LLM

3 layers, 3 operations

LayerMutabilityAuthored by
Rawไม่แก้มนุษย์ (curate)
WikiUpdate ทุก ingestLLM (review)
SchemaRare, deliberateมนุษย์ (รัฐธรรมนูญ)

3 operations

  • Ingest — source ใหม่ → updates wiki หลายหน้า
  • Query — ดึงความรู้สะสมเพื่อตอบ
  • Lint — ตรวจสุขภาพเป็นระยะ

RAG vs LLM Wiki

มิติRAGLLM Wiki
StateStateless ต่อ queryStateful, สะสม
RetrieveRaw chunksSynthesised pages
ConnectionsEmbedding similarityWikilinks
ProvenanceChunk → source (หลวม)Page → claim → source (แน่น)
เหมาะกับLookupDomain mastery / research

Production hybrid: wiki ก่อน (ถูก), RAG fallback (current)

บรรพบุรุษ — Zettelkasten

Niklas Luhmann สร้างกระดาษ ~90,000 ใบ ทำให้เขียน ~50 หนังสือ + ~550 บทความ

  • Atomicity — 1 ความคิดต่อ note
  • Cross-referencing — links ระหว่าง notes
  • Unique IDs — identifiers ที่เสถียร

"LLM Wiki = Zettelkasten + LLM ที่ทำ maintenance"

Genealogy

ยุคระบบMaintenance
1950s+Zettelkasten กระดาษManual ทั้งหมด
1980sNoteCardsส่วนใหญ่ manual
1995+Wikis (Cunningham)Manual + collab
2020sRoam, ObsidianManual + plugins
2024+LLM WikiLLM ทำ bookkeeping

Standard page template

---
id: concept:llm-wiki
type: concept
status: active
confidence: 0.5
sources: []
---

# Title

## Summary
หนึ่งย่อหน้า

## Claims
- <Claim.> `[src: raw/...] {conf: 0.5}`

## Relationships
- composes → [[entity-id]]

Citation discipline (กฎ)

ทุก claim cite raw file พร้อม confidence number

  • บังคับ grounding (ไม่ pad ด้วย priors)
  • เปิด decay (low conf + เก่า = stale)
  • เปิด contradictions (ทั้ง 2 citations อยู่)
conf = 0.5  (first observation)
conf = 1 - (1 - conf) * 0.6  (per reinforcement)

หลัง 1 reinforcement: 0.5 → 0.8
หลัง 2: 0.8 → 0.92
หลัง 3: 0.92 → 0.968

Ingest workflow

  1. Capture — verbatim ไป raw/YYYY-MM-DD-<slug>.md
  2. Extract — entities ตาม catalogue ของ SCHEMA
  3. Write/update — touch หลาย pages พร้อม [src:]
  4. Reconcile — index.md + log.md + graph/edges.jsonl
  5. Summarise — pages เพิ่ม/แก้, contradictions เปิด

Ingest ครั้งเดียวมัก update 3-10 pages. One-page ingest = พลาด cross-references

Lint workflow

เป็นระยะ ไม่ใช่ทุก ingest. ทุก 10 ingests หรือรายสัปดาห์/เดือน

  • Orphans — pages ไม่มี link เข้า
  • Broken wikilinks[[X]] โดยไม่มี X
  • Contradictions — supersession, ห้าม delete silent
  • Stale — decay < 0.2 + 2× half-life → status: faded
  • Citation integrity — ทุก [src:] file มี

"Supersession over deletion." Audit trail สำคัญกว่าความเรียบ

— จบ Track A —

Track B — Engineering patterns

สำหรับ builders ~25 นาที

Schema design — leverage สูงสุด

  1. Entity catalogue — เลือก 5-8 types หลีกเลี่ยง 20
  2. Relation catalogue — 6-10 ใช้ default ถ้าไม่แน่ใจ
  3. Decay half-life ต่อ type — fast (tools): 90d. Stable (decisions): 365d
  4. Privacy rules — list ชัดของสิ่งที่ห้ามเข้า wiki/

Schema updates ควร rare. มันคือ constitution ไม่ใช่ config

Tooling: Obsidian + Git

ConventionObsidian
1 markdown ต่อ entityNative
Wikilinks [[X]]Native + backlinks
FrontmatterNative + Dataview queries
Graph viewCore plugin
Git-friendlyJust a folder

Plugins แนะนำ: Dataview, Templater, Obsidian Git

Failure modes

  • Claim drift — wiki พูดสิ่งที่ source ไม่ support แล้ว (#1)
  • Orphan pages — ไม่มี link เข้า ไม่อยู่ใน index
  • Broken wikilinks — targets ที่ไม่มี
  • Contradictions — claims ตรงข้าม subject เดียวกัน
  • Stale claims — apply decay; mark faded ห้าม delete
  • Citation integrity — cited file ย้าย/ลบ

Drift rarely catastrophic วันแรก. มัน compound

Provenance audit

# เร็ว — broken citation pointers
for page in wiki/*.md; do
  for src in $(grep -oE 'raw/[^]]+' "$page"); do
    [ -f "$src" ] || echo "BROKEN: $page → $src"
  done
done

# ลึกกว่า — random claim verification
# เลือก 5 claims รายเดือน เช็คว่า cited raw ยังพูด
# ถ้า 1+ fail → full lint sweep overdue

Integration กับ agents — context engineering

"As context window increases, model recall decreases." — Anthropic

  • Wiki = persistent memory layer
  • RAG = just-in-time retrieval
  • Sub-agents = clean context windows, return summaries
  • Composition: Wiki ก่อน → RAG fallback → file back ถ้าใหม่

5 health metrics

Metricแข็งแรง
Citation density≥ 1.0 ต่อ claim
Provenance integrity100% citations point ไป raw จริง
Orphan rate< 5%
Freshness20-50% touched ใน 90d
Confidence median> 0.6; faded < 10%

Baseline วันนี้. Re-check รายเดือน

Anti-patterns ที่ต้องเลี่ยง

  • Schema ใน chat history (ไม่ใน file)
  • 20+ entity types (over-engineered)
  • One mega-citation ท้าย page
  • Claims ไม่มี confidence number
  • Silent deletion แทน supersession
  • Single-page ingest (พลาด cross-references)
  • Lint ทุก ingest (noise เกิน)
  • ไม่มี version control บน wiki

Production checklist

พื้นฐาน

  • 3 layers ครบ
  • Page template ตาม
  • ทุก claim cited
  • Wikilinks ใช้ IDs

Engineering

  • Schema ใน file (ไม่ใช่ chat)
  • Wiki ใน git
  • 5 metrics baseline
  • Privacy rules ชัด
  • ทดสอบบน human + LLM

แหล่งอ้างอิง

ทุก claim cited ใน /wiki/

มีคำถามไหม?

LLM Wiki 101 · 9 พ.ค. 2569

Transcript — สไลด์ปัจจุบัน