Schrödinger's AI is your invitation to look inside. Right now, AI feels like a mystery , wired like a brain, yet running on pure math.

Each article is a new layer of the box. We start with the first spark of an idea and move all the way to the models reshaping everything we thought we knew .

Schrödinger’s AI

Part 9: Inside RAG

Back in 2023, talking to an AI felt like talking to a genius who’d been stuck in a cave for two years. They were incredibly smart, but they had no idea what was happening in the world.

When an AI gets stuck in the past or ignores your private environment, that’s the "knowledge cutoff." It’s a wall they can’t see past. And when an AI hits that wall, it starts to hallucinate, it just starts making things up because it's lost its way.

And that is where RAG (Retrieval-Augmented Generation) comes in as a fix. Instead of guessing based on old info or spinning wild stories, the AI can actually "look" at your data. It keeps the AI grounded in reality so you get an answer that’s real, current, and actually useful.

so we are trying to solve 3 problems,

First, knowledge can be outdated. Second, models may hallucinate incorrect facts. Third, they cannot access private or domain specific information.

What Exactly is RAG?

RAG is a framework that gives an LLM a search engine. Instead of relying solely on its internal memory (training data), the model looks up relevant information from an external source before generating an answer.

How RAG Works

A typical RAG pipeline has three main stages.

  1. Retrieval: When a user asks a question, the system converts the query into a vector representation and searches a database of documents for the most relevant matches.

  2. Augmentation: The retrieved passages are inserted into the prompt as context. This gives the language model fresh information related to the question.

  3. Generation: The language model reads the question plus the retrieved context and produces a final answer that is informed by the external data.

Because the model sees real documents at runtime, it is less likely to invent facts and more likely to cite accurate details.

The Architecture

Rikam Palkar AI For Dummies Part 9 - RAG

1. Data Ingestion & Embedding Pipeline (The Preparation)

Before the AI can answer questions, it must first "digest" the knowledge.

2. Retrieval & Generation Flow (The Live Answer)

When a user asks a question, the system follows this logical loop to find and deliver the answer:

Why this Architecture Works

By separating retrieval from generation, the model doesn't have to rely on its memory (which can be outdated). Instead, it "looks up" the answer in your specific data sources before speaking, effectively giving the AI an open-book exam.

From Text to Vectors:

To understand RAG, you have to understand a fundamental "translation" that happens behind the scenes. Think of saving a document into a vector database as translating a book into a "map of meanings" that a computer can navigate.

However, a map is only useful if it leads you to a real destination. In RAG, we use a Vector as the "GPS Coordinates" and the Chunk as the "Physical House" located at those coordinates.

Phase 1: Creating the Map (Data Ingestion)

Following the Data Ingestion & Embedding Pipeline, here is how a single sentence from an airline manual becomes a searchable data point:

  1. The Raw Input (Parsing): We start with a plain sentence: "Passengers on international flights are allowed one free checked bag up to 23kg".

  2. Chunking: The system breaks the document into smaller pieces.

    • The Chunk: "international flights... one free checked bag... 23kg"

  3. The Embedding Model (The Translator): This chunk is sent to an AI model (like text-embedding-ada-002) which converts the words into a Vector, a long list of numbers.

    • Numerical Representation: [0.12, -0.54, 0.89, 0.21, ...]

    • This vector represents the "location" of that sentence in a multi-dimensional space. Sentences about "suitcases" will be mathematically "close" to sentences about "luggage".

  4. Storage (The Vector Database): Instead of filing it alphabetically, the database stores it by these coordinates.

Rikam Palkar AI For Dummies Part 9 - RAG Vector

Phase 2: The Two Faces of Data

When you save that information, the Vector Database actually stores two things together in a single entry:

Phase 3: The "Switch" (How the Flow Works)

This is the most critical part of the architecture: the moment the system switches from math back to language.

Why chunks, not vectors?

The Large Language Model (LLM) at the end of the chain is a text-processor, not a calculator. If you gave it a list of 1,000 numbers, it would be lost.

By sending the Chunk, you are effectively handing the AI the open textbook and saying: "I found this specific paragraph in our manual. Read it and use these exact facts to answer the user". This ensures the AI stays grounded in reality rather than guessing based on its coordinates.

Your query and document texts are converted into vectors so the system can compare them and find the most relevant matches.

Does RAG use your data for Training?

One of the biggest concerns for companies is data privacy. You might wonder: If I give the AI my private booking details or company manuals, is it "training" on them?

The short answer is no. In a RAG architecture, your documents are used as a reference, not as a teaching tool.

The "Open-Book" vs. "Memorization" Difference

To understand why your data stays private, think of the difference between how an AI learns and how it researches:

And we learned where Your Data Actually Lives

In the architecture diagram, you'll notice a clear separation between the Knowledge Base and the Large Language Model (LLM):

This Matters for Business

Because the system uses Hybrid Information Retrieval to pull specific booking details as chunks only when needed, your sensitive data never leaves your controlled environment to train a public model.

Why is RAG a Game Changer?

Why not just retrain the model every time new info comes out? Because retraining (or "Fine-Tuning") is expensive, slow, and technically difficult. and no company wants to handover its secret to AI, so RAG offers a better way:

FeatureStandard LLMRAG-Enabled LLM
Up-to-Date InfoLimited by training cutoff.Real-time (as fast as you update your files).
AccuracyProne to "hallucinations".High; cites specific sources.
PrivacyHard to keep private data out of training.Keeps data in your secure database.
CostMillions to retrain.Pennies to update the search index.

The cat is neither alive nor dead and honestly, that's the most exciting place to be. There are a lot more layers to uncover.

Previous: Part 8: Inside the Model Context Protocol

Next: Part 10: Fine Tuning