Fixing LLM Hallucinations with Retrieval Augmentation in LangChain #6

preview_player
Показать описание
Large Language Models (LLMs) have a data freshness problem. Even some of the most powerful models, like ChatGPT's gpt-3.5-turbo and GPT-4, have no idea about recent events.

The world, according to LLMs, is frozen in time. They only know the world as it appeared through their training data.

So, how do we handle this problem? We can use retrieval augmentation. This technique allows us to retrieve relevant information from an external knowledge base and give that information to our LLM.

The external knowledge base is our "window" into the world beyond the LLM's training data. In this video, we will learn all about implementing retrieval augmentation for LLMs using LangChain and the Pinecone vector database.

🌲 Pinecone article:

📌 Code notebook:

👋🏼 NLP + LLM Consulting:

👾 Discord:

🎙️ Support me on Patreon:

🤖 70% Discount on the NLP With Transformers in Python course:

🎉 Subscribe for Article and Video Updates!

00:00 Hallucination in LLMs
01:32 Types of LLM Knowledge
03:08 Data Preprocessing with LangChain
09:54 Creating Embeddings with OpenAI's Ada 002
13:14 Creating the Pinecone Vector Database
16:57 Indexing Data into Our Database
20:27 Querying with LangChain
23:07 Generative Question-Answering with LangChain
25:27 Adding Citations to Generated Answers
28:42 Summary of Retrieval Augmentation in LangChain

#artificialintelligence #langchain #nlp #openai #deeplearning #chatgpt
Рекомендации по теме
Комментарии
Автор

Thank you so so much James. It seems like every time I have a new question along my journey you post a video about that exact topic.

an_sound
Автор

I have learned so much from you James especially in regards to LangChain. Thanks for your time indeed.

crisgath
Автор

Great shirts in each video! And thanks for the great series!

Ali-tspo
Автор

Your videos are fantastic! I love the way you break down these topics into easy-to-understand pieces and make them accessible to people from all walks of life.
I was wondering if you've ever explored the capabilities of large language models when it comes to handling tabular data? It would be really interesting to see a video from you exploring how this can be used in that context.

sachinp
Автор

Your content is amazing. Looking forward for more hopefully.

As I'm going through Langchain I'm wondering: what are the up/downside of using vector database for structured data (DBs, CSVs mostly) as opposed to more direct retrieval method like SQLChain or straight up custom tool?

grthrTBL
Автор

Great job, James. txs a lot for your awesome videos! I went through langchain python documentation (which is also very good) and all is cristal clear thanks to your videos. make it a great day !

yvesdance
Автор

Fantastic videos, expertly put together and very informative. It is a pity that things change way too fast and things break if one tries to replicate the code more than a few months later. Some backward compatibility should become standard practice for library maintainers... Even though all the installs have completed successfully, the code bombs out on the first statement 'load_dataset(...'

nikosterizakis
Автор

Awesome video thank you 🎉❤

What is the tool you are using to build your guides? It looks awesome too 😅😮

thisisruddy
Автор

Thank you for these videos! Just learning pinecone and having a little trouble with creating a domain-specific db where the dimension are predefined. Any chance of a video on that process? Thanks again for making everything so easy to follow and providing the colabs.

jdlovely
Автор

What do you think about adding a zero-shot answer from the LLM to the query to improve the quality of the embeddings retrieved? This would follow the HyDE pattern described by Luyu Gao et al. but I'm not sure if it's just a waste of tokens when dealing with OpenAI's models.

Garcia
Автор

Amazing content James! Love it. Any recommended range for chunk size and overlap based on your experience?

BernardoGarciadelRio
Автор

Great content. What local model would be good to replace the embedding of OpenAI’s text-embedding-ada-002?

TzaraDuchamp
Автор

This used about $3 of my $5 of free credit for OpenAI.
If you have a half decent graphics card I would recommend using BERT instead for the embeddings. My 1060 crunched the data in ~15 minutes. Required some slight modification of the code, but nothing crazy

MrAusdrifter
Автор

Hi James, there are so many different embeddings in langchain. Could you elaborate on how to choose the right embeddings and right model? Especially when we don't want to use openai the whole time.
Thanks and br

DanielWeikert
Автор

Love your videos! I was asking chatGPT about the Source/Parametric knowledge and it said: Source are all training data, Parametric is the resulting weights/biases of the model based on training data, and prompts are neither, rather are just Inputs to the model to generate a response. Not sure if this is correct or your explanation, just thought i'd share that.

MiguelFernando
Автор

Amazing content James, what python IDE did you use to run this tutorial? I am new to Python developing

debiaser
Автор

Thanks for helping us understand. Can I use pdf document and how can Is this cost effective when put into production for the public

Matrixsection
Автор

Wonder does langchain explores all chunks related to query (in your example they are 3 items) when prompting to openai, and how it does internally.

lxx
Автор

Hello, can you make a video on how we can use HuggingFace instruct embeddings for Information Retrieval and Q&A?

nithinreddy
Автор

I'd like to see a tool from LangChain that highlights relevant parts of a URL from its citations, or (less conveniently) quotes the relevant section of the citation. Too many times, I read through the cited source and find the LLM's misconstrued the source material (often confirming a statement where the source material negated it). Showing the passage the LLM thinks is important would make it much easier to sanity check.

scottmiller