Understanding Long Context, RAG,
Graph RAG, Fine Tuning and CAG
September 2026
The core problem every one of these techniques solves is the
same: an LLM is frozen at training time and has no idea about your organization’s
private, current, or proprietary data. Each technique is a different answer
to "how do I get outside knowledge into the model's head."
The foundation: what problem are we solving?
Think of LLM itself as a brilliant graduate who finished
their formal education on a fixed date (the training cutoff) and has been
sealed in a room ever since. Everything below is a different way of feeding
that graduate information they didn't learn in school.
1. Long Context
What it is: Instead of retrieving snippets, you just
stuff the entire document (or set of documents) directly into the prompt
every time. Modern models can hold hundreds of thousands to millions of tokens
in a single conversation.
Analogy: An open-book exam where you're allowed to
bring the entire textbook into the room and the student reads the whole
thing cover-to-cover for every single question, even if the answer is on page 3
of a 900-page book.
Use case: Reviewing one contract, one policy
document, or one case file end-to-end where you need the model to reason across
the whole document, not just fetch a fact.
Critical caveats:
- Cost
and latency scale with every token you feed in, every single turn —
expensive if repeated across many queries.
- "Lost
in the middle” - models are documented to attend less reliably to
information buried in the middle of a very long context versus the
start/end.
- Doesn't
scale to an entire organization’s knowledge base — you're still limited by
the context window ceiling, and Organization -scale document repositories
(thousands of SOPs, case files) will not fit.
What it is: Instead of handing over the whole
textbook, a "librarian" searches a knowledge base first, pulls
out only the relevant pages, and hands the model just those pages along with
the question.
Analogy: You ask a librarian a specific question.
Rather than giving you the entire library, they run to the shelves, pull the
2-3 relevant books/pages, and hand you just those — this happens fresh, every
single question.
Mechanics in plain terms: Documents are chopped into
chunks, converted into numerical "meaning fingerprints" (embeddings),
stored in a vector database. When a question comes in, the system finds chunks
whose fingerprint is closest in meaning to the question and injects those
chunks into the prompt.
Use case: Customer service bots answering from an SOP
library; a GLC compliance assistant answering from policy manuals; querying
case precedents against a corpus too large to fit in any context window.
Critical caveats:
- Retrieval
quality is the whole game - if the librarian fetches the wrong pages, the
answer is confidently wrong (this is retrieval failure, distinct
from model hallucination, though it looks identical to the end user).
- Works
well for facts that live in one or two isolated chunks but struggles when
the answer requires connecting information across many documents
(see Graph RAG below).
- Needs
ongoing maintenance — re-indexing when documents change, tuning chunk
size, embedding model choice.
3. Graph RAG
What it is: Standard RAG treats documents as isolated
chunks. Graph RAG additionally builds an explicit map of entities and
relationships (Person A reports to Person B; Incident X occurred at
Location Y; Policy Z references Regulation W) and lets retrieval traverse those
connections.
Analogy: Standard RAG is a librarian who's good at
finding books that mention your topic. Graph RAG is a librarian who also
keeps a giant relationship map on the wall — connecting authors to institutions
to events to citations — so when you ask "how is X connected to Y,"
they can trace the actual path between them, not just find documents where both
words appear.
Use case: Fraud/network investigation (who is
connected to whom, through which transactions or entities) — highly relevant to
intelligence and law-enforcement analytics like MCAIS-type platforms; corporate
org-chart or supply-chain reasoning; anywhere the question itself is
about relationships ("who influenced this decision," "what's the
chain of custody") rather than a single fact.
Critical caveats:
- Significantly
more expensive and complex to build and maintain than standard RAG — you
need entity extraction, relationship extraction, and a graph database
layer.
- Only
worth the overhead when your actual queries are relational. If your use
case is "find me the answer in this manual," Graph RAG is
over-engineering; if it's "trace the connection between these two
entities," standard RAG cannot do this at all.
4. Fine-Tuning
What it is: Instead of feeding information into
the prompt at question-time, you retrain (adjust the internal weights of)
the model itself on examples of the behavior or style you want, so the
knowledge or skill becomes baked into the model permanently.
Analogy: RAG is giving the graduate reference
material to read before answering. Fine-tuning is sending the graduate back for
a specialized apprenticeship that changes how they think and respond —
their instincts, tone, and reflexes — not just what reference material is
sitting on their desk.
Use case: Teaching a model a specific style or
format (e.g., always responding in a specific legal drafting register,
or a specific classification/tagging behaviour); teaching a narrow, stable
skill (e.g., extracting structured fields from a specific form type) where the
pattern doesn't change often.
Critical caveats — this is the one most often mis-sold:
- Fine-tuning
is poor at injecting new factual knowledge reliably — it's much
better suited to changing behavior/style/format than to teaching facts.
For "the model needs to know our latest policy," RAG is almost
always the right tool, not fine-tuning.
- Expensive,
requires curated training data, and needs to be redone every time
the underlying facts change — a brittle way to handle anything that
updates regularly (which is most enterprise knowledge).
- Risk
of catastrophic forgetting (degrading general capability while specializing)
if not done carefully.
5. CAG (Cache-Augmented Generation)
What it is: The newest and least standardized of
these terms. The idea: instead of retrieving fresh snippets on every query
(RAG) or stuffing the whole document in raw every time (Long Context), you pre-load
a fixed, bounded set of documents once, and cache the model's internal
processed representation (the Key Value-cache) of that content. Every
subsequent question reuses that pre-computed cache instead of reprocessing the
documents from scratch.
Analogy: Long Context is reading the whole textbook
fresh for every question. RAG is a librarian fetching new pages each time. CAG
is like pre-reading and memorizing the layout of one specific, bounded
set of reference material once at the start of the day — so for every question
afterward, you're not searching or re-reading, you're instantly recalling from
what's already loaded in working memory.
Use case: A bounded, fairly static knowledge set
(e.g., one department's SOP manual, one product's documentation) that gets
queried repeatedly within a session — you pay the processing cost once,
then every question after is fast and cheap.
Critical caveats:
- Only
works when the knowledge base is small enough to fit in the context window
in the first place (it's built on top of long-context capability, not a
replacement for RAG's ability to search across huge corpora).
- Cache
goes to stale the moment underlying documents change — you must reprocess.
Not suited to frequently updated knowledge.
- Still
an emerging technique (the term comes out of a 2024 research paper) - tooling
and production maturity lag well behind RAG's.
|
Missing piece |
What it is |
Why it matters |
|
Embeddings & Vector Databases |
The underlying "meaning fingerprint" technology
that makes RAG's retrieval step work at all |
Without understanding this, RAG is a black box; this is
the actual retrieval engine |
|
Hybrid Search |
Combining keyword search (exact term matching) with
semantic/embedding search |
Pure semantic search can miss exact terms (case numbers,
IC numbers, regulation codes) that matter a lot in compliance/legal contexts |
|
Agentic RAG |
RAG where the model doesn't just retrieve once, but
reasons in a loop — retrieve, evaluate if the answer is sufficient, retrieve
again, reformulate the query — before answering |
Closer to how a real analyst works: iterative
investigation rather than one search |
|
Prompt Engineering |
The baseline skill of structuring the instruction
to the model well |
Underpins the quality of every technique above — a bad
prompt degrades RAG, fine-tuning, and long-context alike |
|
Context Compression / Summarization |
Techniques to compress retrieved or long-context material
before it hits the model, to save cost |
The practical middle ground between "retrieve
everything" and "fit within budget" |
|
Guardrails / Governance Layer |
Validation, citation-checking, and policy-compliance
layers sitting around the model's output |
Given your governance focus — none of the above techniques
prevent hallucination on their own; this is a separate, necessary layer |
|
Technique |
Solves |
Knowledge freshness |
Cost pattern |
Best for |
|
Long Context |
Reasoning across one whole document |
As fresh as what you paste in |
High, repeated per query |
Single-document deep reasoning |
|
RAG |
Searching for a large, changing knowledge base |
Fresh at query time |
Moderate, per-query retrieval |
Large, evolving knowledge bases |
|
Graph RAG |
Relational/connection questions |
Fresh, if graph is maintained |
High to build & maintain |
Investigation, network analysis |
|
Fine-Tuning |
Changing behavior/style/skill |
Frozen until retrained |
High upfront, cheap per query |
Stable style/format tasks |
|
CAG |
Fast repeated queries on bounded, static content |
Stale until cache rebuilt |
Low per-query after one-time cost |
Small, static, heavily reused corpora |
One critique that is worth building is that: vendors
routinely market these as if one technique "wins” - in practice,
production systems almost always combine two or three (e.g., RAG for retrieval
+ a thin fine-tune for house style + a guardrail layer for governance).
No comments:
Post a Comment