Home Artificial Intelligence Construct More Capable LLMs with Retrieval Augmented Generation The Limitations of ChatGPT Libraries & Pre-requisites Sentence Embeddings Help Models Interpret Text

Construct More Capable LLMs with Retrieval Augmented Generation The Limitations of ChatGPT Libraries & Pre-requisites Sentence Embeddings Help Models Interpret Text

0
Construct More Capable LLMs with Retrieval Augmented Generation
The Limitations of ChatGPT
Libraries & Pre-requisites
Sentence Embeddings Help Models Interpret Text

How Retrieval Augmented Generation Can Enhance Your LLMs by Integrating a Knowledge Base

Towards Data Science
Image by writer: Generated with Midjourney

ChatGPT is restricted for a lot of practical business use cases outside of code generation. The limitation arises from the training data, and the model’s propensity to hallucinate. On the time of writing, if you happen to attempt to ask the Chat-GPT questions on events occurring after September 2021, you will likely receive a response like this:

Image by writer

This isn’t helpful, so how can we go about rectifying it?

Option 1 — Train or fine-tune the model on up-to-date data.

Advantageous-tuning or training a model could be impractical and expensive. Putting aside the prices, the trouble required to organize the info sets is sufficient to forgo this feature.

Option 2 — Use retrieval augmented generation (RAG) methods.

RAG methods enable us to present the massive language model access to an up-to-date knowledge base. That is less expensive than training a model from scratch or fine-tuning, and far easier to implement. In this text, I show you easy methods to leverage RAG along with your OpenAI model. We are going to put the model to the test by conducting a brief evaluation of its ability to reply questions on the Russia-Ukraine conflict of 2022 from a Wikipedia knowledge base.

Note: This topic, although sensitive, was chosen for the plain reason that the present ChatGPT model has no knowledge of it.

You would require an OpenAI API key, you may grab one directly from their website or follow this tutorial. The framework used for RAG is Haystack by Deepset, which is open source. They supply APIs enabling you to construct applications on top of huge language models. We also leverage sentence transformers and the transformers library from Hugging Face.

LEAVE A REPLY

Please enter your comment!
Please enter your name here