Large Language Models, Embeddings and RAG: fighting commons misconceptions
About two wrong statements I often read in articles talking about Large Language Models and Retrieval-Augmented Generation

Photo by Sander Sammy on Unsplash
After having read lot of articles on the subject and having build some experience doing experimentations and working on RAG systems, I found out that there are two common misconceptions I had like to discuss with you.
Large Language Models cannot search
I read many times that LLM tools are able to search for documents to answer questions… That is NOT the case.
During training, a LLM is like a person reading all books from a library.

Picture by 🇸🇮 Janko Ferlič on Unsplash
When the LLM is being used, it acts like someone that would be imprisoned in a room.

Picture by Mak on Unsplash
We provide him with a blackboard where some text is written (the prompt) and he must complete the text using. All the data he has access to is what is written in the prompt and what he remembered from the training.
That’s why models can hallucinate, they can mix memories or invent facts that could complete the blackboard.
For the record, the blackboard is “the context window”, the given text is the prompt, and what the model add is the output/answer. The model can’t write more text than the blackboard can contain, and giving more input text means reducing the usable output length.
A small nuance
While LLM can’t search anything by themself, you can use a LLM with a specialized prompt to generate a text that can be used as the input for a tool that can retrieve data.
It’s what happen in the part “First step: query rephrasing” from my previous article on Langchain-Conversational Retrieval Chain.
You can provide LLM with embeddings to answer a question
That is the second misconception I often read, and it comes from using a vector database in retrieval-augmented generation.
In fact there are two misconceptions here, the first one being that the embeddings are usable by the LLM.
To help a LLM answering a question you can give it data (as text) in the prompt.
One possible way to find this data (this is the second misconception here, as it is one possible way, not the only one), is to use a vector database to store documents including:
- a text,
- a vector representation of this text (the embedding),
- metadata.
When you input a query, it will also be transformed to a vector. We will then use the database to find documents (in fact small parts, called chunk taken from original documents) whose embeddings are closest to the one created from the question.
The embedding has been used to find documents, but what will be given to the LLM in the prompt is the text / chunks of the document.
I hope you find it interesting, do not hesitate to give me your opinion about it!