↑ BACK TO TOP
open sidebar menu
  • AI, it's not that complicated/The Generative AI wave
    Knowledge Bases
    Analyzing Software CompaniesBuilding Software ProductsAI, it's not that complicatedWorking With Data Teams
    Sections
    1: The Basics
    2: The Generative AI wave
    It was never about LLM performanceWhat is RAG?What's a vector database?How do AI models think and reason?How to build apps with AIWhat is MCP?What is Generative AI?The beginner’s guide to AI model architecturesA deep dive into MCP and its associated serversThe scaling law and the “bitter lesson” of AIA practical breakdown of the AI power situationThe vibe coder’s guide to real coding2026 vibe coding tool comparisonHow to build AI products that are actually goodThe AI user's guide to evalsAI will replace you at your job if you let itAI and neuroscienceAI and the — em dash
    3: Tools and Products
Sign In

What is RAG?

Retrieval Augmented Generation is a way to make AI models more personalized

ai

Last updated: July 4, 2025

TL;DR

Retrieval Augmented Generation (RAG) is a way to make LLMs like GPT-4 more accurate and personalized to your specific data.

  • LLMs are powerful as hell, but they’re also generic: they’re trained on all data on the internet ever!
  • RAG helps you get more personalized responses tailored to your data by embedding your data in your model prompts
  • RAG relies on the model’s context window, which is how much data in can take in a prompt
  • Today’s RAG pipelines are pretty complex and rely on embedding models and vector databases

Alongside old school fine tuning, RAG is becoming the standard way to get better, more personalized results out of state of the art LLMs.

Terms Mentioned

Training

Fine Tuning

ChatGPT

Database

Context Window

Back to the future: training models

The funny thing about RAG is that the basic concept has been around for as long as machine learning has. Long time readers will recall that back in the day, I studied Data Science in undergrad. “Old School” machine learning, before everyone was calling it AI, was entirely predicated on training a new model for every problem.

How old school ML worked: custom models

Imagine you’re a Data Scientist tasked with understanding and predicting customer churn (your employer has a big churn problem). Your goal is to be able to predict a brand new customer’s chances of churning, so your marketing team can give them discounts and winback offers before they leave. Here’s what you might do:

  1. You gather a curated data set

You spend time gathering all of the historical data your company has about churn: who churned, when, what characteristics they had when they did, and anything they did beforehand. Each customer gets a label: churned, or didn’t churn.

  1. You train a model on the data set

Using either simple linear regression or something as complicated as deep learning with neural networks, your model goes through the data and tries to find patterns. It eventually learns (or tries to learn) which characteristics tend to lead to a customer churning, and which don’t.

  1. You test the model on new data

To make sure the model isn’t just spitting your data back at you, you test it on new data and see how it performs. The model needs to generalize, meaning perform well on new data that doesn’t look exactly like the data you trained it on. Models that are trained too well on the training data and don’t generalize well are called “overfit.”

Loading image...

The important theme here is that each model – whether you trained it from scratch, or took an existing model off the shelf – needed to be customized to your data set. This was how everyone thought about machine learning when I was doing it professionally. Everyone has different problems, so everyone needs different models.

Generative AI: not customized by default

The Generative AI that we use today, like ChatGPT or Claude, isn’t like this at all. Instead, it’s trained on one, colossally large data set – all of the internet – that isn’t curated and doesn’t belong to your business at all. You prompt the model to focus it on a specific problem, say, generating an outreach email, and it outputs something that represents the data it was trained on.

The broad strokes, non-customized nature of these GenAI models is fine for some use cases. But for many, especially business use cases, you need models to be aware of your data and give you those kinds of tailored responses. You can’t build a customer support chatbot that doesn’t know anything about your product [1] This hasn’t stopped companies from trying!.

So how do you customize GenAI models to work with your data?

The basic idea of RAG: data in context windows

The most straightforward way to customize a model like GPT-4 would be to retrain it on your unique data, updating the model itself along the way. You can do this – it’s called fine tuning (future post forthcoming) – but it’s expensive and requires a lot of infrastructure to do. What if there was a way to keep the models themselves the same, but somehow get them to output more customized responses aware of your data?

Access the full post in a knowledge base

Knowledge bases give you everything you need – access to the right posts and a learning plan – to get up to speed on whatever your goal is.

Knowledge Base

AI, it's not that complicated

How to understand and work effectively with AI and ML models and products.

$0.00

What's a knowledge base? ↗

Where to next?

Keep learning how to understand and work effectively with AI and ML models and products.

What's a vector database?

A vector database is a place where developers store specially formatted data to use for machine learning and AI.

The Generative AI wave
How do AI models think and reason?

All about "reasoning" language models like OpenAI's o3 and Deepseek's R1.

The Generative AI wave
How to build apps with AI

All about Vercel’s v0

The Generative AI wave
Newsletter
Support
Sponsorships
X + Linkedin
Privacy + ToS

Written with 💔 by Justin in Brooklyn