Matthew Tam and Ryno Kleinhans
LLMs (Large Language Models) are AI types that utilise deep learning to “understand” big data sets. What makes LLMs a unique type of generative AI is the fact that they can be prompted using natural language and respond in natural language. However, sometimes the answer an LLM gives is incorrect because occasionally the LLM values answering over answering correctly. This could occur because it was not trained on the correct data or does not have access to data that helps it respond to the user prompt. When an LLM does not respond correctly, it is called a “hallucination”. Unfortunately, there is no way to prevent LLM hallucinations completely. The LLM is not a definitive expert but rather a tool (sometimes utilised by experts). There are, however, some ways to successfully safeguard your LLM application against most hallucinations. This blog discusses three types of LLM hallucinations and four safeguards against these hallucinations.
There are three main ways in which an LLM hallucinates:*
There are four ways of minimising the risk of hallucinations when implementing an LLM in your business.
Forcing an LLM to utilise a vector store is one of the best safeguards against hallucinations. Providing the LLM with a vector store and forcing it to utilise previously vetted sources not only personalises your LLM application but also ensures that it is safeguarded from referencing incorrect information.
Ensuring that your LLM application has both a role and a task helps to keep it on track. To explain the difference between the two, consider a teacher. The role of a teacher is to teach students content. This role might include the specific task of explaining a chapter in a mathematics textbook. Regarding an LLM, your application might have the role of financial advisory and the task of specifically helping clients in a South African context make better investment decisions. A well-formulated system prompt is one of the ways to define an LLM's role and task.
As a user, you need to guide the LLM to help it “think”. If the user presents the LLM with a complex problem, the LLM will not, like a human, break the problem down into smaller steps and try to solve one bit of the problem at a time. If you want to utilise it to help you complete complex tasks with many different aspects to consider, you have to break your prompt into smaller and sequential prompts or “steps”. Breaking up complex assignments into smaller steps and guiding the LLM through these steps minimises the chance of mistakes.
It is important to consider the task you want the LLM to assist you with. An LLM might not be the ideal tool for your current task. For example, currently, LLMs are famously terrible at solving mathematical problems. LLMs are great at being able to “understand” a body of text to summarise it or elaborate on it. LLMs are also used to generate code for experts, who then check it before implementing it. Writing code is not an LLM's best “skill”, but it can save you time. To receive the best results from your LLM application, use it for its intended purpose.
An LLM should always be considered a tool that helps and assists. It does not replace current experts or resources. Providing users with an LLM as a tool could save time and make work easier, but it functions as an assistant, not an expert. However, sometimes LLMs hallucinate. There are three types of hallucinations: (1) The response does not match the content of the user prompt, (2) The response contradicts a previous response, or (3) The response is factually incorrect. It will never be possible to rule out hallucinations completely, but it is possible to safeguard your LLM applications against most hallucinations. You could (1) force your LLM to utilise a vector store of reliable resources, (2) give your LLM a clear role and tasks through its system prompt, (3) break down a complex task into smaller prompts or “steps”, or (4) only utilise an LLM for tasks that fall within its capabilities.
* Source: Simform
Unlock the power of AI-driven solutions and make your business future-fit today! Contact us now to discover how cutting-edge large language models can elevate your company's performance: