AI comparison
RAG vs fine-tuning
Use RAG to give a model facts it must look up and keep current; use fine-tuning to change how it behaves, such as a format, tone or narrow task.
| Aspect | RAG | Fine-tuning |
|---|---|---|
| What it changes | What the model reads on each call | The model's weights |
| Updating knowledge | Edit the documents; takes effect at once | Train again on new data |
| Shows its sources | Yes, it can cite the passages it used | No, the knowledge is inside the model |
| Upfront work | A search index and chunking | Hundreds of good examples and a training run |
Choose RAG when
- The answers depend on documents that change
- Users need to see where an answer came from
- Different users may see different documents
Choose Fine-tuning when
- You need a consistent format or style that prompts cannot hold
- The task is narrow and you have many good examples
- You want shorter prompts or a smaller model on a repeated task
Learn it hands-on
These free lessons teach it with commands to run in a lab and checked tasks. Read them whole with no account.
Related terms
- Retrieval-augmented generation (RAG)
- Retrieval-augmented generation is answering a question by first finding relevant passages in your own documents and then giving them to a language model to answer from.
- Fine-tuning
- Fine-tuning is training an existing model further on your own examples so it learns a task, style or format it did not do well before.
- LoRA (low-rank adaptation)
- LoRA is a way to fine-tune a model by training small extra matrices beside its frozen weights, which needs far less memory than retraining everything.