Clark Farming CompanySoftware Foundry

Knowledge & Memory · Concept

Retrieval-Augmented Generation

Category: AI Inference / Knowledge Retrieval Maturity: Established Retrieval-Augmented Generation (RAG) is a pattern that enhances Large Language Model responses by retrieving relevant external documents before generating answers. Instead of relying solely on training data, the model accesses a knowledge base at inference time, producing more accurate and up-to-date responses. retired internal project's wiki functions as a RAG-like …

activeinferred-with-source-trail1 source links0 resolved links
wiki/wiki/concepts/retrieval-augmented-generation.md

Answer

Category: AI Inference / Knowledge Retrieval Maturity: Established Retrieval-Augmented Generation (RAG) is a pattern that enhances Large Language Model responses by retrieving relevant external documents before generating answers. Instead of relying solely on training data, the model accesses a knowledge base at inference time, producing more accurate and up-to-date responses. retired internal project's wiki functions as a RAG-like …

Auto-generated neutral summary from the source page — needs human review before trusted use.

Evidence & Source Cards

Librarylibrary/reference/industrial/generic/power-generation.mdexists

Source Excerpt

Category: AI Inference / Knowledge Retrieval

Maturity: Established


Executive Summary

Retrieval-Augmented Generation (RAG) is a pattern that enhances Large Language Model responses by retrieving relevant external documents before generating answers. Instead of relying solely on training data, the model accesses a knowledge base at inference time, producing more accurate and up-to-date responses. retired internal project's wiki functions as a RAG-like system — agents query the wiki for context before making decisions.


Definition

RAG combines two stages:

  1. Retrieval — Given a user query, search a document corpus and return the most relevant passages
  2. Generation — Feed the retrieved passages as context to an Large Language Model, which generates a response grounded in those passages

This contrasts with fine-tuning (which bakes knowledge into model weights) by keeping knowledge external and updateable.


Key Components

1. Document Indexing

2. Query Processing

3. Context Assembly


RAG vs Wiki (retired internal project Pattern)

AspectTraditional RAGretired internal project Wiki
StorageVector DB embeddingsMarkdown files + search
RetrievalSemantic similarityFull-text search + wiki links
UpdatesRe-embed documentsEdit markdown directly
Human readabilityLow (vector blobs)High (plain text)
Agent accessAPI queriesFile system + search tools
VersioningLimitedGit-based

retired internal project's wiki is essentially a human-readable RAG system. Agents use search_files, read_file, and wiki_search.py as their retrieval mechanism, then synthesize answers from the retrieved content.


Common Patterns

Naive RAG

Simple embedding + similarity search. Works for small corpora but degrades with scale.

Advanced RAG

Modular RAG

Separate retrieval and generation into independent modules that can be improved independently.


Implementation at retired internal project

Our wiki serves as the primary knowledge retrieval layer:

The Karpathy Large Language Model Wiki pattern is essentially RAG designed for Large Language Model agents as the primary users, with humans as secondary consumers.


Related Concepts

Relationships

Outbound links

Referenced by

Tags

conceptai-inferenceknowledge-retrievalrag