When do you choose RAG, fine-tuning or plain code?
Answer out loud or in your head first, then compare.
Answer
When the model needs current knowledge from documents and sources, I start by retrieving those materials, i.e. RAG. When it's about a consistent style or behaviour across many examples, you can consider fine-tuning, i.e. additional training on chosen data. But first I check a simpler solution.
Fine-tuning isn't a convenient way to revoke access to a single file immediately. Plain code is better for exact calculations, comparisons and rules we already know. I don't need a model to check whether a number is positive. The methods can be combined, but each extra layer should solve a specific, measured problem.
Why it matters: Tests choosing the right tool, not a wish to use AI everywhere.
Possible follow-ups: What about knowledge that changes every day? When would training be an unnecessary cost?
How did it go? Be honest — “Not yet” puts the question on your review list.
Start with
- F-P01 · What is an LLM? — LLM fundamentals and AI engineering
- F-P03 · What are a token and a context window? — LLM fundamentals and AI engineering
Further reading
- Anthropic: Building effective agents(opens in a new tab)19.12.2024. Workflows versus agents; architectural patterns. The tools in the article have evolved since.