RAG vs Fine-Tuning vs Prompt Engineering: Optimizing AI Models

IBM Technology · 1 year ago

What exactly is RAG, and when should I use it?

RAG (Retrieval Augmented Generation) searches through a corpus of your own documents—spreadsheets, PDFs, internal wikis—and converts both your question and those documents into vector embeddings to find semantically similar matches.

At a glance

Length
13 min
Channel
IBM Technology
Video from
Apr 2025
Rating
⭐⭐ Great video · 2/2
Best for
AI engineers, data engineers, and developers choosing how to optimize language models

What this video answers

  • What exactly is RAG, and when should I use it?
  • How is fine-tuning different from simply training a model from scratch?
  • Can prompt engineering teach a model new information?
  • What is catastrophic forgetting in the context of fine-tuning?
  • Should I always combine all three methods?
Reads the guide aloud in your browser — free, no account.

Understanding Three Methods to Improve AI Model Responses

This IBM Technology video, hosted by Martin Keen, breaks down three practical approaches for getting better answers from large language models: Retrieval Augmented Generation (RAG), fine-tuning, and prompt engineering. Rather than treating these as abstract concepts, Keen uses a relatable opening—asking an LLM "Who is Martin Keen?"—to show how different models produce wildly different results depending on their training data and knowledge cutoff dates. The video walks through real-world scenarios where each method shines, comparing their strengths and trade-offs so you can decide which fits your needs.

This resource suits developers, data engineers, and anyone building or deploying AI systems who needs to understand when to retrieve external data, when to invest in specialized model training, or when careful prompt design alone will do the job. If you're considering adopting an LLM for a specific task—whether that's technical support, legal document review, or internal knowledge retrieval—this video clarifies which optimization path makes practical and financial sense.

Key Moments

Key Concepts and Demonstrations in This Video

  • RAG explained as a three-step process: retrieval of external information, augmentation of the original prompt, and generation of a response using enriched context
  • How vector embeddings work to find semantically similar documents even when exact keywords don't match (example: finding "quarterly sales" when asked about "revenue growth")
  • Fine-tuning mechanics: updating a model's internal weights through supervised learning on specialized datasets, using thousands of input-output pairs as examples
  • The risk of catastrophic forgetting when fine-tuning—models can lose general capabilities while learning specialized ones
  • Prompt engineering techniques like asking models to "think step-by-step" to activate patterns learned during training without changing the model itself
  • A real-world legal AI system example showing all three methods working together: RAG retrieving case law, prompt engineering enforcing document format, and fine-tuning teaching firm-specific policies
Featured image for the guide to RAG vs Fine-Tuning vs Prompt Engineering: Optimizing AI Models by IBM Technology

What You Should Know Before Choosing a Method

  • RAG performance cost: The retrieval step adds latency to each query compared to prompting a model directly; it also requires infrastructure investment in vector databases and document processing
  • Fine-tuning resource requirements: Demands thousands of high-quality training examples, substantial computational power (multiple GPUs), and ongoing maintenance when knowledge needs updating
  • Prompt engineering has no infrastructure overhead: All optimization happens on the user side, and you see immediate results—but trial-and-error is unavoidable, and you cannot teach the model genuinely new or outdated information
  • Common hybrid approach: The video emphasizes these three methods are often combined rather than used in isolation; the right solution depends on your specific constraints around speed, budget, and knowledge freshness

Common Questions About These AI Optimization Strategies

What exactly is RAG, and when should I use it?

RAG (Retrieval Augmented Generation) searches through a corpus of your own documents—spreadsheets, PDFs, internal wikis—and converts both your question and those documents into vector embeddings to find semantically similar matches. Use RAG when you need up-to-date information or domain-specific facts that weren't in the model's original training data. The trade-off is added latency and infrastructure cost.

How is fine-tuning different from simply training a model from scratch?

Fine-tuning starts with an existing model that already has broad knowledge, then makes small adjustments to its weights using additional specialized training on a focused dataset. You're not building a model from zero—you're adapting an already-capable foundation. This is much faster than pre-training from scratch, but it still requires substantial compute resources and thousands of high-quality examples.

Can prompt engineering teach a model new information?

No. Prompt engineering activates existing knowledge the model already learned during training by directing its attention through better phrasing, examples, context, and format instructions. It cannot add truly new facts or correct outdated information. If your knowledge base is old or incomplete, RAG or fine-tuning are necessary.

What is catastrophic forgetting in the context of fine-tuning?

Catastrophic forgetting occurs when a model loses some of its general capabilities while learning specialized knowledge. By focusing too heavily on domain-specific patterns, the model can degrade its broader problem-solving abilities. This is one reason fine-tuning requires careful balance and is why maintenance is challenging.

Should I always combine all three methods?

Not necessarily. The video uses a legal AI system as an example of all three working together, but your choice depends on your budget, inference speed requirements, and how often your knowledge needs to change. Prompt engineering alone might suffice for many use cases; RAG is ideal for frequently updated information; fine-tuning excels when you need deep domain expertise but can afford the training cost.

A still from the video RAG vs Fine-Tuning vs Prompt Engineering: Optimizing AI Models by IBM Technology
More on technology
See the BEST NEW products on Amazon!

Key Terms

Retrieval Augmented Generation (RAG)
A method that searches external documents for relevant information, adds that information to your original question, and then uses the enriched context to generate a better answer.
Vector embeddings
Numerical representations of words and phrases that capture their meaning, allowing systems to find semantically similar content even when exact keywords don't match.
Fine-tuning
The process of taking a pre-trained model and making small adjustments to its internal weights using additional training on specialized data to develop domain expertise.
Prompt engineering
The practice of carefully wording questions and instructions to a language model to activate its existing knowledge patterns and improve its responses without retraining.
Catastrophic forgetting
The risk that a model loses some of its general capabilities when focused too heavily on learning specialized knowledge during fine-tuning.

📚 Go deeper: Prompt engineering explained

Sources: Retrieval Augmented Generation (RAG) · Vector embeddings · Fine-tuning · Prompt engineering · Catastrophic forgetting — definitions cross-referenced with Wikipedia

Justin’s Take

This video succeeds because it moves past buzzwords and honestly compares the three approaches side by side. Keen doesn't oversell any single method; instead, he lays out real costs—latency, GPU requirements, maintenance burden—that matter when you're actually building something.

What I appreciated most was the legal AI example at the end, which shows that these aren't either/or choices but tools that work together. If you're evaluating how to add AI to your infrastructure or deciding where to spend your training budget, this straightforward breakdown is exactly what you need, and I'd recommend it wholeheartedly.

Great video · 2 out of 2

Justin
Justin

I started Helicopterstour.com because I genuinely believe there’s no better way to see the world than from the sky. I used to work on the Pride of America cruise ship in Hawaii, helping guests book shore excursions all over the islands. Two Vacation Hero Awards 2,000+ Guests/Week Pride of America · NCL Hawaii Shore Excursions 1000+ Tours Reviewed

Video by IBM Technology on YouTube. If you enjoyed it, please subscribe to their channel and show your support for the great video.

Description

Ready to become a certified watsonx AI Assistant Engineer? Register now and use code IBMTechYT20 for 20% off of your exam → https://ibm.biz/BdndTs

Learn more about RAG vs. Fine-Tuning vs. Prompt Engineering here → https://ibm.biz/BdndTi

How do AI chatbots deliver better responses? 🤔 Martin Keen explains RAG 🛠️, fine-tuning 🎯, and prompt engineering ✏️—methods that extend knowledge, refine responses, and build domain expertise. Learn how these strategies optimize large language models and improve AI outputs today! 🚀

AI news moves fast. Sign up for a monthly newsletter for AI updates from IBM → https://ibm.biz/BdndTj

#retrievalaugmentedgeneration #finetuning #promptengineering

Video transcript for “RAG vs Fine-Tuning vs Prompt Engineering: Optimizing AI Models” Accessibility

A full written transcript of this video, provided for accessibility. Select any timestamp to jump the video to that moment.

Remember how back in the day people would Google themselves, you type your name into a search engine and you see what it knows about you? Well, the modern equivalent of that is to do the same thing with a chatbot. So when I ask a large language model, who is Martin Keen? Well, the response varies greatly depending upon which model I'm asking,

because different models, they have different training data sets, they have a different knowledge cutoff dates. So what a given model knows about me, well, it differs greatly. But how could we improve the model's answer? Well, there's three ways. So let's start with a model here, and we're gonna see how we can improve its responses.

Well, the first thing it could do is it could go out and it could perform a search, a search for new data that either wasn't in its training data set, or it was just data that became available after the model finished training, and then it could incorporate those results from the search back into its answer.

That is called RAG or Retrieval Augmented Generation. That's one method. Or we could pick a specialized model, a model that's been trained on, let's say, transcripts of these videos. That would be an example of something called fine tuning,

or we could ask the model a query that better specifies what we're looking for. So maybe the LLM already knows plenty about the Martin Keens of the world, but let's tell the model that we're referring to the Martin keen who works at IBM, rather than the Martin Keen that founded Keen Shoes.

That is an example of prompt engineering. Three ways to get better outputs out of large language models, each with their pluses and minuses. Let's start with RAG. So let's break it down. First there's retrieval. So retrieval of external up-to-date information. Then there's augmentation.

That's augmentation of the original prompt with the retrieved information added in. And then finally there's generation. That's generation of a response based on all of this enriched context. So we can think of it like this. So we start with a query and the query comes in to a large language model.

Now, what RAG is gonna do is it's first going to go searching through a corpus of information. So we have this corpus here full of some sort of data. Now, perhaps, that's your organization's documents. So it might be spreadsheets, PDFs, internal wikis, you know, stuff like that, But unlike a typical search engine that just matches keywords,

RAG converts both your question, the query, and all of the documents into something called vector embeddings. So these are all converted into vectors. essentially turning words and phrases into long lists of numbers that capture their meaning. So when you ask a query like, what was our company's revenue growth last quarter?

Well, RAG will find documents that are mathematically similar in meaning to your question, even if they don't use the exact same words. So it might find documents mentioning fourth quarter performance or quarterly sales. Those don't contain the keyword revenue growth, but they are semantically similar.

Now, once RAG finds the relevant information, it adds this information back into your original query before passing it to the language model. So instead of the model just kind of guessing based on its training data, it can now generate a response that incorporates your actual facts and figures.

So this makes RAG particularly valuable when you are looking for information that is up to date, and it's also very valuable when you need in to add in information that is domain specific as well, but there are some costs to this. Let's go with the red pen. So one cost, that would be the cost of performance.

for performing all of this, because you have this retrieval step here, and that adds latency to each query compared to a simple prompt to a model. There are also costs related to just kind of the processing of this as well. So if we think about what we're having to do here, we've got documents that need to be vector embeddings,

and we need to store these vector embedding in a database. All of this adds to processing costs, it adds to infrastructure costs to make this solution work. All right, next up, fine tuning. So remember how we discussed getting better answers about me by training a model specifically on, let's say, my video transcripts.

Well, that is fine tuning in action. So what we do with fine tuning is we take a model, but specifically an existing model. and that existing model has broad knowledge. And then we're gonna give it additional specialized training on a focused data set.

So this is now specialized to what we want to develop particular expertise on. Now, during fine tuning, we're updating the model's internal parameters through additional training. So the model starts out with some weights here. like this, and those weights were optimized during its initial pre-training.

And as we fine tune, we're making small adjustments here to the model's weights using this specialized data set. So this is being incorporated. Now this process typically uses supervised learning where we provide input-output pairs that demonstrate the kind of responses we want. So for example, if we're fine-tuning for technical support, we might provide thousands of examples of customer queries,

and those would be paired with correct technical responses. The model adjusts its weights through back propagation to minimize the difference between its predicted outputs and the targeted responses. So we're not just teaching the model new facts here, we're actually modifying how it processes information.

The model is learning to recognize domain-specific patterns. So, fine-tuning shows its strength when you particularly need a model that has very deep domain expertise. That's what we can really add in with fine tuning, and also, it's much faster, specifically at inference time. So when we are putting the queries in, it's faster than RAG because it doesn't need to search through external data,

and because the knowledge is kind of baked into the model's weights, you don't need to maintain a separate vector database, but there's some downsides as well. Well, there's certainly issues here with the training complexity of all of this. You're going to need thousands of high quality training examples.

There are also issues with computational cost. The computational cost for training this model can be substantial and is going to require a whole bunch of GPUs. And there's also challenges related to maintenance as well because unlike RAG where you can easily add new documents to your knowledge base at any point.

Updating a fine-tune model requires another round of training and then perhaps most importantly of all there is a risk of something called catastrophic forgetting. Now that's when the model loses some of its general capabilities while it's busy learning these specialized ones. So finally let's explore prompt engineering.

Now specifying Martin Keen who works at IBM versus Martin Keene who founded Keene Shoes, that's prompt engineering, but at its most basic. Prompt engineering goes far beyond simple clarification. So let's think about when we input a prompt, the model receives this prompt and it processes it through a series of layers,

and these layers are essentially tension mechanisms and each one focuses on different aspects of your prompt text that came in. And by including specific elements in your prompt, so examples or context or how you want the format to look, you're directing the model's attention to relevant patterns it learned during training.

So for example, telling a model to think about this step-by-step, that activates patterns it learnt from training data where methodical reasoning led to accurate results. So a well-engineered prompt can transform a model's output without any additional training or without data retrieval.

So take an example of a prompt. Let's say we say, is this code secure? Not a very good prompt. An engineered prompt, it might read a bit more like this. It's much more detailed. Now. We haven't changed the model, we haven't added new data, we've just better activated its existing capabilities.

Now I think the benefits to this are pretty obvious. One is that we don't need to change any of our back-end infrastructure here because there are no infrastructure changes at all in order to prompt better, it's all on the user. There's also the benefit that by doing this, You get to see immediate responses and immediate results to what you do.

We don't have to add in new training data or any kind of data processing, but of course there are some limitations to this as well. Prompt engineering is as much an art as it is a science. So there is certainly a good amount of trial and error in this sort of process to find effective prompts,

and you're also limited in what you can do here, you're limited to existing knowledge because you're not able to actually add anything else in here. No additional amount of prompt engineering is going to teach it truly new information. You're not going to the model anything that's outdated in the model.

So we've talked about now RAG as being one option and we talked about fine tuning as being another one. And now, just now, we've talked about prompt engineering as well and I've really talked about those as three different distinct things here, but they're commonly used actually in combination.

We might use all three together. So consider a legal AI system. RAG, that could retrieve specific cases and recent court decisions. The prompt engineering part, that could make sure that we follow proper legal document formats by asking for it. And then fine-tuning, that can help the model master firm-specific policies.

I mean, basically, we can think of it like this. We can think that prompt engineering offers flexibility and immediate results, but it can't extend knowledge. RAG, that can extend knowledge, it provides up-to-date information, but with computational overhead. and then fine-tuning,

that enables deep domain expertise, but it requires significant resources and maintenance. Basically, it comes down to picking the methods that work for you. You know, we've, we sure come a long way from vanity searching on Google.

How videos are chosen here

Every video on Helicopterstour.com is hand-picked and reviewed by Justin — nothing is added automatically. Each one gets an original written guide and an honest rating: ⭐ 1 out of 2 means a good video worth your time, and ⭐⭐ 2 out of 2 means a great one we would recommend to anyone. The videos belong to their creators — every page links back to the original channel so you can subscribe and support them.

Contact us

Get new videos in your inbox

A short email when we publish something new. No spam — unsubscribe anytime.