# What are AI Hallucinations?

_AI hallucinations occur when models generate confident but factually incorrect, fabricated, or nonsensical outputs—a fundamental challenge for enterprise AI deployment._

AI hallucinations occur when models generate confident but factually incorrect, fabricated, or nonsensical outputs. The model doesn't know it's wrong—it produces plausible-sounding text with the same confidence it applies to accurate information.

Why it matters: In enterprise applications, hallucinations can cause real harm. A customer service bot that invents policies. A medical assistant that fabricates drug interactions. A legal AI that cites non-existent cases. Hallucinations erode trust, create liability, and undermine the business case for AI.

## Types of AI Hallucinations

### Factual Hallucinations
The model states something objectively false as fact.
- Inventing statistics, dates, or historical events
- Misattributing quotes to the wrong people
- Generating fictional scientific studies or papers
- Creating non-existent company policies or product features

### Contextual Hallucinations
The model ignores or contradicts provided context.
- Answering questions not asked
- Contradicting source documents in a RAG system
- Making up details not present in the prompt or retrieved data
- Confusing entities or mixing up attributes

### Logical Hallucinations
The model's reasoning is internally inconsistent.
- Contradicting itself within the same response
- Drawing conclusions that don't follow from premises
- Applying incorrect mathematical or logical operations
- Circular reasoning presented as valid argument

### Structural Hallucinations
The model fabricates structural elements.
- Inventing citations, URLs, or references
- Creating fake tables, data, or code that doesn't work
- Generating plausible-looking but meaningless technical jargon
- Producing responses in wrong formats despite clear instructions

Hallucinations are a key [AI safety](/ai-safety) concern and overlap with [LLM security](/llm-security) risks. Understanding the relationship between [hallucinations and drift](/post/ai-hallucinations-vs-ai-drift-understanding-and-managing-ai-drift-for-long-term-success) helps distinguish between different failure modes.

## Why LLMs Hallucinate

Understanding the root causes helps explain why hallucinations can't be eliminated—only managed:

### Statistical Prediction, Not Truth-Seeking
LLMs predict the most likely next token given the preceding context. They don't have a concept of truth or fact-checking—only statistical patterns learned from training data.

### No Grounding in Reality
LLMs have no sensory experience, no real-time access to the world, and no ability to verify claims. They can only manipulate the patterns they've learned.

### Compression and Generalization
Training compresses vast amounts of text into model weights. Specific facts get averaged, conflated, or lost. The model fills gaps with plausible-seeming content.

### Instruction-Following Pressure
Models are trained to be helpful and provide answers. When they don't know something, they often generate content rather than admitting uncertainty.

### Context Window Limitations
Long conversations or documents may exceed what the model can effectively attend to, leading to inconsistencies and fabrications.

## Detecting Hallucinations

### Faithfulness Scoring
Measure whether the output is supported by the input context. A response is faithful if every claim can be traced back to the source material.

### Groundedness Checks
For RAG systems: does the response accurately reflect the retrieved documents? Flag outputs that add unsupported information.

### Factual Verification
Compare claims against authoritative knowledge bases, databases, or APIs. Useful for structured facts (dates, numbers, entities).

### Self-Consistency
Generate multiple responses to the same prompt. High variance across responses suggests the model is confabulating rather than grounding in reliable knowledge.

### Confidence Calibration
Monitor when the model expresses high confidence on uncertain topics. Poorly calibrated confidence is a hallucination risk indicator.

## Preventing Hallucinations

No technique eliminates hallucinations entirely. The goal is reduction and containment:

### Retrieval-Augmented Generation (RAG)
Provide relevant source documents with each query. Ground responses in actual data rather than parametric memory. But note: models can still ignore or misinterpret provided context.

### Constrained Generation
Limit outputs to structured formats (JSON, specific templates). Reduce degrees of freedom where the model can fabricate.

### Temperature and Sampling Controls
Lower temperature reduces randomness and creativity—which also reduces some hallucination types. Trade-off: may reduce response quality for open-ended tasks.

### Multi-Step Verification
Have the model cite sources, then verify citations exist. Break complex tasks into verifiable steps.

### Human-in-the-Loop
For high-stakes outputs, require human review before action. The model drafts; humans verify.

### Supervision as the Safety Net
Even with all prevention measures, hallucinations will occur. [AI supervision](/ai-supervision) provides the enforcement layer that detects hallucinations in real time and blocks them before they reach users—or at minimum, flags them for review.

### Domain-Specific Fine-Tuning
Models fine-tuned on domain-specific data with verified facts hallucinate less in that domain. But they can still hallucinate on edge cases and unfamiliar queries.

## Hallucination Metrics

Key metrics for monitoring hallucination risk:

- **Faithfulness score**: Percentage of response claims supported by source context
- **Groundedness score**: Degree to which RAG responses reflect retrieved documents
- **Citation accuracy**: Percentage of citations that exist and support the claim made
- **Self-consistency rate**: Agreement across multiple generations for the same query
- **Refusal rate**: How often the model appropriately declines vs. fabricates

## How Swept AI Addresses Hallucinations

Swept AI provides layered defense against hallucination risk:

- **[Evaluate](/product/evaluate)**: Pre-deployment testing that measures hallucination rates across your specific use cases, data, and user populations. Identify high-risk query patterns before production.

- **[Supervise](/product/supervise)**: Real-time faithfulness and groundedness monitoring. Alert on hallucination patterns. Enforce policies that require source attribution for factual claims.

- **Distribution mapping**: Understand the conditions under which your model hallucinates. Build detection around deviations from known-good behavior, not generic rules.

Hallucinations are an inherent property of language models. The question isn't whether your AI will hallucinate—it's whether you'll detect it before your customers do.