---
title: 'RAG vs Fine Tuning vs Prompt Engineering'
source: 'https://youtube.com/watch?v=Q-_D_2NWECE'
video_id: 'Q-_D_2NWECE'
date: 2026-07-31
duration_sec: 563
---

# RAG vs Fine Tuning vs Prompt Engineering

> Source: [RAG vs Fine Tuning vs Prompt Engineering](https://youtube.com/watch?v=Q-_D_2NWECE)

## Summary

This video explains the differences between prompt engineering, RAG (retrieval-augmented generation), and fine-tuning using a simple banking example. It shows how each technique solves a different problem—style control, accurate knowledge retrieval, and domain expertise—and emphasizes that production systems typically combine all three.

### Key Points

- **The bank example: plain LLM gives generic answers** [00:01] — When a customer asks about a credit card late fee, a plain LLM like GPT-5 or Llama replies with a generic $30–$40 guess and no politeness, because it doesn't know the customer or card type.
- **Prompt engineering adds style control** [00:46] — By inserting a prompt asking the model to answer politely as an MDFC bank assistant, the response becomes more professional, but it still doesn't know the exact fee.
- **Definition of prompt engineering** [01:39] — Prompt engineering is the practice of carefully designing and structuring instructions to guide an AI model's output. It is best for formatting and style control.
- **RAG gives accurate, grounded answers** [02:21] — RAG points the LLM to a company database, allowing it to retrieve account information (e.g., the gold card fee is $35) and answer accurately with a reference source.
- **Why fine-tuning is needed** [03:18] — The business manager wants suggestions like enabling auto-pay and brand-consistent tone, which are not in a single defined document but spread across 1 million chat transcripts—so RAG alone can't capture them.
- **How fine-tuning works** [04:32] — Fine-tuning retrains a base model like Llama on company transcripts and policies, updating the network's weights. The cricket-to-baseball analogy explains how a general model adapts to a specific domain.
- **Fine-tuning methods: full vs parameter-efficient** [06:21] — Full fine-tuning retrains the entire network, while parameter-efficient methods (LoRA, QLoRA) freeze the base weights and update only newly added layers, making the process cheaper.
- **Trade-offs and production choice** [07:51] — RAG is cheap but less tailored; fine-tuning is costly but produces more accurate, brand-consistent answers. In production, teams combine all three approaches for the best result.

## Transcript

engineering versus rag versus fine-tuning using an extremely simple example. Let's say you are working as an AI engineer in this bank called MDFC. AI engineer in this bank called MDFC. And here customer are asking questions
such as okay how much is my credit card late fee. Now if you are using a simple late fee. Now if you are using a simple LLM such as GPT5, Llama etc. right? Without any specific technique then it will give you generic answer usually $30
to $40. It doesn't know what kind of credit card you have, who you are, etc. Right? It's a simple plain LLM which is trained on vast amount of internet data. Other thing that it will do is it will give you a straight answer. See here it
says depends on bank. There is no politeness. There is no specific brand value that it is adhering to. So if you want it to adhere to some specific way
want it to adhere to some specific way of answering which is suitable to MDFC's engineering. So when you are writing your code in lang chain before you give the question to LLM you will insert this kind of prompt that answer in a polite
professional way as an MDFC bank assistant. If you don't know say you don't know and then you put your question. Now in that case it will say okay dear customer see it's a little bit more professional please check your
account statement or correct contact support because it doesn't know still right how much is exactly is your late fee. So now chatboard is little bit better because it is at least answering in a polite manner. So this is prompt
engineering. It's a practice of carefully designing and structuring carefully designing and structuring instructions to guide an AI models output effectively. Now, prompt engineering is overused term. If you
look at prompt engineering as a job, they do much more than just writing better prompts. Okay? Uh but here just for the simplicity, we are defining prompt engineering as an art and science of writing better prompts. But in
reality, it's much more than that. Okay? And it is best when you want formatting and style control. Now if you look at this output, it is vague, right? $30 and this output, it is vague, right? $30 and $40. I want to know the exact late fee.
For this, you can use retrieval augmented generation also known as rag where you point your LLM to the company's database. So MDFC company will have a private database where they will have information on my account, my
transactions and so on. Now LLM can retrieve that information, right? It retrieve that information, right? It knows that I have gold card on which the knows that I have gold card on which the fees is $35. So with this it is giving
fees is $35. So with this it is giving you an exit or accurate answer which is grounded in some source you know some source golden truth. So rag is a knowledge to retrieve the correct answer. Okay. And it is best when you
want to produce the accurate answer which has a reference to some exact database or documents etc. Now when I show this answer to my business manager,
he's like no we should produce even a better answer where you are also suggesting you can avoid this by enabling auto pay. Okay. Because if you look at millions of chat transcripts that we have in past let's say MDFC has
that we have in past let's say MDFC has total 1 million chat transcripts you know past chat conversations which are stored in some MongoDB let's say and my business manager is saying that all those conversations stores the domain
knowledge of our bank it stores our brand value you know how we interact with customers typically so I want that to be reflected in this answer. Now this
is not something for which you can use rag. You know we don't have clearly defined document where we say okay this is my style and this is how you should give the suggestion of auto pay etc. It's nowhere there. It is there in these
1 million different chat transcripts. Okay. So for this you can uh use fine-tuning as an option. And in finetuning you will take a model. Let's say you take lama as a model and you will retrain that model on those
millions of chat transcript your policy documents whatever data you have. So here you have your LLM which which is a neural network right. So here you have a neural network right. So here you have a neural network and this neural network
you are retraining okay and you're producing a newly updated weights new network and then you can ask a question to that right and that will produce the answer that you expect which is this specific answer finetuning is sort of
like you know the cricket okay and when I came to US from India one time my friend uh took me to play baseball and I was able to Okay, because baseball and cricket are kind of similar game, right?
So if I have a knowledge of cricket, which is how to hold a bat, track the ball, you know, and then hit it, run, etc., then I can use those raw skills to play baseball. So similarly, when you fine-tune, you have this model, let's
say llama, which has a general language knowledge, like English knowledge, grammar knowledge, etc. And also it has some knowledge on internet, etc. And then when you finetune, okay, so you are doing fine-tuning
on let's say baseball's rules and all the past baseball games. So then it becomes llama for baseball. Let's say this is for cricket and this becomes a
model for baseball. I hope you're getting a point. Here you have a network. Network has weights which is also called parameters. So let's say these are all the weights, right? 8.65 65 these are all the weights and by the
way LLM have huge amount of parameters like 70 billion 100 billion so it's a like 70 billion 100 billion so it's a huge network and when you retrain you're kind of updating those weights so now you can sense it's a costly process okay
so essentially this is the diagram uh that shows the finetuning so it's a process of retraining a pre-trained model for a specific task format data set or tone if you go to hugging face you will find this model lama 3.21b
it's a foundation or base model but people fine-tuned it to create this 1 3.21b into 1B instruct. Okay. So for this model, this is the base model.
Okay. Now if you look at the foundation model, it is an autocomplete model which means if you say what is the capital of US, it will say the capital of US is Washington DC. It is just autocompleting. Okay. So see whereas the
instruct model is more like CH GPD. When you are talking to CH GPD, it's more proper question and answer. It's not autocomplete. Right? So this instruct model is for that. There are two ways of finetuning. Full finetuning where you
will retrain the entire network and parameter efficient finetuning where you have two popular methods Laura and Qura. So here you keep the neural network frozen. You you keep all the parameters frozen and you add some layers on top of
that network and then you run your training process and your epoch etc. But the parameters only in those new layers will be updated. Okay. So this way it's will be updated. Okay. So this way it's efficient. It is less costly compared to
your full finetuning. So you have realized the difference between rag and finetuning. Right? Rag the pro is the benefit is cheap whereas fine-tuning is benefit is cheap whereas fine-tuning is costly but fine-tuning produces better
answer right and when I say better more accurate more confirming to the standards of the company's brand values and past conversations and so on and the con of rag is you know the answer is not as
rag is you know the answer is not as good as fine-tuning and here is a full through to this. So when should you use formatting, tone and style, use prompt engineering. If you want to access
knowledge, get the accurate answer, use rag. If you need domain expertise and consistent style, use fine-tuning. Okay, so these are the key takeaways. Prompt engineering means formatting and style control. RAG means external knowledge
injection and fine-tuning means domain adaption and expertise. Now you might ask what do people use in the production? Well, they combine all three approaches. When you combine all three approaches in a single application, you
get the best result. I hope this video clarified the difference between these three jargon which you can face during your interview for AI engineer and I hope this information helps you with that. If you have a question, there is a
watching. [Music]
