Large language models (LLMs) are not as useful as you think.
Don’t get us wrong: LLMs are powerful.
These deep learning algorithms can recognize, summarize, translate, predict, and generate content using large datasets.
They are based on transformers, which are robust neural architectures that can process natural language inputs and outcomes and have become the foundation for many natural language processing applications.
Chatbots, code generators, AI writers, AI designers, and more are built using LLMs.
They are incredibly powerful — but their usefulness is only unlocked when you understand their limitations.
Let’s dive in.
The Crucial Role of Large Language Models (LLMs) in Generative AI
Before we uncover the limitations of Large Language Models, we need to understand their role in Generative AI.
LLMs, encompassing behemoths like GPT-4, are vast and intricate pieces of technology capable of understanding, processing, and generating human language on an impressively sizable scale. Framed simply, they're an AI's linguistic powerhouse.
As you may suspect, this broad language understanding has remarkable implications for Generative AI, which thrives on data input and novel output. Imagine working with an incredibly articulate collaborator, rapidly absorbing vast swathes of text and creating new, unique content.
The input of LLMs allows Generative AI to create realistic and plausible outputs, anchoring its value in various real-world applications.
This means that the quality of an LLM dictates the quality of the Generative AI output it produces.
The Limitations of Large Language Models
As powerful as LLMs are, they have limitations that can impact the product built on them.
Large Language Models are Stateless
LLMs do not store or remember any information from previous inputs or outputs.
In the industry, we call this inability to remember or store information stateless — they only use the current input to generate the output, which can prove problematic for tasks that require content or continuity in applications, such as chatbots.
Let me give you an example.
Let’s say you tell an LLM your name. It can and likely will greet you by name. But if you were to ask the LLM what your name is, it wouldn’t be able to give you an accurate answer.
The LLM did not remember your input, so it will not be able to include that information in its output unless you include it in every chat.
The implications of this are huge.
If you’ve ever used OpenAI’s ChatGPT to create content, you know that getting the best results requires a lengthy initial input.
Every chat requires a reminder of who you are, your tone of voice, your expertise, topics you like, writing styles you like, and more.
You can’t just give those inputs once, and ChatGPT remembers them. You have to include them with every chat to get the right results.
Large Language Models are Limited to a Dataset
LLMs can only operate on the knowledge they garner from their training dataset - not recent or evolving data.
Suppose you ask an LLM a question about a new event or proprietary data or ask it to generate some new style trend. In that case, the model will likely provide inaccurate information.
This is known in the industry as model hallucinations — the model gives you false information because the correct information isn’t included in its training dataset.
Imagine the implications!
Creating articles, graphics, or just asking a chatbot for information to make an ‘educated’ guess can result in using inaccurate information.
That’s why you need to fact-check any information you get from an LLM, especially if you don’t know its training dataset.
Making LLMs Useful with Retrieval-Augmented Generation
The primary way to overcome these limitations is to make the LLM respond more accurately to your data.
General-purpose models need help understanding the context necessary for very specific uses.
Asking ChatGPT for legal guidance or help improving the cybersecurity of your specific network is not to bode well for you.
It hasn’t been trained on the dataset needed to produce an accurate answer.
Retrieval Augmented Generation is the most effective way to make an LLM more accurate in its response.
What is Retrieval-Augmented Generation?
Retrieval-augmented generation (RAG) is a technique that allows the LLM to access external information sources during generation.
This can help the LLM incorporate facts, evidence, and examples from the domain into its output, which enhances its credibility and accuracy.
Let’s say you want to create an LLM that can answer questions about a book you have in PDF format.
RAG allows you to query a database composed of the text from that book and use that information to generate accurate responses.
The image below shows this process in action.
Source: Retrieval Augmented Generation (RAG): From Theory to Langchain Implementation
Basic RAG System Architecture
Enabling a RAG system in your LLM requires three core components:
- LLM Embeddings
- Vector Database
- Retrieval
Let’s look at each component separately.
LLM Embeddings
LLM embeddings are vector representations of words or tokens that capture their semantic meanings in a high-dimensional space.
They allow the model to convert discrete tokens into a format that the neural network can process. LLMs learn embeddings during training to capture relationships between words, such as synonyms or analogies.
Source: The Power of Embeddings in Machine Learning
Embeddings are an essential component of the transformer architecture that LLMs use and can vary in size and dimensions depending on the model and task.
Vector Database
LLM applications do not use typical databases. They use vector databases made up of embeddings.
Vector databases leverage embeddings to create a high-dimensional dataset that can query based on semantic meanings and relationships between words (in natural language processing applications).
Source: Vector Database: Concepts and Examples
Traditional databases, on the other hand, operate on scalar data. Searches are based on exact answers to your query that are retrieved via logical instructions. They do not understand nuances in semantic meanings and relationships between words.
Retrieval
The final step in a RAG system is retrieval.
The retrieval step is responsible for finding the most relevant information from the vector database based on the prompt you’ve entered.
This happens by performing a similarity search on the vector database, which then ranks the retrieved text by relevance.
The retrieved text is then combined with the prompt to provide relevant context and passed to the LLM.
Improve the Usability of Your LLMs
RAG provides a practical solution to enhance the capabilities of LLMs when dealing with evolving datasets.
Integrating real-time, external knowledge into responses makes an LLM contextually accurate and relevant — a massive plus for real-world applications.
Integrating RAG improves the user experience, keeping your clients happy and returning to use your Generative AI application.