← Master Index
Vol. 14 Module 14.1 Lecture

Knowledge Base

RAG Core Concepts

How This Lesson Fits the Module & Volume

The RAG pipeline is only as trustworthy as its knowledge base (KB)—the curated corpus of sources you are willing to retrieve from. Unlike a raw file dump, a KB has ownership, freshness SLAs, access rules, and quality gates. It feeds chunking and the vector store; indexing makes it searchable at scale.

Learning Objectives

By the end of this lesson, students should be able to:

  • Define a RAG knowledge base vs an ungoverned document pile.
  • List source types and ingestion patterns (batch, CDC, crawlers).
  • Set freshness, ownership, and deprecation policies.
  • Connect KB governance to metadata and ACLs.
  • Plan evaluation sets drawn from real KB questions.
  • Explain why garbage-in still yields fluent garbage-out with RAG.
Definition

A knowledge base for RAG is the governed collection of documents (and their derived chunks) that an organization designates as authoritative evidence for retrieval-augmented answers, including processes for update, access, and retirement.

KB Building Blocks

ElementQuestions to answer
SourcesWhich systems are in-scope? Who owns them?
IngestBatch nightly? Event-driven? Manual publish?
QualityDeduped? PII scrubbed? Structured enough?
AccessTenant / role visibility?
LifecycleHow are obsolete docs removed from the index?

Curated KB

  • Owned pages
  • Review cadence
  • Higher trust

Raw lake

  • Everything indexed
  • Fast coverage
  • Noise & conflicts

Hybrid policy

  • Tier A/B sources
  • Boost curated
  • Common in prod

Code: Tiny KB Registry

from dataclasses import dataclass from datetime import date @dataclass class KBDoc: doc_id: str uri: str owner: str tier: str # "A" curated, "B" supplemental updated: date active: bool = True class KnowledgeBase: def __init__(self): self.docs: dict[str, KBDoc] = {} def upsert(self, doc: KBDoc): self.docs[doc.doc_id] = doc def retire(self, doc_id: str): if doc_id in self.docs: self.docs[doc_id].active = False # index job must delete vectors too def indexable(self) -> list[KBDoc]: return [d for d in self.docs.values() if d.active] kb = KnowledgeBase() kb.upsert(KBDoc("hr-pto", "s3://kb/hr/pto.md", "HR", "A", date(2026, 6, 1))) print(len(kb.indexable()))

Strengths of a governed KB

  • Fewer conflicting answers
  • Clear owners for bad content
  • Safer ACL boundaries

Tradeoffs

  • Curation costs time
  • Coverage gaps hurt recall
  • Stale “active” flags poison RAG
Common Misconception

“If it is in SharePoint, it belongs in the KB.” Drafts, duplicates, and personal folders create contradictory evidence. Scope the KB deliberately; quarantine low-trust sources or mark them tier-B with lower boosts.

Knowledge Check

  1. Short Answer: What makes a KB “governed”? Answer: Ownership, freshness, access, and retirement processes—not just files.
  2. True/False: Retiring a doc requires removing its vectors too. Answer: True.
  3. Multiple Choice: Tiered sources help by: (a) boosting trusted content, (b) removing GPUs, (c) CSS. Answer: (a).
  4. Short Answer: Name an ingest pattern. Answer: Batch, CDC/event-driven, or crawl/publish (any).
  5. True/False: RAG fixes contradictory source documents automatically. Answer: False.
  6. Multiple Choice: Eval sets should come from: (a) real user questions on the KB, (b) only lorem ipsum, (c) DPI settings. Answer: (a).
  7. Short Answer: Why track owners? Answer: Accountability when content is wrong or stale.
  8. True/False: Personal draft folders are ideal tier-A sources. Answer: False.
  9. Multiple Choice: Next lecture: (a) Indexing, (b) Vol. 1 only, (c) printers. Answer: (a).
  10. Short Answer: How does metadata support the KB? Answer: Encodes tier, ACL, freshness, and provenance for retrieval.

Key Takeaways

  • A RAG KB is a governed evidence corpus, not a file dump.
  • Lifecycle and ACLs matter as much as embedding quality.
  • Garbage sources produce fluent wrong answers.
  • Next: Indexing.
Trainer’s Guide

Lab: Inventory 20 candidate sources; label A/B/exclude; justify three exclusions.

Discussion: Who has authority to publish into production RAG?

Recap: The knowledge base is RAG’s system of evidence. Continue with Indexing.