This article is published in English.
Why LLMs Need External Memory: RAG, Embeddings and Fine-Tuning
How retrieval-augmented generation gives a language model an open book: chunking, embeddings, grounded answers, where RAG beats fine-tuning, and where it still fails.
Ask a large language model to explain a tricky concept, condense a report or draft a convincing answer and it'll usually manage. Ask it to behave like a database and you're in trouble. What it knows lives inside its parameters and reflects whatever data existed at training time. That knowledge may be incomplete, stale or impossible to check, and when the model doesn't know something it can still answer in a confident tone.
Retrieval-Augmented Generation, or RAG, is the standard fix. Rather than answering from memory alone, the model first looks up relevant information in an external library, then writes its reply using what it found.
Closed-book and open-book answers
Picture asking a lawyer to review a contract. Under closed-book rules, the lawyer has to recall every clause from memory, and even a seasoned professional can misquote a detail or lean on an outdated version. Under open-book rules, you hand over an organized filing cabinet. The lawyer finds the right document, reads the exact clause and then explains it.
Language models behave the same way:
Closed-book approach:
Question
|
v
LLM's internal memory
|
v
Possible outdated or invented answer
Open-book RAG approach:Question
|
v
Search external documents
|
v
Retrieve relevant passages
|
v
LLM uses those passages to answer
The model still does the understanding and explaining. The retrieval system just supplies the evidence.
Parametric memory and its limits
What a model knows internally is called parametric memory. During training it processes huge amounts of data and adjusts its parameters, and the outcome isn't a tidy table of facts. Information ends up as patterns spread across the whole network. That's what makes the model flexible, but it brings problems:
- Changing one specific fact is hard.
- You may be unable to say where an answer came from.
- Knowledge goes out of date.
- Correct and incorrect patterns can blend together.
- Private company information isn't available automatically.
RAG adds a second kind of memory, usually called non-parametric. It sits outside the model, in documents, databases, search indexes or vector stores. The original RAG research framed it as pairing a pre-trained model with an external dense document index.
How a basic RAG system works
Most systems follow four stages.
1. Prepare the documents
Collect the documents, clean them and cut them into passages called chunks. A chunk should be big enough to keep its meaning and small enough to retrieve precisely. A company policy, for instance, is better split by section than chopped randomly mid-sentence.
2. Turn text into something searchable
Each passage becomes an embedding, a numerical representation of its meaning. Texts with similar meanings produce similar embeddings, so a system can find relevant passages even when the wording differs. A user might ask how many days they can work from home, while the policy says employees may work remotely up to two days per week. Good retrieval connects the two despite the different vocabulary.
3. Retrieve what's relevant
When a question arrives, the system embeds it too and searches for nearby passages. It picks the best matches and puts them into the model's context.
User question
|
v
Search document index
|
v
Retrieve relevant passages
|
v
Add passages to the model prompt
4. Generate a grounded answer
The model now sees both the question and the retrieved material. It can summarize that material, compare sources or explain the answer plainly. A carefully built system also tells the model to cite sources and to admit when the documents don't contain enough information.
RAG versus fine-tuning
When a company wants a model to use internal knowledge, its first instinct is often fine-tuning. That can help, but it's a poor place to keep facts that change. Fine-tuning alters the model's behavior by training on extra examples, so revising a policy every week that way would be slow, expensive and hard to audit.
RAG takes another route. When information changes, you update the document collection, and the very next query can retrieve the new version. It's the difference between rewriting someone's memory and handing them an updated reference book.
| Requirement | Fine-tuning | RAG |
|---|---|---|
| Change writing style | Strong fit | Limited |
| Teach a specific response format | Strong fit | Possible, but less direct |
| Add frequently changing facts | Poor fit | Strong fit |
| Use private documents | Possible, but costly | Strong fit |
| Show source material | Difficult | Natural |
| Update information quickly | Requires retraining | Update the document index |
Studies comparing the two have found RAG especially effective at adding rarer or newly introduced facts. One comparison of injecting knowledge by training versus retrieving is on arXiv, and a follow-up analysis reaches a similar view.
They don't compete in every situation. A team might fine-tune for tone and behavior, then use RAG for up-to-date facts.
RAG isn't a cure-all
RAG lowers the error rate but doesn't guarantee correct answers. A system can still fail when:
- The right document was never added.
- The document is out of date.
- Search returns the wrong passage.
- Key information is scattered across badly designed chunks.
- The model misreads the retrieved text.
- Conflicting documents appear with no clear priority.
So quality depends on more than the model. Document structure, search quality, metadata, permissions, citations and evaluation all count. A good way to remember it: RAG improves the model's access to evidence, but you still need good evidence.
Where it earns its keep in companies
RAG fits best when information is private, specialized or updated often. Think of HR and travel policies, product manuals, support knowledge bases, contracts and other legal material, financial reports, API and technical docs, healthcare guidelines, and records kept for individual projects.
Say an employee asks for the current travel reimbursement limit. A general-purpose model might give a generic answer or guess. A RAG system searches the current travel policy and replies with the approved figure, and it can add the document title, policy version and relevant section so the answer is easy to review and audit.
A new way to split the work
RAG changes what the language model is for. It no longer has to hold every fact it might need, and can act instead as a reasoning and communication layer wired to outside knowledge.
External documents
|
v
Search and retrieval system
|
v
Relevant context
|
v
Language model
|
v
Answer with explanation and sources
The model interprets, the retrieval system plays librarian, and the documents are the reference shelf. Keeping those roles apart makes systems easier to update and, often, easier to govern.
What retrieval still can't do
Access to information isn't the same as the ability to act. A model might know a travel request needs approval, yet it can't approve it. It can explain a refund policy without being able to issue a refund, because it has no route into the business system. Closing that gap means connecting models to tools through function calling and APIs, so they can move from producing text to doing useful work. The model has learned from the world and RAG lets it look things up. Teaching it to act on what it knows is the next problem.
Papers worth opening
- The original RAG paper from NeurIPS 2020 pairs a pre-trained generator with a retrieval index.
- A few-shot study of retrieval-augmented language models shows how far retrieval can go with only a handful of examples.