When building applications on top of large language models, the most common strategic question we encounter is how to adapt a general-purpose model to a specific business context. The conversation often quickly centres on two acronyms: RAG and fine-tuning. Choosing between them—or combining them—has significant implications for cost, performance, and long-term maintenance.
The decision is not merely technical. It is a product and financial decision that determines how quickly you can launch, how much you will spend, and how reliable your final application will be. This guide provides a decision framework for CTOs, product leaders, and enterprise buyers to navigate this choice. We will examine the trade-offs numerically and operationally, based on our experience building enterprise AI systems.
Three Levers for Influencing LLM Behaviour
To make an informed choice between fine-tuning and RAG, it's essential to understand that they are just two of three available levers you can pull to control a model's output.
Prompt Engineering: The Foundation
Prompting is the most direct way to guide an LLM. It involves carefully crafting the input text—the prompt—to elicit the desired response. This can range from simple instructions ("Summarise this document") to complex, structured prompts containing few-shot examples, where you provide the model with several demonstrations of the task you want it to perform within the prompt itself.
- What it's good for: Quick prototyping, simple tasks, directing the model's focus for a single turn.
- Limitations: The context window is finite; complex instructions can be difficult to follow consistently; controlling for a specific tone or JSON format is unreliable; costs increase with longer prompts on token-based models.
Prompt engineering is not a competing approach but the foundation upon which both RAG and fine-tuning are built. Every interaction with an LLM starts with a prompt.
Retrieval-Augmented Generation (RAG): The Open-Book Exam
RAG is a technique that provides the LLM with external knowledge at inference time. Instead of relying solely on the information baked into its training data, the model gets to consult a specific, up-to-date set of documents to answer a question.
Think of it as an open-book exam. The student (the LLM) is smart and has general knowledge, but for specific, detailed questions, you allow them to look up the answer in a textbook you've provided (your knowledge base). This process typically involves a vector database where your company's documents (PDFs, Confluence pages, support tickets) are stored as embeddings. When a user asks a question, the system retrieves the most relevant chunks of text and passes them to the LLM as part of the prompt. For a detailed breakdown, see our guide on RAG architecture.
- What it's good for: Answering questions based on specific, proprietary, or rapidly changing information. Reducing hallucinations by grounding the model in facts. Providing source attribution.
- How it works: Augments the prompt with factual data retrieved at inference time.
Fine-Tuning: Teaching a New Skill
Fine-tuning adjusts the model's internal parameters—its weights—by continuing the training process on a smaller, task-specific dataset. This dataset consists of many high-quality examples of inputs and their ideal outputs.
If RAG is an open-book exam, fine-tuning is like sending the student to a specialised course to learn a new skill or style. You are not primarily giving it new facts; you are changing its inherent behaviour. After fine-tuning, the model becomes intrinsically better at a specific task, such as adopting a particular brand voice or generating code in a proprietary language.
- What it's good for: Changing the model's style, tone, or output format. Teaching it a new capability that can't be explained in a prompt. Optimising performance on a narrow, repetitive task.
- How it works: Modifies the model's weights before inference through training.
Decision Matrix Across Six Dimensions
To choose the right path, you must weigh the trade-offs. We use a simple matrix to compare prompt engineering, RAG, and fine-tuning across six dimensions critical to any project.
| Dimension | Prompt Engineering | RAG (Retrieval-Augmented Generation) | Fine-Tuning |
|---|---|---|---|
| Implementation Cost | Very Low | Medium | High |
| Operating Cost | Pay-per-token (can be high with long prompts) | Pay-per-token + Vector DB/Orchestration | Hosting (if self-hosted) or pay-per-token (API) |
| Performance (Factual Accuracy) | Low (relies on model's internal knowledge) | Very High (grounded in provided documents) | Can improve, but can also increase hallucinations if not done well |
| Performance (Style/Tone/Format) | Difficult to enforce consistently | Limited control (depends on base model) | Very High (primary use case) |
| Data Requirements | None (or a few examples for few-shot) | Unstructured documents (PDFs, text, HTML) | Thousands of high-quality, labelled examples |
| Maintenance Burden | Low (update prompts) | Medium (update knowledge base) | High (re-train model on new data or for new base models) |
Factual Accuracy: This is RAG's home ground. By providing the exact text needed to answer a query, RAG dramatically reduces the risk of the model inventing facts (hallucinating). Fine-tuning does not inherently inject knowledge; it teaches patterns. We have seen instances where fine-tuning on a small, biased dataset actually increased hallucinations because the model over-optimised on spurious correlations in the training data.
Style and Format Control: This is where fine-tuning excels. If you need an LLM to consistently output valid JSON for API calls, or summarise reports into a rigid XML structure, or always speak with the formal tone of a 19th-century butler, fine-tuning is the most reliable method. It alters the model's core behaviour, making the desired style its new default.
When Fine-Tuning Genuinely Wins
Given the higher cost and complexity, the bar for choosing fine-tuning should be high. In our engagements, we recommend it only when RAG and prompt engineering have been pushed to their limits and found wanting. The winning use cases for fine-tuning are about behaviour, not knowledge.
1. Enforcing a Consistent Structure or Format
When your application requires the LLM to be a predictable component in a larger software system, output format is non-negotiable.
- Example: A European insurer needed to automate the initial summary of inbound damage claims, which fed into a downstream rules engine. The output had to be a specific JSON object with nested fields for
policy_id,incident_type,estimated_damage_eur, andthird_party_involved. While prompt engineering got it right 80% of the time, the 20% failure rate caused the entire pipeline to break. Fine-tuning a model on 5,000 examples of claim reports and their corresponding JSON outputs achieved >99.5% format adherence.
2. Adopting a Specific Style or Tone of Voice
For customer-facing applications, brand identity is paramount. Fine-tuning can imbue a model with a distinct personality that is impossible to maintain with prompting alone.
- Example: A luxury e-commerce brand wanted a chatbot to handle product queries. Their brand voice was sophisticated, minimalist, and slightly witty. Prompts like "respond in a witty but sophisticated manner" produced inconsistent and often caricatured results. Fine-tuning on a dataset of several thousand ideal conversations crafted by their marketing team resulted in a model that naturally adopted the target persona.
3. Teaching a New, Nuanced Skill
Sometimes the task is too complex or nuanced to describe in a prompt. You need the model to learn by example.
- Example: Classifying legal documents according to a firm's proprietary 50-category taxonomy. The distinctions between categories like "subordinated debt agreement" and "mezzanine financing facility" were subtle and depended on the interplay of multiple clauses. RAG could retrieve relevant clauses, but the base model struggled to make the final classification correctly. Fine-tuning on thousands of lawyer-classified documents taught the model this specific classification skill.
4. Cost and Latency Optimisation at Extreme Scale
If you are running millions of inference calls per day, the economics can shift. A large, general-purpose model like GPT-4o might be too slow or expensive per token. Fine-tuning a smaller, open-source model (like a member of the Llama 3 family) and hosting it yourself on optimised hardware can lead to lower latency and a lower total cost of ownership, despite the high upfront investment. This is an advanced move that requires significant MLOps capability.
What we would NOT do: We would never advise a client to use fine-tuning as the primary method for teaching an LLM new factual information, such as the details of a new product launch. Knowledge is volatile; it changes. Constantly re-training a model to keep up is inefficient and expensive. This is the exact problem RAG was designed to solve.
Data Requirements and Labelling Cost
The single biggest hidden cost in a fine-tuning project is data preparation. While RAG can work with the documents you already have, fine-tuning requires a purpose-built, high-quality dataset.
For RAG, the main challenge is a data engineering one: sourcing, cleaning, and chunking your existing documents. This might involve building pipelines from Confluence, SharePoint, or internal databases into a vector store. The effort is non-trivial but leverages existing assets.
For fine-tuning, you need to create a dataset of prompt-completion pairs. This often requires expensive domain experts to manually craft thousands of ideal outputs.
Worked Example: The Cost of a Fine-Tuning Dataset
Let's revisit the European insurer wanting to fine-tune a model to summarise claims.
- Goal: Create a dataset of 5,000 high-quality examples.
- Process: A senior claims adjuster must read a raw claim report and write the perfect, structured JSON summary.
- Assumptions:
- Time per example: 15 minutes (0.25 hours) for a complex claim.
- Blended hourly cost of a senior adjuster (salary + overheads): €90/hour.
- Calculation:
- Total expert time required: 5,000 examples * 0.25 hours/example = 1,250 hours.
- Total labelling cost: 1,250 hours * €90/hour = €112,500.
This €112,500 cost is incurred before a single line of MLOps code is written or any GPU time is consumed. It is a stark illustration of why fine-tuning is a significant undertaking and should not be pursued lightly.
Maintenance Burden Over 12 Months
An AI system is not a one-time build. The maintenance burden is a critical factor in its total cost of ownership.
The maintenance of a RAG system primarily revolves around its knowledge base. When new product documentation is released, you add it to the vector store. When old information becomes obsolete, you remove or update it. This is typically an automated process—a data pipeline that runs nightly or weekly. The model itself remains static. If a better base model is released, you can often swap it in with minimal changes to your retrieval logic.
The maintenance of a fine-tuned model is far more complex.
- Model Drift: When a new, more capable base model is released (e.g., from GPT-4 to GPT-5), your fine-tuning work is not automatically transferable. You must re-run the entire fine-tuning process on the new base model to benefit from its improvements, incurring new compute costs and potentially requiring adjustments to your dataset.
- Data Drift: The nature of your task may change. If the insurer introduces a new claim type, the model's performance will degrade. You need to create new labelled data representing this change and execute another fine-tuning run.
- MLOps Overhead: You need robust versioning for datasets, models, and training runs. You need a process for evaluating new models against the old ones before deploying them. This is a significant operational lift.
Here is a comparison of typical maintenance scenarios over a year:
| Maintenance Scenario | RAG System Effort | Fine-Tuned System Effort |
|---|---|---|
| New information is added (e.g., new product docs) | Low: Run ETL job to ingest new docs into vector store. | N/A (unless it changes the task itself). |
| Information is updated (e.g., API parameter changes) | Low: Update or replace existing docs in vector store. | N/A (unless it changes the task itself). |
| Output format needs a minor tweak | Low: Update the system prompt. | High: Regenerate part of the dataset, re-run fine-tuning job. |
| Base LLM provider releases a major new model | Low: Test and deploy the new model endpoint. | High: Re-run fine-tuning job on the new base model, test, and deploy. Significant cost. |
| Business discovers a new type of task to handle | Medium: Add relevant docs and potentially adjust prompts. | Very High: Create an entirely new labelled dataset and run a new fine-tuning project. |
The Hybrid Architecture Most Teams Converge On
The most powerful and mature AI systems we build often don't treat RAG and fine-tuning as an "either/or" choice. They use both, in a hybrid architecture where each component plays to its strengths.
In this setup, RAG acts as the knowledge provider, and the fine-tuned model acts as the skilled reasoner and communicator.
Here is a typical request flow:
+-----------------+
| User Query |
+-----------------+
|
v
+-----------------------------+ +----------------------+
| 1. Query Pre-processing |----->| Vector Database |
| (e.g., entity extraction) | | (Your company docs) |
+-----------------------------+ +----------------------+
| ^
v |
+--------------------------------+ |
| 2. Similarity Search / Retrieve|---------------+
| Top-K Relevant Chunks |
+--------------------------------+
|
v
+--------------------------------------+
| 3. Construct Prompt with Context |
| (Query + Retrieved Chunks + Rules) |
+--------------------------------------+
|
v
+--------------------------------------+
| 4. Call Fine-Tuned LLM |
| (Model skilled in your tone & format)|
+--------------------------------------+
|
v
+--------------------------------------+
| 5. Post-processing & Validation |
| (e.g., validate JSON schema) |
+--------------------------------------+
|
v
+-----------------+
| Final Answer |
+-----------------+
This hybrid pattern delivers the best of both worlds:
- Factual accuracy from RAG, which grounds the response in real, up-to-date documents.
- Behavioural consistency from the fine-tuned model, which ensures the response adheres to the required style and format.
This is the kind of sophisticated system our AI engineering teams design for clients with complex, mission-critical requirements.
Worked Cost Comparison: RAG vs. Fine-Tuning
Let's make this concrete with a one-year cost projection for a typical internal application.
- Scenario: A Series A logistics platform wants to build an internal AI assistant that helps its 100 operations staff answer complex questions about shipping regulations across EU member states. The knowledge is contained in about 2,000 PDF documents and internal wiki pages.
- Usage: Each of the 100 users makes an average of 20 queries per day.
- Annual Queries: 100 users * 20 queries/day * 250 workdays/year = 500,000 queries/year.
Approach 1: RAG with a Premium API Model (e.g., Anthropic Claude 3 Opus)
-
Development: Initial setup of RAG pipeline, data ingestion, and a simple UI. We'll estimate this at €50,000 for a senior engineering team.
-
Infrastructure: Vector database hosting, orchestration server, and data pipeline processing. A reasonable estimate is €400/month, or €4,800/year.
-
Inference: Assume an average prompt (with context) + completion size of 4,000 tokens. Claude 3 Opus costs (as of mid-2024) are ~$22.50 per million tokens (blended).
- Inference cost = 500,000 queries * 4,000 tokens/query * (€22.50 / 1,000,000 tokens) = €45,000/year.
-
Total Year 1 Cost (RAG): €50,000 (Dev) + €4,800 (Infra) + €45,000 (Inference) = €99,800
Approach 2: Fine-Tuning a Self-Hosted Open Source Model (e.g., Llama 3 8B)
This approach is chosen because the company wants a very specific, terse format for the answers.
-
Data Labelling: The team decides they need 4,000 examples of questions and perfectly formatted answers. This requires a logistics regulation expert.
- Time per example: 20 minutes (0.33 hours).
- Expert's blended cost: €100/hour.
- Labelling cost = 4,000 examples * 0.33 hours/example * €100/hour = €132,000.
-
Development: More complex MLOps setup for training, hosting, and versioning. We'll estimate this at €70,000.
-
Infrastructure: A dedicated GPU server for hosting the fine-tuned model. A suitable cloud instance could cost €1,200/month, or €14,400/year.
-
Training Cost: The compute cost for the fine-tuning run itself. This is relatively low, perhaps €1,000 for a few runs.
-
Total Year 1 Cost (Fine-Tuning): €132,000 (Data) + €70,000 (Dev) + €14,400 (Infra) + €1,000 (Training) = €217,400
For this common internal use case, the RAG approach is less than half the cost in the first year. The fine-tuning approach only becomes economically viable if the query volume were orders of magnitude higher, or if the formatting requirement was an absolute, unshakeable business constraint. Building effective internal AI assistants almost always begins with RAG.
Frequently Asked Questions
Should we fine-tune or use RAG?
The default and recommended starting point for almost every use case is Retrieval-Augmented Generation (RAG). It's faster to implement, easier to maintain, and provides higher factual accuracy by grounding the model in your specific data. You should only consider fine-tuning after you've exhausted the capabilities of RAG and prompt engineering. Fine-tuning becomes necessary when your primary goal is to teach the model a new skill or enforce a consistent structure or tone, and you have a large dataset of several thousand high-quality examples to train it on. It can also be a cost and latency optimisation at very high scale, but this should be carefully benchmarked.
Key Takeaways
- Start with RAG. For any task that requires knowledge from your company's documents, RAG is the most direct, cost-effective, and maintainable solution. It should be your default choice.
- Fine-tuning is for behaviour, not knowledge. Use fine-tuning to change a model's style, format, or to teach it a new, nuanced skill. Do not use it as the primary way to inject factual information.
- The cost of data is real. Underestimate the cost and effort of creating a high-quality, labelled dataset for fine-tuning at your peril. It is often the largest single expense in the project.
- Hybrid systems offer the most power. For mature, mission-critical applications, a hybrid architecture that uses RAG for knowledge and a fine-tuned model for reasoning and formatting offers the best of both worlds.
- Model maintenance is an ongoing cost. RAG systems are generally easier to keep up-to-date (update the docs) than fine-tuned systems (re-train the model).
- Analyse the full TCO. A proper decision requires a full analysis of the total cost of ownership, including initial development, data preparation, infrastructure, inference, and ongoing maintenance. If you need help with this analysis, our AI consulting team can provide a detailed assessment.
Choosing the right customisation approach is a foundational decision with long-term consequences for your budget, team, and product performance. It requires a clear-eyed assessment of your specific goals, data assets, and operational capacity, moving beyond the hype to focus on tangible business value. The right architecture depends on your scale and the specific problem you are solving, as we've seen in our work with clients from funded startups to large enterprises.
If you need a strategic partner to help you navigate these trade-offs and build a production-ready AI solution that delivers real results, schedule a strategy session with our team.

