Fine-tuning vs RAG vs prompt engineering: how to customize an LLM

There are three main ways to make a large language model work for your business. Prompt engineering shapes its instructions, retrieval-augmented generation (RAG) gives it your knowledge, and fine-tuning changes its behavior. Here is what each one does, what it costs, when to use it and how to combine them.

Short answer

Start with prompt engineering, since it is the cheapest and fastest way to shape an LLM's behavior. Add retrieval-augmented generation (RAG) when the model needs your own, changing or private knowledge, with sources. Use fine-tuning when you need consistent style, format or a specialized task at scale that prompts can't achieve. Many production systems combine all three.

Fine-tuning vs RAG vs prompt engineering: how to customize an LLM

Out of the box, a large language model knows a lot about the world and nothing about your business. It doesn't know your products, your policies, your customers or the way your team writes. To build something useful, you have to customize it, and there are three main ways to do that.

Teams often reach for the most technical-sounding option first. In practice, the right choice depends on what problem you are solving. This guide explains each approach in plain terms and shows how to decide.

The three approaches at a glance

Prompt engineeringRAGFine-tuning
What it changesThe instructions and examples you sendThe information the model sees for each requestThe model's learned behavior
Best forTone, rules, format, task framingKnowledge: documents, policies, products, dataConsistent style or format, specialized tasks, efficiency at scale
Keeps up with changesEdit the promptUpdate the content indexRetrain the model
Can cite sourcesNoYesNo
Upfront effortLowMediumMedium to high
Data neededA few examplesYour contentHundreds or thousands of quality examples

Prompt engineering: shaping instructions

Prompt engineering means writing the instructions, context and examples you send with each request. It covers:

  • Role and rules: what the assistant does, what it must never do, how it handles uncertainty.
  • Output format: structured responses such as JSON, headings or specific fields.
  • Examples: a few sample inputs and ideal outputs that show the model what good looks like.
  • Task breakdown: splitting complex work into steps, or chaining several calls together.

Use it when the model already has the knowledge and ability, and you need it to behave a certain way. Modern models follow detailed instructions well, so prompt engineering solves more problems than many teams expect.

Limits: prompts can't add large amounts of knowledge, and very long prompts increase cost and response time on every request.

Always start here. Good prompts are also the foundation for the other two approaches.

RAG: giving the model your knowledge

Retrieval-augmented generation retrieves relevant information from your own content for each request and adds it to the prompt, so the model answers from that information.

  1. Your documents, help articles, product data or records are split into sections and indexed for search by meaning.
  2. When a question arrives, the system finds the most relevant sections.
  3. The model writes its answer using those sections, ideally with references to the sources.

Use it when answers depend on your knowledge, especially knowledge that changes, is private or must be traceable. Customer support assistants, internal knowledge search, policy questions and product advisors are classic RAG use cases.

Strengths: you update knowledge by updating content, not retraining; you can show sources; and you can restrict what each user can see based on their permissions.

Limits: quality depends heavily on retrieval. If the system finds the wrong sections, the model gives the wrong answer confidently. Our article on RAG done right covers how to build retrieval that works, and our guide on how to build an AI chatbot for your website shows RAG in a real product.

Fine-tuning: changing the model's behavior

Fine-tuning continues training a model on your own examples of inputs and ideal outputs, so the new behavior is built into the model itself.

Use it when:

  • You need a consistent style, tone or format that prompts can't achieve reliably.
  • You have a specialized task, such as classifying support tickets into your categories, extracting fields from your document types or writing in a domain-specific way.
  • You want to use a smaller, cheaper or faster model that performs as well as a larger one on your specific task.
  • Your prompts have become very long with instructions and examples, and you want to reduce cost and response time.

Limits: fine-tuning needs hundreds to thousands of high-quality examples, careful evaluation and retraining when requirements change. It is not a reliable way to teach a model facts: a fine-tuned model may still invent details and can't cite sources, and its knowledge goes out of date. For knowledge, use RAG.

A common misconception

"We need to fine-tune the model on our documents so it knows our business" is one of the most common requests, and usually the wrong approach. Fine-tuning on documents teaches style and patterns better than facts. RAG is generally more accurate, cheaper to maintain and easier to keep current for knowledge-based use cases.

How to decide

Work through these questions in order:

  1. Can a well-written prompt with a few examples do the job? Test it properly with real inputs. If yes, stop here.
  2. Is the gap knowledge? If the model needs your documents, data or current information, add RAG.
  3. Is the gap consistency, format or efficiency at scale? If prompts plus RAG still produce inconsistent output, or costs are too high at your volume, consider fine-tuning.
  4. Do you have the data? Fine-tuning needs a quality dataset of examples. If you don't have one, collect examples from your prompted system first.

Combining the approaches

Production systems often use all three:

  • A fine-tuned model that reliably follows your format and tone,
  • RAG that supplies the current, relevant knowledge for each request,
  • and a prompt with the rules, context and the user's question.

For example, a support assistant might use a model fine-tuned on approved past replies for tone and structure, RAG over the help center for accurate answers, and a prompt with escalation rules.

Measure before and after

Whichever approach you choose, build an evaluation set first: real inputs with expected outputs or quality criteria. Measure the baseline, make one change at a time and compare. Without measurement, it is impossible to know whether a fine-tune or a new retrieval method actually helped. Our guide on measuring the ROI of AI projects explains how to connect these quality measures to business results.

Cost comparison

  • Prompt engineering: low upfront cost; running cost grows with prompt length.
  • RAG: moderate upfront cost for content preparation, indexing and retrieval engineering; ongoing cost for search infrastructure and content upkeep.
  • Fine-tuning: upfront cost for dataset preparation, training and evaluation; retraining when requirements change; potentially lower running costs if it lets you use a smaller model.

Our article on how much it costs to build an AI app breaks down build and running costs in more detail.

The bottom line

Start with prompt engineering, add RAG when the model needs your knowledge, and fine-tune when you need consistent behavior or efficiency that prompts and retrieval can't deliver. Measure every step against real examples, and combine approaches where it makes sense.

At Kreatorz we design and build LLM systems with prompting, retrieval and fine-tuning, chosen to fit the problem and measured against real data. See our LLM development and RAG development services, or tell us what you want your AI to do.

Frequently asked questions

What is the difference between fine-tuning and RAG?

RAG retrieves relevant information from your content for each request and gives it to the model, so answers reflect current knowledge and can cite sources. Fine-tuning trains the model on your examples to change its behavior, such as style, format or a specialized task. RAG adds knowledge; fine-tuning adds skills.

Should I use RAG or fine-tuning for my company's documents?

Usually RAG. It keeps answers grounded in your current documents, lets you show sources and update knowledge without retraining, and can respect user permissions. Fine-tuning on documents is less reliable for facts and goes out of date when the documents change.

When is fine-tuning worth it?

When you need consistent output style or format that prompts can't achieve, a specialized task such as classification or extraction, or a smaller and cheaper model that performs well on your task at high volume. You also need enough high-quality examples and a way to evaluate results.

Is prompt engineering enough for production?

Often, yes, especially with modern models that follow instructions well. Many production features use carefully tested prompts with a few examples. Add RAG when you need your own knowledge, and fine-tuning when you need consistency or efficiency beyond what prompts deliver.

Can I combine fine-tuning and RAG?

Yes, and many production systems do. A fine-tuned model can provide consistent tone, format and task skills, while RAG supplies current, relevant knowledge for each request. The prompt then adds rules and context.

How we can help

All services

See it in practice

All projects
All insights

Got an idea? Let’s make it real

Let’s put this to work for you.