AI Model Wiki

    Skip to main content
    8 min read
    Lesson 1 of 5

    What is Retrieval-Augmented Generation?

    From the course RAG & Knowledge Bases: Ground AI in Your Data

    Retrieval-Augmented Generation (RAG) is a technique that enhances AI responses by grounding them in external knowledge — your documents, databases, or any data source — rather than relying solely on the model's training data.

    The Core Problem

    Large language models like GPT-5 and Claude are trained on vast amounts of public internet data. But they don't know:

    • Your company's internal documentation and SOPs
    • Your product catalog and pricing details
    • Recent information published after their training cutoff
    • Private data, customer records, or proprietary research
    • Domain-specific knowledge not well-represented on the internet

    When asked about these topics, models either hallucinate (make up plausible-sounding answers) or admit they don't know.

    How RAG Solves This

    RAG adds a retrieval step before generation:

    1. User asks a question — "What's our refund policy for enterprise clients?"
    2. System searches your documents — Finds the relevant section in your policies
    3. Retrieved text is injected into the prompt — As context for the AI
    4. AI generates a grounded answer — Based on your actual documentation

    The result: accurate, up-to-date answers sourced from your own data, with the ability to cite sources.

    RAG vs Fine-Tuning

    Fine-tuning trains the model on your data, baking knowledge into its weights. RAG keeps your data external and retrieves it at query time.

    AspectRAGFine-Tuning
    Data freshnessAlways currentStatic after training
    CostLow (no training)High (GPU hours)
    Setup timeHoursDays to weeks
    Best forFactual Q&A, docsStyle, tone, format
    Hallucination riskLower (grounded)Higher (memorized)
    Data privacyData stays yoursData enters model

    When to Use RAG

    ✅ Customer support bots grounded in your help docs ✅ Internal knowledge bases and company wikis ✅ Legal/compliance document search ✅ Technical documentation Q&A ✅ Research assistants over paper collections ✅ Personalized recommendations from product catalogs

    When NOT to Use RAG

    ❌ When the model already knows enough (general knowledge questions) ❌ When you need to change the model's writing style (use fine-tuning instead) ❌ When your documents are poorly structured or very noisy ❌ When real-time structured data is needed (use direct API/SQL instead)

    Key Takeaways

    • •RAG enhances AI by grounding responses in your own documents and data
    • •It adds a retrieval step before generation — search first, then answer
    • •RAG is cheaper, faster to set up, and more maintainable than fine-tuning
    • •Best for factual Q&A over private or frequently updated documents
    • •RAG reduces hallucinations by providing real source material as context
    0 of 5 lessons marked complete

    Progress is kept in this browser only.