Mitigating AI Hallucinations with Prompts
Key Points
- AI hallucinations are common in large language models, producing misleading or factually incorrect answers such as false personal experiences, faulty code, or wrong historical dates.
- Hallucinations arise from two sources: intentional adversarial injection of malicious data (adversarial hallucinations) and unintentional errors due to training on large, unlabeled, and sometimes conflicting datasets.
- The architecture of encoder‑decoder models can also contribute to unintentional hallucinations, as can the way models handle ambiguous or incomplete information.
- Prompting strategies can help curb hallucinations, with temperature prompting being a key technique that adjusts the model’s “greediness”: lower temperatures (e.g., 0) promote more deterministic, accurate outputs, while higher temperatures (up to 1) increase creativity but also risk inaccuracy.
- Understanding these causes and applying appropriate prompting controls are essential for mitigating hallucinations in AI applications, especially in high‑stakes domains like cybersecurity and quantitative analysis.
Full Transcript
# Mitigating AI Hallucinations with Prompts **Source:** [https://www.youtube.com/watch?v=ZFKvTIADp0k](https://www.youtube.com/watch?v=ZFKvTIADp0k) **Duration:** 00:08:56 ## Summary - AI hallucinations are common in large language models, producing misleading or factually incorrect answers such as false personal experiences, faulty code, or wrong historical dates. - Hallucinations arise from two sources: intentional adversarial injection of malicious data (adversarial hallucinations) and unintentional errors due to training on large, unlabeled, and sometimes conflicting datasets. - The architecture of encoder‑decoder models can also contribute to unintentional hallucinations, as can the way models handle ambiguous or incomplete information. - Prompting strategies can help curb hallucinations, with temperature prompting being a key technique that adjusts the model’s “greediness”: lower temperatures (e.g., 0) promote more deterministic, accurate outputs, while higher temperatures (up to 1) increase creativity but also risk inaccuracy. - Understanding these causes and applying appropriate prompting controls are essential for mitigating hallucinations in AI applications, especially in high‑stakes domains like cybersecurity and quantitative analysis. ## Sections - [00:00:00](https://www.youtube.com/watch?v=ZFKvTIADp0k&t=0s) **Understanding AI Hallucinations** - The speaker outlines how large language models can generate misleading or false outputs—dubbed hallucinations—provides illustrative examples, and differentiates between intentional (adversarial) and unintentional occurrences. ## Full Transcript
have you been to Mars me neither but
according to an llm or a large language
model out there I have been to Mars in
1950 right it is not uncommon for the
large language models to generate
misleading data such as this right let's
look at some more examples right a large
language model creating or generating a
python script that looks logically
correct but totally
unexecuted right another example could
be a mathematical or a financial
calculation that the large language
model creates is incorrect totally
misleading and incorrect it could also
be giving you incorrect dates on major
events such as moon landing right these
are all very good examples of AI
hallucinations so AI hallucinations is a
very well-known phenomen on by the large
language models this is where the AI
models are generating misleading
and factually Incorrect and sometimes
even nonsensical responses for the
questions you are asking you see
hallucinations commonly where in
question answering or when you are
asking the models to generate summaries
so the hallucinations can be
statistically inaccurate and factually
incorrect right so why do hallucinations
occur there could be two reasons right
and there are two types of
hallucinations one is intentional where
for example threat actors can be
injecting uh malicious data into your
corporate data right that is leading to
adversarial hallucinations right it is a
quite common cyber security example of
hallucinations now the second one is the
unintentional
hallucinations these hallucinations
occur because of the nature innate
nature of the large language models
being um trained on large volumes of
unlabeled data when you are using
unlabeled data and that two large
volumes of it there could be
misrepresentations of these facts and
there could be conflicting information
there could be uh misleading and
incomplete information also which causes
the models to uh generate incorrect
representations of responses right
sometimes
these
unintentional hallucinations are also
caused by the encoder and decoder models
that are very uh foundational to the
large language models so we are
beginning to understand hallucinations
quite well and we have also developed
and leveraged techniques the prompting
techniques that are out there in
containing the AI
hallucinations I'm going to talk through
five different prompting techniques that
we could use to contain the
hallucinations in your large language
model responses right the first one will
be the temperature prompting technique
it is actually a parameter that the
sequencing models leverage um and the
value of the par temperature can
typically be between 0o and one right
the temperature parameter is going to
determine how greedy you large language
model is going to be right if the
temperature value is zero then it is
going to be lot less greedy right in
being accurate and if it is the
temperature value is more one then the
model is going to be very greedy and
gets very creative now let's apply the
temperature values 0 to one in uh with a
business document where you are
interested in extracting fats like in
net income or a company name buyer
seller Etc or also the slas of a
contractual document right and you also
have uh another document called a
creative document where you are asking
going to ask the large language model to
create a poem or write a Sonet in either
Keat style or Milton style right so if I
were gaining asking the large language
model to extract facts I would give it
anywhere between 3 right and if I'm
asking the large language model to
extract slas from a contractual document
I could go from 05 to
7 however if I'm asking a large language
model to write a song a Sonet I would be
giving it a Waring point8 because that
makes the model very flexible with the
words and generating that song and a
Sonic okay okay the next uh uh technique
my favorite uh in generating very
effective outcomes is the role
assignment in this you are controlling
the outcomes of the responses from the
larger language models by telling it to
take a role of a certain Persona right
for example if you have a patient
document right you can tell the large
language models to be a doctor to go
through the symptoms and come up with a
diagnosis right that is for a medical
kind of a document if you were to create
a um creative document then you can tell
it think like kids and write a
poem right or think like Milton and
write a
Sonet that is how you are going to tell
the model to focus on the outcome that
you want to come out of those models so
the third very effective uh technique is
called specificity right this takes the
role assignment to the next level in
specificity approach you are giving
specific data rules and formula and the
and the examples to the model to follow
and get you the results that you want
right uh this is a very good example of
using the few short prompting technique
right like Chain of Thought react and
this works very very well particularly
when you have a scientific
calculations or you have Financial
calculations and you want a model to
arrive at a solution in a very
methodical manner right uh this is also
a very good example of um writing code
by for example right you know writing
code to solve a problem right use that
in those examples so the next and very
effective technique and by the way this
is my really favorite uh approach is
content grounding this is where you are
making the large language models to look
into your domain data right even though
it is trained on the internet unlabeled
data it is now focusing on your data to
respond to your questions it is very
useful in the business scenarios right
where you are asking for security
breaches or you know risk in a contract
Etc so the large language model is
focusing on your cont content and
getting you that response response by
the way rag is a really good approach to
use for Content grounding retrieval
augmented generation and the final and
also an very
effective prompting technique is the
providing instructions of what to do and
what not to do to the large language
model right uh in a business document
supposing you have five types of risks
in involved but you are only interested
in the infringement risk so you can tell
the large language model to focus on the
infringement risk similarly if you want
to create a song or a poem by kids and
you want only happy poems you can tell
the model to do so right it works very
well so try to incorporate dos and
don'ts in your pting
Technique there you go these are the
different techniques you can use to
contain hallucinations it is so critical
to do that because you want to avoid
harmful
misinformation avoid legal
implications and also build trust and
confidence in leveraging the generative
AI
models thank you for watching before you
leave please click subscribe and
like