LLM Hallucination Detection
LLM-Halluzinationen ohne Detection können zu falschen Informationen und Reputationsschäden führen. Vier Kontrollen: Fact-Checking Models, Consistency Verification, Confidence Scoring und Hallucination Mitigation.
Was ist LLM Hallucination Detection? Einfach erklärt
LLM Halluzination Detection ist wie ein Fakten-Checker für KI-Ausgaben: Fact-Checking Models vergleichen Claims gegen Wikipedia und vertrauenswürdige Quellen. Consistency Verification prüft auf Widersprüche innerhalb und zwischen Outputs. Confidence Scoring schätzt mit Logit-Entropie und Ensemble-Methoden wie sicher das Modell ist. Hallucination Mitigation nutzt RAG für Faktengrundung, Chain-of-Thought für besseres Reasoning und Post-Processing für Korrekturen. Ohne Detection können Halluzinationen zu Fehlinformationen, Reputationsschäden oder Compliance-Verletzungen führen.
↓ Springe zu Halluzination-Detection-Kontrollen
4 Halluzination-Detection-Kontrollen
Use fact-checking models to verify factual claims in LLM outputs. Compare outputs against trusted knowledge bases and flag inconsistencies.
# Moltbot fact-checking models:
fact_checking:
enabled: true
# Fact-checking models:
models:
# Claim extraction:
claim_extractor:
enabled: true
model: "claim-extractor-v1"
# Extract factual claims from LLM output
# Example: "Paris is the capital of France" -> claim: "Paris is the capital of France"
# Fact verifier:
fact_verifier:
enabled: true
model: "fact-verifier-v1"
# Verify claims against knowledge base
# Knowledge base: Wikipedia, trusted sources
# Output: true (fact) or false (hallucination)
# Knowledge base:
knowledge_base:
# Trusted sources for fact-checking:
sources:
- wikipedia
- wikidata
- internal_knowledge_base
# Add custom knowledge bases as neededVerify consistency within and across LLM outputs. Check for contradictions, logical inconsistencies, and factual inconsistencies.
# Moltbot consistency verification:
consistency_verification:
enabled: true
# Internal consistency:
internal:
enabled: true
# Check for contradictions within output
# Example: "X is true" and "X is false" in same output
# Check: logical consistency, factual consistency
# Cross-output consistency:
cross_output:
enabled: true
# Check for contradictions across outputs
# Example: "X is true" in output 1, "X is false" in output 2
# Check: consistency across conversation history
# Consistency with context:
context_consistency:
enabled: true
# Check for consistency with provided context
# Example: RAG context says "X is true", output says "X is false"
# Check: output aligns with provided context
# Verification action:
action:
# Flag inconsistent outputs
# Provide explanation of inconsistency
# Suggest correction
enabled: trueScore LLM outputs based on confidence. Use model logits, ensemble methods, and uncertainty quantification to estimate confidence.
# Moltbot confidence scoring:
confidence_scoring:
enabled: true
# Logit-based scoring:
logit_scoring:
enabled: true
# Use model logits to estimate confidence
# High entropy logits -> low confidence
# Low entropy logits -> high confidence
# Method: softmax probability, entropy calculation
# Ensemble scoring:
ensemble_scoring:
enabled: true
# Use ensemble of models to estimate confidence
# If models disagree -> low confidence
# If models agree -> high confidence
# Method: variance across ensemble predictions
# Uncertainty quantification:
uncertainty:
enabled: true
# Quantify uncertainty in predictions
# Methods: Monte Carlo dropout, Bayesian neural networks
# Output: uncertainty score (0-1)
# Scoring threshold:
threshold:
# Low confidence threshold
# If confidence < threshold: flag as potential hallucination
low_confidence_threshold: 0.6Mitigate hallucinations using retrieval-augmented generation, chain-of-thought prompting, and post-processing correction.
# Moltbot hallucination mitigation:
hallucination_mitigation:
enabled: true
# Retrieval-augmented generation (RAG):
rag:
enabled: true
# Use RAG to ground outputs in retrieved facts
# Retrieve relevant documents from knowledge base
# Include retrieved context in prompt
# Reduces hallucination by providing factual grounding
# Chain-of-thought prompting:
cot_prompting:
enabled: true
# Use chain-of-thought prompting to improve reasoning
# Prompt: "Think step by step before answering"
# Reduces hallucination by encouraging reasoning
# Post-processing correction:
post_processing:
enabled: true
# Correct hallucinations after generation
# Use fact-checking to identify hallucinations
# Replace hallucinated content with factual content
# Or flag for human reviewHäufige Fragen
What is the difference between fact-checking and consistency verification?
Fact-checking verifies factual claims against an external knowledge base (Wikipedia, trusted sources). It answers the question "is this claim factually true?". Consistency verification checks for contradictions within and across outputs, and with provided context. It answers the question "is this output consistent with itself and the context?". Both are necessary: fact-checking ensures factual accuracy, consistency verification ensures logical coherence. Example: Fact-checking verifies "Paris is the capital of France" against Wikipedia. Consistency verification checks that the output doesn't say both "X is true" and "X is false".
How does confidence scoring help detect hallucinations?
Confidence scoring estimates how confident the model is in its output. Low confidence often correlates with hallucination because the model is unsure about the answer. Confidence can be estimated from model logits (high entropy = low confidence), ensemble methods (disagreement between models = low confidence), or uncertainty quantification (Monte Carlo dropout, Bayesian methods). By flagging low-confidence outputs, you can identify potential hallucinations for further review or correction. However, confidence scoring is not perfect — models can be confidently wrong (overconfident hallucinations) or uncertain but correct.
How does RAG reduce hallucinations?
RAG (Retrieval-Augmented Generation) reduces hallucinations by grounding the model's output in retrieved facts. Instead of relying solely on the model's internal knowledge, RAG retrieves relevant documents from a knowledge base and includes them in the prompt. The model can then reference these facts in its output, reducing the likelihood of hallucination. RAG is particularly effective for factual questions where the knowledge base contains accurate, up-to-date information. However, RAG is not a silver bullet — if the retrieved documents are incorrect or irrelevant, the model may still hallucinate. Additionally, RAG adds latency and complexity to the system.
What are the limitations of hallucination detection?
Hallucination detection has several limitations: 1) False positives — fact-checking may flag correct outputs as hallucinations if the knowledge base is outdated or incorrect. 2) False negatives — models can be confidently wrong (overconfident hallucinations) that evade detection. 3) Knowledge base limitations — fact-checking is limited by the coverage and accuracy of the knowledge base. 4) Subjectivity — some claims are subjective or opinion-based, making fact-checking difficult. 5) Latency — fact-checking and consistency verification add latency to the generation process. 6) Cost — ensemble methods and uncertainty quantification increase computational cost.