Courseiva
AIF-C01Chapter 12 of 16Objective 4.4

Fine-tuning and Customization of Foundation Models

How do you make an AI model that knows a little about everything into an expert on exactly your business data? That is the problem this chapter solves: customising a general-purpose AI to be your own specialist. For the AIF-C01 exam, you need to understand the three main ways to do this: fine-tuning, RAG, and agents, each of which is like a different method of teaching a clever but clueless intern.

12 min read
Advanced
Updated Jul 23, 2026
Reviewed by Johnson Ajibi· Senior Network & Security Engineer · MSc IT Security

A simple way to picture Fine-tuning and Customization of Foundation Models

The Family Recipe vs. Cooking Class Analogy

Because a foundation model is like a pre-written novel but missing the final chapter, you cannot just hand it a book report prompt and expect a perfect ending. This leads to the need for customising it to your specific story.

Imagine your grandmother has a famous spaghetti bolognese recipe. It is a great, general foundation. It makes a hearty, crowd-pleasing meal. But what if you are cooking for a friend who cannot eat gluten, another who is allergic to dairy, and you want a spicier sauce? The original, generic recipe is just a starting point.

Fine-tuning is like taking that base recipe and, through trial and error, adjusting the ingredients and cooking times until you have a special version that perfectly suits your exact guests. You are not inventing a new dish; you are perfecting an existing one. Retrieval-Augmented Generation, or RAG, is different. You keep the original recipe exactly as it is. But you also bring a specific set of 'extra notes' to the kitchen — say, a list of your friend's favourite vegetables. When you cook, you consult your recipe AND those specific notes together to make a custom meal. Finally, an agent-based approach is like creating an automated kitchen assistant. You give that assistant the recipe book and the special notes, plus a set of tools like a 'boil water' tool and a 'dice onions' tool. You then let it orchestrate the entire cooking process, making decisions about timing and tool use to achieve your goal of a perfect, customised dinner.

How It Actually Works

Let us start with the big picture. A foundation model, like Claude or GPT-4, is a massive AI system trained on gigantic amounts of public text and code from the internet. Think of it as a brilliant generalist who has read every book in the library but has never worked in your specific office. It understands language, logic, and facts, but it does not know your company's internal policies, your unique customer data, or the latest product catalogue. To make a foundation model useful for a specific business task, you need to customise it. The AIF-C01 exam tests three primary customisation techniques: Fine-tuning, Retrieval-Augmented Generation (RAG), and agents.

Fine-tuning is the process of taking a pre-trained foundation model and giving it a second, smaller training session on a specialised dataset. Imagine you want the model to be a world-class legal contract reviewer. You would gather thousands of example contracts and their reviews. You then let the model analyse these examples, adjusting its internal mathematical weights (the 'neurons' in its neural network) slightly to become better at that specific task. This is powerful but expensive and requires technical skill. It changes the model itself.

Retrieval-Augmented Generation, or RAG, solves a different problem. It does not change the model at all. Instead, it gives the model a 'library card' to your private data. Here is how it works step by step:

1. A user asks a question, such as "What is our refund policy for damaged items?" 2. The system takes that question and searches an external database of your company's documents (a 'vector database' of stored information). 3. It retrieves the most relevant chunks of text — perhaps the page from your policy PDF. 4. It sends BOTH the user's question AND the retrieved policy chunk to the foundation model. 5. The model reads the user's question, reads the relevant policy, and generates an answer based only on that context.

RAG is like giving a supremely smart assistant access to a filing cabinet you control. The assistant does not learn your secrets; it just looks them up each time. This is cheaper, more secure, and easier to update than fine-tuning. If your refund policy changes, you just update the document in the database.

Agent-based approaches are the most sophisticated. An 'agent' is a foundation model that has been given a persona and a set of tools it can use. Tools are functions like 'search_a_database', 'send_an_email', 'calculate_a_sum', or 'call_an_external_API'. The agent does not just generate text; it plans a series of actions, decides which tool to use for each step, and executes them. For example, a customer service agent might: receive a complaint, look up the customer's order in a database (using a tool), check the shipping status (using another tool), and then draft and send a refund email (using a third tool). The model acts as the 'brain' that orchestrates the workflow.

Why do these techniques exist? Early AI systems needed to be trained from scratch for every single task, which was impossibly expensive. Foundation models changed that by providing a single reusable 'brain'. Fine-tuning, RAG, and agents are the three main strategies for making that generic brain useful in the real world without starting from zero. They each have trade-offs: fine-tuning is best for deeply specialised, stable tasks; RAG is best for dynamic knowledge that changes frequently; agents are best for complex workflows requiring multiple steps and external actions.

A decision flowchart showing how a user question leads to either fine-tuning, RAG, or an agent approach, and the resulting path to an answer.

Walk-Through

1

Define Your Use Case

Clearly decide what you want the AI to do. Is it a static task like 'review insurance claims' (good for fine-tuning)? Or a dynamic, fact-based task like 'answer questions about today's inventory' (good for RAG)? Or a complex workflow like 'handle a full customer complaint from start to finish' (good for agents)? The use case dictates the technique.

2

Prepare Your Data

For fine-tuning, you gather high-quality pairs of input and the ideal output (e.g., 'Q: What is 2+2? A: 4'). For RAG, you chunk your documents into small, meaningful sections and convert them to vectors using an embedding model. For agents, you define the list of tools and write clear documentation for how each tool should be used.

3

Set Up the Infrastructure

For fine-tuning, you need compute resources (GPUs) and access to a model API that supports fine-tuning. For RAG, you need a vector database (like Pinecone or a simple one like Chroma) and an embedding pipeline. For agents, you need a framework (like LangChain) to manage the tool calling and state, plus a hosting environment.

4

Test and Iterate

You run a test set of inputs. For fine-tuning, you check if the model has improved on the specific task without losing general capability (catastrophic forgetting). For RAG, you check if the retrieved documents are actually relevant to the questions. For agents, you check if the agent picks the right tool in the right order. You then tweak data or prompts.

5

Deploy and Monitor

You put the system into production. You monitor the model's outputs for errors, bias, or harmful behaviour. You monitor the RAG retrieval accuracy. You log all agent tool calls. Because the underlying data may change (new products, new policies), you set up a workflow to regularly update the vector database or the fine-tuning dataset.

What This Looks Like on the Job

Consider a real-world scenario: a mid-sized e-commerce company, 'ElectroWorld', wants to build an AI assistant for its customer support team. The assistant needs to answer questions about thousands of products, handle returns, and update order statuses. The IT professional in charge — let us call her Priya — must decide how to customise a foundation model.

First, Priya defines the use case. She does not need the AI to write poetry; she needs it to be a factual, polite, and efficient support agent. She rules out full fine-tuning initially because the product catalogue changes every week (new products, new prices). Fine-tuning the entire model each week would be too slow and costly.

Instead, Priya implements a RAG system. She takes all the company's data — product descriptions, return policies, shipping FAQs, and warranty terms — and chunks them into small pieces. She uses a process called 'embedding' to convert each chunk into a mathematical vector (a list of numbers) and stores these vectors in a vector database. When a customer asks a question like "Is the BlueBlaster headset compatible with PlayStation 5?", the system converts the question into a vector and finds the most similar vectors in the database, retrieving the relevant product page. The foundation model then reads that page and crafts an answer. This took Priya and her team about two weeks to set up, and it works well for informational questions.

However, customers also ask, "I want to return my headset. Can you process it now?" This requires action, not just information. Priya then expands the system into an agent. She gives the foundation model access to three tools: 'search_order_database', 'process_refund', and 'send_email_summary'. She also writes a system prompt that tells the model: "You are a helpful, efficient support agent for ElectroWorld. You have access to tools. Use them one at a time. When a customer requests a return, first look up their order, then process the refund, then email them a summary." The agent now can handle the full workflow. The IT professional, Priya, spends her time maintaining the vector database (adding new products, removing discontinued ones), monitoring the agent's actions for errors, and updating the system prompt if the company changes its refund policy. She does not retrain the underlying foundation model. She simply orchestrates the tools and data around it.

The key takeaway for the IT professional is that they move from being a 'model trainer' to a 'system integrator'. They rarely touch the foundation model itself. Instead, they:

Set up the RAG pipeline: prepare documents, manage the vector database, and monitor retrieval accuracy.

Define agent tools: write the code that allows the AI to interact with databases, APIs, and email systems.

Write and iterate on system prompts: the critical instructions that shape the agent's behaviour.

Monitor and debug: they check logs to see if the agent used the right tool at the right time or if the RAG system returned the wrong document.

This is a huge shift from older IT jobs that involved managing databases or writing scripts. The core skill is now understanding how to guide an intelligent but inexperienced AI to do useful work safely.

How AIF-C01 Actually Tests This

The AIF-C01 exam tests your understanding of the differences between these three customisation approaches, not your ability to code them. You can expect scenario-based questions that describe a business problem and ask you to pick the correct technique.

Key exam topics:

The fundamental differences between Fine-tuning, RAG, and Agent-based approaches.

When to use each one based on constraints like cost, data privacy, and how often your data changes.

The components of a RAG system: vector database, embedding, retrieval, and the foundation model itself.

The concept of an 'agent' and its 'tools'.

What a 'prompt' is and how 'system prompts' differ from 'user prompts'.

Trap patterns the exam uses:

The exam will describe a scenario where a company needs to incorporate private, frequently changing data (like daily sales figures). They will offer 'Fine-tuning' as an answer choice because it sounds technical. The correct answer is RAG, because it is cheaper and easier to update.

They will present a situation requiring multi-step reasoning (like booking a flight: search, compare, book, confirm). A common trap is to suggest RAG. The correct approach is an agent, because RAG only retrieves information; it does not take actions.

They will ask about 'training data' and try to confuse you. Remember: fine-tuning uses training data to change the model. RAG does not use training data; it uses a retrievable knowledge base that does not change the model.

The exam may ask about 'model drift' or 'forgetting' in the context of fine-tuning. Fine-tuning can overwrite the model's general knowledge if you use too much specialised data. RAG avoids this entirely.

Key definitions to memorise for the exam:

Foundation Model: A large AI model trained on broad data, used as a base.

Fine-tuning: Providing additional training examples to adapt a model to a specific task.

Retrieval-Augmented Generation (RAG): Combining a foundation model with an external knowledge retrieval system.

Agent: A foundation model that can plan and execute tasks using external tools.

Vector Database: A database that stores data as mathematical vectors for efficient similarity search.

Embedding: The process of converting text (or images) into a vector.

Tool: A function an agent can call, like a search engine or calculator.

System Prompt: The initial instructions given to the model that define its role and behaviour.

Correct answer pattern: When the problem says 'frequently changing data' or 'proprietary data that must stay private', lean toward RAG. When it says 'need a consistent, specialised tone' or 'stable task like legal document review', lean toward fine-tuning. When it mentions 'multi-step tasks' or 'taking actions', lean toward an agent.

Key Takeaways

Fine-tuning modifies the model itself using a specialised dataset, making it better at a specific task but costly and hard to update.

RAG does not modify the model; it retrieves relevant documents from an external database and feeds them to the model as context for each question.

Agents are foundation models that can use external tools to plan and execute multi-step tasks, moving beyond simple text generation.

The primary advantage of RAG over fine-tuning is that it allows the model to access up-to-date or private data without requiring retraining.

A vector database stores information as mathematical vectors and enables fast similarity search, which is the core engine of a RAG system.

System prompts are the instructions you give an agent to define its role, personality, and the rules it must follow when using tools.

On the AIF-C01 exam, scenario questions will test your ability to choose between fine-tuning, RAG, and agents based on cost, data freshness, and task complexity.

Easy to Mix Up

These come up on the exam all the time. Here's how to tell them apart.

Fine-tuning

Changes the model's internal weights based on training data.

Best for stable, repetitive tasks with consistent data.

More expensive and time-consuming to set up and update.

RAG

Does not change the model; it retrieves external data on demand.

Best for tasks with frequently changing data or private knowledge.

Cheaper and easier to update; just swap the documents in the database.

Agent

Can plan and execute multi-step tasks using external tools.

Has memory and state to manage long, complex workflows.

Requires careful prompt engineering to avoid incorrect tool usage.

Standard Chatbot

Only generates text responses based on a single prompt or context.

Does not take any actions; it passively answers questions.

Simpler to build but limited in what it can accomplish.

Vector Database

Stores data as vectors (lists of numbers) for similarity search.

Best for finding 'related' or 'similar' content, not exact matches.

Used in RAG to retrieve the most relevant documents for a query.

Traditional SQL Database

Stores data in tables with rows and columns for exact matching.

Best for finding a specific record where you know the ID or value.

Not suitable for semantic search; cannot find contextually related text.

Watch Out for These

Mistake

Fine-tuning is the only way to make a foundation model use your company's private data.

Correct

RAG is often a better choice because it allows the model to access private data without being retrained, which is cheaper and more secure.

People assume that because fine-tuning involves 'training', it is the only 'real' customisation. They underestimate how powerful and common RAG is.

Mistake

An AI agent is just a chatbot with a fancy name.

Correct

An agent is fundamentally different because it can take actions in the world using tools, not just generate text. A regular chatbot only generates responses.

The word 'agent' is used loosely in tech, so beginners lump all interactive AIs together. The exam specifically tests the definition of an agent as an action-taker.

Mistake

RAG requires you to train (fine-tune) the foundation model on your documents.

Correct

RAG does not change the model at all. The model remains 'frozen'. The documents are stored separately and retrieved only at the time of the question.

The word 'retrieval-augmented generation' sounds like a training process. People think 'augmented' means the model has been modified, when it means the input has been supplemented.

Mistake

You can fine-tune a model on completely new categories of knowledge it has never seen, like internal sales figures from this quarter.

Correct

Fine-tuning works best for adapting style, tone, or a specific task behaviour. It is very poor at inserting new factual knowledge. RAG is the correct choice for inserting new facts.

Because fine-tuning uses a small dataset, the model does not 'learn' new facts reliably; it may memorise a few examples but then overfit. Beginners overestimate the power of fine-tuning.

Do You Actually Know This?

Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.

Frequently Asked Questions

Is RAG cheaper than fine-tuning?

Yes, typically. RAG costs are mainly for storing and searching your documents in a vector database and for the per-query cost of the foundation model. Fine-tuning requires expensive compute time for training and then a dedicated, customised model instance to run.

Can I use RAG and fine-tuning together?

Yes, you can. This is called an 'intermediate' approach. You could fine-tune a model to be an expert in legal language, then use RAG on top of that to retrieve case law. The exam recognises this as a valid, advanced pattern.

Do I need to be a data scientist to fine-tune a model?

Not necessarily, but you need to understand the concept of training data and the risk of overfitting. Many cloud services (like Amazon Bedrock or Azure OpenAI) offer one-click fine-tuning where you just upload a dataset, so the technical barrier is lowering.

What is an embedding?

An embedding is a way to turn text into a list of numbers (a vector) that a computer can understand. Similar pieces of text have similar vectors. This allows a database to find the 'nearest neighbours' to a question, which is how RAG retrieves relevant documents.

What is a 'tool' in the context of an AI agent?

A tool is a specific function the agent can call, defined by its inputs and what it does. Examples include 'look_up_weather(city)', 'calculate_sum(a, b)', or 'send_email(to, subject)'. The agent chooses which tool to use based on the user's request.

Will fine-tuning make the model forget what it already knows?

Yes, this is called 'catastrophic forgetting'. If you fine-tune a model too heavily on a narrow dataset, it can lose its general knowledge. This is a major reason why RAG is often preferred for factual tasks.

Terms Worth Knowing

Keep going

You've finished Fine-tuning and Customization of Foundation Models. Continue through the AIF-C01 study guide to build a complete picture of the exam.

Done with this chapter?