GUIDES / EVALUATION

How are RAG, CAG and MAG different?

RAG, CAG and MAG differ in where an AI system gets its knowledge. Retrieval-augmented generation (RAG) searches a document index for every question and passes the best-matching passages to the model. Cache-augmented generation (CAG) loads a fixed body of knowledge into the model’s context ahead of time, so no search runs per question. Memory-augmented generation (MAG) writes memories from past interactions and recalls the relevant ones in later sessions. Because the knowledge source differs, the typical failures differ too.

Last updated

How does RAG work, and how does it fail?

A RAG system searches your documents when a question arrives and gives the best-matching passages to the model. The answer is only as good as what was found and how faithfully the model used it.

  • The relevant document is never retrieved
  • An off-topic passage shapes the answer
  • A claim is not supported by any passage
  • A citation points to the wrong source

How does CAG work, and how does it fail?

A CAG system loads a fixed body of knowledge into the model’s context, or its key-value cache, before questions arrive. There is no per-question search, so the risks move from retrieval to coverage and freshness.

  • The cached content is out of date
  • The answer is drawn from the wrong section
  • An answer is invented when the information is absent
  • Reliability drops across very long context

How does MAG work, and how does it fail?

A MAG system keeps memories from earlier sessions and recalls the ones it judges relevant later. That makes personalization possible, and it adds risks that the other two designs do not have, including privacy.

  • A stored memory is wrong or outdated
  • A memory is recalled at the wrong moment
  • Conflicting memories are left unresolved
  • One user’s details surface for another

Which one should you evaluate?

Evaluate the design you actually run, and test the failures that belong to it. A RAG assistant needs retrieval and citation checks, a CAG assistant needs coverage and freshness checks, and a MAG assistant needs checks on what is stored, when it is recalled and who can see it.

Related guides

Discuss a pilot →