LLM Hallucination Detection Using Input-Output Embedding Stability
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Large language models (LLMs) often generate incorrect or nonsensical responses, known as hallucinations, which are challenging to detect, especially when responses include both accurate and inaccurate details.
Innovation Solution
A method using input-output stability to detect hallucinations by generating embedding vectors for input and output texts and calculating a hallucination metric based on the correlation between these vectors, employing slight perturbations to identify inconsistencies.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If hallucination detection is performed in LLMs, then reliability of responses is improved, but device complexity increases due to additional processing steps
Solution Approach 1:
The patent introduces embedding vectors as an intermediary representation between the input prompt and the LLM output. By converting both input and output texts into embedding vectors and comparing their similarity, the system creates a measurable metric for hallucination detection without requiring complex analysis of the LLM's internal processing mechanisms.
Solution Approach 2:
The patent replaces complex semantic analysis and factual verification mechanisms with a simpler vector similarity comparison approach. Instead of using elaborate methods to verify the accuracy of LLM outputs, the system substitutes this with computing cosine similarity between embedding vectors, which is computationally more efficient and easier to implement.
2Measurement precision
If embedding vectors are generated for input and output texts, then measurement precision of hallucination is improved, but use of energy increases due to computational requirements
Solution Approach 1:
The patent changes the parameter space by transforming textual data into embedding vector representations. This transformation allows the system to measure hallucination through vector similarity metrics (such as cosine similarity) rather than requiring complex semantic analysis, achieving precise measurement while maintaining reasonable computational efficiency.
Solution Approach 2:
The patent creates embedding vector copies of the input and output texts, which can then be compared without requiring access to the original complex textual structures. These vector copies capture the essential semantic information needed for hallucination detection while being more efficient to process and compare.
3Reliability
If multiple perturbed input texts are used for detection, then reliability of hallucination detection is improved, but loss of time increases due to processing multiple inputs
Solution Approach 1:
The patent performs preliminary processing by generating embedding vectors for multiple perturbed input texts before comparing them with the output embedding vector. This allows the system to efficiently compute similarity metrics across multiple variations of the input, improving the robustness of hallucination detection while managing processing time through batch operations.
Solution Approach 2:
The patent uses multiple perturbed versions of the input text (excessive action) to ensure comprehensive coverage of possible interpretations. By processing several slight variations of the input prompt and comparing their embedding vectors with the output, the system achieves more reliable detection of hallucinations that might be missed with a single input version.
Data Source
AI summary
Systems and methods for detection of hallucination in large language models are disclosed. According to an embodiment, a method may include: (1) receiving, by a computer program, a plurality of input texts, wherein each input text is a prompt for a large language model (LLM) and may include a slight perturbation from an initial input text; (2) generating, by the computer program and for each of the plurality of input texts, an input embedding vector; (3) providing, by the computer program, each input text to a large language model (LLM); (4) receiving, by the computer program and for each input text from the LLM, an output text; (5) generating, by the computer program and for each of the plurality of output texts, an output embedding vector; and (6) generating, by the computer program, a hallucination metric based on the input embedding vectors and the output embedding vectors.


