An AI assistant gives the wrong answer. One team says, “Improve the prompt.” Another says, “Add RAG.” A third proposes fine-tuning. All three can be right—but they solve different failures.
The durable distinction is:
- Prompt engineering changes the instructions available now.
- RAG changes the knowledge available now.
- Fine-tuning changes behavior encoded in the model.
Diagnose whether the system misunderstands the task, lacks information, or repeatedly behaves the wrong way. Then choose the smallest intervention that fixes the measured problem.
The decision tree
Does the base model have the capability and knowledge?
├─ Yes, but output is inconsistent → improve prompt, examples, schema, tools
├─ No, knowledge is private/current/citable → use RAG
└─ No, behavior or specialized pattern is stable and repeated
├─ Enough high-quality training data? → evaluate fine-tuning
└─ Not enough data → prompt/RAG first; collect corrections
Does knowledge change often?
├─ Yes → RAG or tools, not weight memorization
└─ No → fine-tuning may complement prompts if behavior gain is measurable
Most teams should begin with prompting, establish an eval, add RAG for knowledge, and fine-tune only after the failure pattern and data justify it.
What prompt engineering actually changes
A prompt can define role, objective, constraints, context, examples, output schema, and refusal behavior. It can break a task into steps or expose tools. It does not teach the model new facts permanently or guarantee behavior outside that context.
Use prompting when:
- the base model can already perform the task;
- instructions fit comfortably in context;
- requirements change frequently;
- you are still discovering the workflow;
- a few examples correct the format;
- you need the fastest, cheapest experiment.
Example: a model summarizes support tickets but omits severity and affected product. Add a JSON schema, definitions, and three representative examples. Fine-tuning would be premature.
Prompting advantages
- Immediate iteration
- No training pipeline
- Easy to inspect and version
- Works across model providers
- Good for dynamic policies and formats
Prompting limits
- Repeated instructions consume tokens
- Long prompts can become brittle
- Behavior may vary across model updates
- It cannot reliably supply missing private facts
- Large example sets increase cost and latency
Prompt engineering is not clever phrasing. It is interface design between a task and a probabilistic system.
What RAG changes
Retrieval-augmented generation searches an external knowledge source, selects relevant passages, and places them into the model context. The model answers using information it did not need to memorize during training.
Use RAG when:
- knowledge is private or proprietary;
- facts change frequently;
- answers need citations;
- access permissions differ by user;
- the source corpus is too large for a prompt;
- you need to update knowledge without retraining.
Example: an HR assistant answers policy questions. Policies change, employees have different access, and answers must cite the current document. RAG is the natural foundation.
RAG advantages
- Current, attributable knowledge
- Documents update independently of the model
- Access control can operate at retrieval
- Users can inspect sources
- Often cheaper than retraining
RAG limits
- Retrieval can select the wrong passage
- Chunking can destroy context
- Indexes can be stale
- Citations can be present but unsupported
- Prompt injection can arrive through documents
- It does not automatically change tone or deep behavior
Evaluate retrieval separately from generation. Measure whether the correct evidence appeared in the top results before blaming the model's answer.
What fine-tuning changes
Fine-tuning updates model weights using examples. Depending on method and provider, it can specialize style, output structure, classification boundaries, tool behavior, domain patterns, or efficiency.
Use fine-tuning when:
- the desired behavior is stable and repeated;
- prompting works but is too long or expensive;
- the base model consistently misses a domain pattern;
- you have clean representative input-output pairs;
- you can run holdout evaluations;
- the expected volume justifies training and maintenance.
Example: a company classifies millions of product listings into a stable taxonomy. Thousands of reviewed examples exist, and a smaller tuned model could match a large general model at lower serving cost.
Fine-tuning advantages
- Encodes repeated behavior compactly
- Can improve consistency on a narrow distribution
- May allow a smaller model to do the job
- Reduces repeated few-shot prompt tokens
- Can specialize tool use or format
Fine-tuning limits
- Needs high-quality data and evaluation
- Can overfit or regress general capabilities
- Does not provide reliable current-fact storage
- Must be repeated as requirements or base models change
- Adds governance, versioning, and rollback work
Our fine-tuning guide covers training mechanics in depth.
The most common category errors
Fine-tuning a knowledge base
Teams train on product documentation and expect exact current answers. Weights compress patterns; they do not provide a verifiable record lookup. When pricing or policy changes, the model can blend old and new. Use RAG for facts and fine-tuning for behavior.
Adding RAG to a behavior problem
A model retrieves the right refund policy but still ignores the required approval threshold. Retrieval worked. Fix instructions, schema, tool permissions, or behavior tuning.
Prompting around a missing capability
A prompt cannot force a weak model to perform reliable visual reasoning or complex code changes beyond its capability. Change model, add a deterministic tool, or narrow the task.
Fine-tuning before defining success
A training loss can improve while user outcomes worsen. Build the business eval first. Hold back data the model never sees during training.
A worked customer-support example
Goal: answer account questions using approved documentation, cite evidence, adopt the company voice, and escalate high-risk cases.
Prompt layer
- Defines answer schema
- Requires citations
- Specifies escalation rules
- Includes current user and channel context
RAG layer
- Retrieves product and policy passages
- Filters by region and user permissions
- Returns document version and URL
Fine-tuned layer, if justified
-
Learns stable support tone
-
Improves intent classification
-
Produces consistent tool arguments
-
Allows a smaller model to handle routine tickets
Deterministic layer
- Reads account status from an API
- Enforces refund limits
- Records approval and audit trail
No one technique owns the whole system.
Cost comparison
| Method | Upfront cost | Per-request cost | Maintenance cost |
|---|---|---|---|
| Prompting | Low | Grows with repeated context | Prompt tests and model migrations |
| RAG | Medium | Retrieval plus added input tokens | Indexing, permissions, freshness, evals |
| Fine-tuning | High | Can lower serving cost | Data, retraining, regression tests, versions |
A long few-shot prompt sent one million times may justify fine-tuning. A policy library updated weekly usually justifies RAG. A pilot with 200 requests usually justifies neither complex infrastructure nor custom training.
Use AI token pricing, explained to model repeated prompt and retrieved-context costs.
Evaluation plan by method
Prompt evaluation
Test instruction following, schema validity, edge cases, refusals, and portability across model versions.
Retrieval evaluation
Track recall at k, ranking quality, permission correctness, freshness, and whether the cited passage supports the answer.
Fine-tuning evaluation
Use a held-out test set. Compare the tuned model with the untuned baseline, a stronger model, and a better prompt. Check regressions outside the narrow task.
End-to-end evaluation
Measure accepted task rate, harmful error rate, human repair, latency, and cost. A component can improve while the total workflow worsens.
Learn the literacy behind those decisions in how to read an AI benchmark.
Data requirements for fine-tuning
Quality dominates quantity. A thousand consistent, expert-reviewed examples can outperform a larger noisy set. Remove duplicates, leakage, confidential information without permission, contradictory labels, and outputs the production system should never imitate.
Document:
- source and consent;
- annotation instructions;
- class and scenario coverage;
- train/validation/test split;
- known blind spots;
- deletion and retention requirements.
Do not train on production corrections blindly. A hurried human edit may solve one case while violating policy elsewhere.
Security considerations
Prompts can leak system instructions. Retrieved documents can contain prompt injection. Fine-tuning data can contain secrets or licensed content. Each method changes the attack surface.
Keep tool permissions outside model text. Enforce access before retrieval. Treat retrieved content as untrusted. Scan training data and preserve lineage. Red-team the combined workflow, not merely the base model.
A practical adoption sequence
- Define task and acceptance test.
- Establish a base-model prompt baseline.
- Add structured output and deterministic tools.
- Add RAG only if missing/current knowledge causes failures.
- Collect reviewed cases and failure labels.
- Evaluate fine-tuning if behavior remains stable and valuable.
- Compare total cost and accepted outcomes.
- Maintain versions, monitoring, and rollback.
This sequence generates evidence at each step and prevents an architecture choice from becoming the project goal.
Bottom line
Use prompts to tell the model what to do now. Use RAG to give it current, private, or citable knowledge now. Use fine-tuning to teach a repeated behavior that should persist across requests.
Combine them when the task needs all three, but keep deterministic business rules and permissions outside the model. The simplest system that passes the evaluation is usually the best system to operate.
A diagnosis exercise before architecture review
Take twenty recent failures and label each one before proposing technology. Use four buckets: instruction failure, missing knowledge, capability failure, and deterministic-rule failure. If reviewers disagree on the label, clarify the desired outcome and evidence first; an ambiguous requirement cannot select an architecture.
For instruction failures, test a better prompt and schema. For knowledge failures, measure whether retrieval finds the correct source. For stable behavior failures, compare a tuned model only after collecting consistent examples. For deterministic rules—permissions, totals, eligibility, state transitions—move the decision into code or a controlled tool.
Run the revised system on a held-out set. This prevents a common meeting pattern in which every specialist recommends the system they know. The retrieval engineer sees a RAG problem, the model team sees training data, and the prompt expert sees wording. A labeled failure set makes the intervention falsifiable and gives the team a reason to remove infrastructure when a simpler layer already solves the issue.
Related on explainx.ai
- How to choose open-weight or closed models
- AI token pricing, explained
- How AI agents work end to end
- What is an agent harness?
- Top open and closed agent harnesses
The right method depends on data, model, task, evaluation, security, volume, and operating constraints. Fine-tuning and retrieval can introduce privacy, licensing, and safety risks; review current provider terms and your own requirements.
