back to research
aillm

Your LLM Doesn't Know You

Why personalization and context are key challenges in making LLM interactions truly useful.

Prasad·June 1, 2024

LLMs are great at language but bad at facts. They hallucinate, forget details, and can't access your private database or yesterday's update.

The fix? Retrieval-Augmented Generation (RAG). Instead of expecting the model to know everything, we give it the ability to look things up in real time.

At its core, RAG = retriever + generator. A retriever pulls the most relevant chunks of your data, and the LLM generates an answer based on them.


What is RAG?

Retrieval-Augmented Generation is a design pattern where an LLM's input prompt is augmented with external context retrieved from a knowledge base.

RAG vs. fine-tuning vs. prompting:

  • Plain prompting: Good for reasoning and creativity but limited to training data.
  • Fine-tuning: Great when your task is narrow and stable, but retraining is costly.
  • RAG: Best when you need freshness, private data, or traceability -- without touching model weights.

Key components:

  • Retriever -- finds relevant context from the knowledge base you provide.
  • Index -- stores data in a searchable way (vectors).
  • Embeddings -- convert text into vectors for semantic search.
  • Generator -- the LLM that crafts the answer.

Why RAG is Used

  • Reduce hallucinations -- ground answers in real context.
  • Access private or dynamic data -- company docs, APIs, or live feeds.
  • Lower cost and faster iteration -- no need to fine-tune for every change.
  • Citations and control -- show sources, add filters, and audit outputs.

How RAG Works: Indexing + Retrieval

1. Chunking

Big documents are split into smaller pieces. Example: a 100-page PDF becomes 500-token chunks with slight overlaps. Retrieval works better when units are small and precise.

2. Embeddings

Each chunk is converted into a high-dimensional vector. This lets us search semantically -- 'refund policy' will match 'money-back guarantee,' even if the exact words differ.

3. Indexing

These vectors are stored in a vector database that supports fast similarity search. Tools: FAISS, Pinecone, Weaviate, pgvector, Qdrant, and even MongoDB now stores vectors.


The Generation Step

  1. User asks a question.
  2. Retriever pulls the top-k most relevant chunks.
  3. The LLM receives both the user's question and the retrieved context.
  4. It generates an answer grounded in the provided context, often with citations.

The model doesn't have to know your data in its weights -- it just needs the ability to reason over whatever context you supply.


Conclusion

RAG bridges the gap between LLMs and your private or recent data. It combines a retriever (to find the right context) with a generator (to answer the question), letting models know your data without retraining.

Think of it like giving the model a library card: it doesn't memorize every book, but it knows how to quickly find the right page and explain it back to you.