What is a "Retrieval Augmented Generation" (or RAG?)

You might have heard the term "RAG" being thrown around and wanted to learn about it.

This article will explain what it is and why you might want to use one.

What is a RAG?

First off, "RAG" stands for Retrieval Augmented Generation.

And retrieval Augmented Generation (RAG) is a machine learning architecture that enhances the capabilities of generative models by integrating external knowledge retrieval into the generation process.

This approach combines the strengths of two AI models: retrieval-based and generative. Here’s how it works in a nutshell:

  • Retrieval-based Models: This part can quickly search vast information to find exactly what you're asking about. It's like having an instant search engine to gather facts or data about your question.

  • Generative Models: Generative models, like GPT (Generative Pre-trained Transformer), can produce new content by predicting the next word in a sequence given the words that come before it.

When you ask a RAG-powered AI a question, the "Retrieval-based Models" leap into action, searching a massive database for relevant information. Then, the "Generative Model" takes over, using those facts to create a clear, informative, and sometimes creative response.

So why use it?

RAG is fantastic for a few reasons:

  • Up-to-date Information: RAG looks up information when you ask, which means you can give it context and up-to-date information.
  • Customizable Knowledge: RAG can search through any database or set of information, which means it can be used for all sorts of topics, from science to history to today's news.
  • Balanced Responses: By combining the ability to search for facts with the ability to generate creative responses, RAG offers the best of both worlds: accurate information presented in a readable and engaging way.

While RAG is very helpful and can improve things in most use cases, it's important to remember that it relies on the information it finds. If that information is wrong or outdated, then the results probably won't be accurate. That's why it's always good to double-check important facts. The age-old "garbage in, garbage out".

Avatar for Niall Maher

Written by Niall Maher

Founder of Codú - The web developer community! I've worked in nearly every corner of technology businesses; Lead Developer, Software Architect, Product Manager, CTO and now happily a Founder.


Fetching comments

Hey! 👋

Got something to say?

or to leave a comment.