TecnoStack
Start a projectالعربية
A measured failure points to the smallest of three nested changes, with a re-test loop still open.
AI engineering

Fine-tuning vs RAG is the wrong first question. Find out why your answers fail: unclear instructions, missing knowledge or a behaviour the model keeps getting wrong. Then make the smallest change that fixes it and re-test.

In this article

Silent video with on-screen text. The transcript below repeats every screen and describes what it shows.

Watch on the video page

  1. 0:00–0:06

    Outdated price answer • Collect real failures • Real wrong answers • Expected answer beside each

    The Outdated price answer badge stays fixed in its lane. Three real wrong answers arrive one after another, each a blank answer card with one row struck through. A blank expected-answer card with a small source page arrives beside each one, and a short line joins each pair. Then one more blank expected-answer card slides in and settles, joined to the badge by a line; the badge never moves.

  2. 0:06–0:12

    Outdated price answer • Ask three questions in order • Instruction first • Labelled failures • Instruction clear? • Facts available? • Same miss again?

    The article's three-questions figure appears whole: a stack of Labelled failures above a ladder of three question cards, Instruction clear?, Facts available? and Same miss again?, each with an empty ring beside it. A marker leaves the stack, steps down the first arrow to Instruction clear? and pauses there; that card is outlined and Instruction first points to it. The rings stay empty.

  3. 0:12–0:18

    Outdated price answer • An outdated price is a knowledge sign • Knowledge failure • No prompt creates missing facts • Instruction clear? • Facts available? • Same miss again?

    The ladder of three question cards appears; Instruction clear? and Same miss again? dim. The marker steps down to Facts available?, which is outlined. A Knowledge failure tag leaves that step's ring, travels up and attaches to the Outdated price answer badge by a line, and the note No prompt creates missing facts slides in under the tag.

  4. 0:18–0:24

    Outdated price answer • Change what the model sees • One change at a time • Prompt: what you ask • RAG: what it sees • Fine-tuning: its weights

    The article's where-each-change-acts figure appears whole: the request card under Prompt: what you ask, the stacked passages above RAG: what it sees and the model block with its lattice of weights above Fine-tuning: its weights, joined by one merging arrow. A highlight travels back from the arrow head along the passages' branch and stops at the passages, which are outlined with their label; the request and the weights stay unlit, and One change at a time appears.

  5. 0:24–0:30

    Outdated price answer • Re-test on the same set • Same test set • Compare with the last version • Result pending

    A line from the Outdated price answer badge leads to a dashed loop, and a Same test set card slides into it while the loop's dashes keep circling. Two blank result columns rise, and a bracket draws between them above Compare with the last version. A dashed arrow stops at an empty slot with an open ring, labelled Result pending. No result is shown.

Fine-tuning vs RAG depends on why your answers fail. If the model lacks facts, or the facts change, use retrieval-augmented generation (RAG). If the instructions are vague, improve the prompt. Fine-tune only when the model keeps getting one behaviour wrong despite clear instructions and the right facts. Make the smallest change that fixes the measured failure, then re-test.

The three approaches change different things. A prompt changes what you ask, RAG changes what the model can see at answer time, and fine-tuning changes the model's weights.

CriterionPrompt engineeringRAGFine-tuning
What changesThe instructions and examples you sendThe evidence added to each requestThe model's weights
FixesWrong format, language, tone or scopeMissing, outdated or company-specific factsA consistent behaviour that clear prompts cannot hold
Does not fixFacts the model never hadA task the model cannot do with good evidenceFacts that change, or access rules per user
Keeping knowledge currentEdit the promptUpdate the documents and re-indexRetrain and re-evaluate
Permissions per userOnly what you choose to includeFilter results by the user's accessNot possible inside the weights
Effort to tryLow, and easy to roll backAn index, a retriever and an evaluation setCurated examples, a held-out test set and a retraining plan

You find out by labelling real failures. Collect wrong outputs from testing or a small pilot, then ask three questions about each one, in this order:

  1. Instruction: did the prompt say what was wanted, including format, language, audience and what to do when unsure?
  2. Knowledge: did the model have the information the answer needed, in its context or reliably from training?
  3. Behaviour: with clear instructions and the right information, does the model still miss in the same way, again and again?

Instruction and knowledge fixes are usually cheaper to test, so rule them out first. Count the labels: the biggest category tells you where to start. If you have no test set yet, start by building a hallucination test set from real questions, with the expected answer and its source beside each one.

Labelled failures pass down three questions in order: instruction clear, facts available, and the same miss again.

Ask the three questions in this order for every labelled failure. Instruction and knowledge fixes are usually cheaper to test, so rule them out before you suspect a stable behaviour.

Prompt engineering is enough when the failures come from instructions the model never received. Typical signs: the output changes shape between runs, the answer arrives in the wrong language, summaries vary wildly in length, or the model invents a format nobody specified. Conflicting constraints or the model's own limits can produce the same symptoms, so test the fix rather than assume it.

State the task, the audience and the purpose. Define the output structure, as a schema your code can validate wherever possible. Give two or three examples of accepted outputs, including an Arabic one if your users write in Arabic. Say what the model should do when the information is insufficient, such as asking a question or declining.

OpenAI's model optimisation guide makes the same point: prompt engineering "may be all you need", and the work should start with evals that record a baseline. Version prompts like code and re-run the test set on every change. Prompt edits are cheap to test and easy to roll back.

RAG beats a longer prompt when the knowledge is too large, changes too often or must respect who may see what. Typical signs of a knowledge failure are outdated prices, invented policy details and confident answers that would be right for a different company. No instruction creates facts the model lacks.

If the knowledge is a few stable pages, put the parts the user may see straight into the prompt. Beyond that, use retrieval: search approved sources at question time, filter results by the user's permissions and cite the passages the answer used. The original RAG paper (Lewis et al., 2020) describes this as pairing the model's built-in, parametric memory with an external index it can read at answer time, and names provenance and updating knowledge as problems for models that rely on weights alone. For the full design, read how enterprise RAG works.

Questions about numbers in a database, such as last quarter's sales by region, need a different tool. Give the model an authorised, read-only query with row and tenant permissions enforced, and calculate totals in code. Text retrieval alone is a poor fit for aggregation.

A prompt changes the request going in, RAG adds evidence beside it at answer time, and fine-tuning changes the model's weights inside.

Each approach changes a different thing. A prompt changes what you ask, RAG changes what the model can see at answer time, and fine-tuning changes the model's weights.

Your RAG answers are wrong. Check retrieval first

If you already run RAG and answers are still wrong, look at the passages that reached the model before you change anything else. When the right passage is missing, the fault is in retrieval: chunks that split a clause from its conditions, missing metadata, weak search settings for Arabic text, or permission filters stricter than the policy intends. Query rewriting, retriever tuning or reranking can help. Do not loosen a valid permission to improve recall.

When the right passage arrived and the answer still drifted, go back to the instruction and behaviour questions. Fine-tuning the answer model does not repair a passage that retrieval never found.

Fine-tune an LLM when a stable behaviour still fails after clear instructions, good examples and the right facts. Fine-tuning adjusts the model's weights from examples of the outputs you want. Good candidates are a business-specific classification scheme the model keeps confusing, a house style it cannot hold across thousands of outputs, or a compact output format at high volume, where long prompts full of examples add cost and latency to every request.

As of October 2026, OpenAI's guide lists supervised fine-tuning for tasks such as classification and specific output formats, preference fine-tuning (DPO) for tone and style, and reinforcement fine-tuning for complex domain tasks graded by experts. The same guide names the trade: shorter prompts and smaller task-specific models in exchange for training work.

Before you fine-tune, try two cheaper alternatives:

  • A more capable base model. It may already handle the task, even if each call costs more.
  • Smaller steps. Split the task into stages, each with its own prompt and check. This fixes many judgement errors a single prompt cannot.

If you still need fine-tuning, plan for what it requires:

  • A curated set of training examples you are permitted to use, with an owner and a privacy review
  • A held-out test set the training never sees
  • A baseline score from the best prompt-only and RAG versions
  • A retraining plan for when the base model or your requirements change
  • A full re-evaluation, including regressions, before each version goes live

Where you can fine-tune is changing, so check the provider before you plan a project. As of October 2026:

  • OpenAI is winding down its self-serve fine-tuning platform. Since 7 May 2026, organisations that had never run fine-tuning cannot create jobs. From 2 July 2026, organisations with no fine-tuned-model inference in the previous 60 days lost job creation too, and on 6 January 2027 active customers lose it. Existing fine-tuned models keep serving until their base model is deprecated.
  • Google Vertex AI documents supervised fine-tuning for Gemini 3.5 Flash, Gemini 3.5 Flash-Lite, Gemini 3.1 Flash-Lite, Gemini 2.5 Pro, Gemini 2.5 Flash and Gemini 2.5 Flash-Lite.
  • Amazon Bedrock lists fine-tunable Amazon Nova, Titan, Claude 3 Haiku and Meta Llama models, in the US East (N. Virginia) or US West (Oregon) Region depending on the model.
  • Open-weight models can be fine-tuned on infrastructure you control, which also puts the training data, hosting and updates under your control. Our guide to open-weight or hosted Arabic models covers that trade-off for Arabic.

Where the training data and the tuned model live matters for personal data. Check the Region against your data-handling requirements before you upload examples.

Yes, if each addition earns its place. Retrieval for knowledge plus careful instructions for format is the most common pairing. Fine-tuning for a stable behaviour plus retrieval for changing facts is legitimate too. Trouble starts when your team ships several changes at once without a baseline: you cannot tell which one helped, or remove one with confidence.

Anthropic's engineering guidance on building agents recommends "finding the simplest solution possible, and only increasing complexity when needed", and notes that agentic systems often trade latency and cost for better task performance. The post dates from December 2024 and Anthropic marks its tooling details as changed since; the principle still holds. We apply it here: add one change at a time, measure it on the same test set and keep it only if the targeted failures fall while quality, security and cost checks still pass. If you are still deciding which workflows deserve this effort, start with how to choose internal copilot use cases.

How should you re-test after each change?

Treat every prompt, retrieval or model change as a release. Re-run the full test set by slice (language, document type, question type), compare it with the previous version and record what changed and why.

NIST's Generative AI Profile (NIST AI 600-1), published on 26 July 2024 as a companion to the AI Risk Management Framework, is voluntary guidance that can structure this documentation and risk review. As of October 2026, NIST's publication page lists no newer revision. The profile does not certify a system or guarantee accurate output.

Label your failures before you pick a technique. Fix instructions with a better prompt, missing or changing knowledge with retrieval, and a stubborn, stable behaviour with fine-tuning only after cheaper options fail on the same test set. These are TecnoStack's practical recommendations; neither OpenAI, Anthropic nor NIST requires them.

If knowledge failures top your list, our RAG and knowledge search service can start with a readiness review of your documents, their access rules and a question set to test against.

Discuss your website, store, app or AI project in Arabic or English. We agree the scope before work starts.

Book a free scoping callCompare services and prices