Hello everyone!
In today's video we will learn about techniques to detect hallucination.
So there are metrics to run techniques.
One of the very prominent ones is faithfulness, also known as hallucination.
In many documentations.
This measures the factual consistency of the generated answer against the given context.
It is calculated from the answer and retrieved context.
The answer is scaled in a 0 to 1 range.
Now let's understand how this works in the actual Rag pipeline.
So in my previous video where I have explained Rag, there are three inputs context, user input and
the prompt that are sent over to LMH.
And LMDh uses these three inputs to generate the LLM answer.
Once you get this answer, we use the context from the initial pipeline and the answer and we invoke
another model, which is a hallucination model to calculate the faithfulness of the answer.
This model is then responsible for outputting the score.
This is essentially the faithfulness matrix.
We will learn this with hands on experience in our next video.
Next is answer.
Relevance.
The evaluation matrix answer relevancy focuses on assessing how pertinent the generated answer is to
the given prompt.
Lower scores are assigned to answers that are incomplete or contain redundant information, and higher
scores indicate better relevancy.
This is a typical Rag pipeline.
Again, context, user input and prompt.
They're fed to an end.
Generates an answer.
Great.
The answer and the prompt are then fed into a hallucination model here for answer relevancy.
And that outputs the score.
Wow.
Okay.
So now let's understand what is the model that is used to detect hallucination.
There are different fine tuned models designed for detecting hallucination in LM.
They're particularly useful in the context of building retrieval augmented generation applications,
where a set of facts is summarized by an LM model, and the model can be used to measure the extent
to which the summary is factually consistent with the facts.
There are a couple of models that are available as open source models on hugging face.
One is V3 hallucination judge and another one is hallucination evaluation model from victory.
We will take a deep dive into each one of them in our next video, and understand how we can detect
hallucination.
Thank you and I'll see you in the next video.