RAG vs CAG vs MAG

Three ways to give an AI the knowledge it needs: RAG retrieves external context for each question; CAG pre-loads the knowledge into a cache once; MAG (memory-augmented generation) lets the AI both read and write a memory, so it remembers things across conversations.

Everyday analogy

RAG is the open-book exam. CAG is the chef with every ingredient prepped. MAG is a personal assistant with a notebook: they look things up in it and also write down what they learn about you.

Example

A travel assistant uses RAG to search hotel listings, CAG for its fixed booking rules, and MAG to remember that you prefer window seats and vegetarian meals.

🔎RAGretrieve for each question:big, changing libraries📦CAGpre-load and cache: small,stable knowledge🧠MAGremember the user over time:personal assistants
Three ways to give AI knowledge.

RAG

Retrieve external context at question time.

Best for large, changing document collections.

CAG

Pre-load the knowledge into the model's cache.

Best for small, stable knowledge; very fast.

MAG

Read and write a memory store.

Best for personal assistants and agents that learn over time.

Try it yourself

About 10 min

Pick the right approach

  1. Write three scenarios: a small fixed price list, a huge legal library, a personal assistant that remembers you.
  2. Match each to RAG, CAG or MAG.
  3. Write one sentence explaining each choice.

What you should see: Each approach fits a different size and type of knowledge.

Use any free AI chatbot (ChatGPT, Claude, Gemini or Copilot). Never paste private or confidential information.

Build it for real · guided projectBuild a document Q&A assistant (RAG, no code)About 60 min · No coding needed · step by step
Test what you learned

Take a quick quiz, or look up any word in the glossary.