LLM Hallucination 종합 분석: Prompting 전략 vs. 모델 자체 문제
Survey and analysis of hallucinations in large language models: attribution to prompting strategies or model behavior
TL;DR Highlight
제시된 프레임워크가 LLM의 거짓말 원인을 프롬프트 결함과 모델 결함으로 정확히 분리 판별한다.
Who Should Read
GPT-4, LLaMA 등 LLM을 프로덕션에 쓰면서 hallucination(사실과 다른 답변)을 줄이고 싶은 ML 엔지니어나 백엔드 개발자. 프롬프트를 바꿔야 할지 모델을 바꿔야 할지 판단이 안 서는 상황에 유용.
Core Mechanics
- Hallucination 원인을 '프롬프트 최적화 부족'과 '모델 내재적 한계' 두 가지로 분류하는 귀인(attribution) 프레임워크 제안
- Prompt Sensitivity(PS)와 Model Variability(MV) 두 지표로 hallucination이 어느 쪽 원인인지 수치화 가능
- GPT-4, LLaMA 2, DeepSeek 등 최신 모델을 TruthfulQA, HallucinationEval 벤치마크로 비교 실험
- Chain-of-Thought(CoT, 단계별 추론 유도) 프롬프트가 PS가 높은 케이스에서 hallucination을 유의미하게 줄임
- 모델 내재적 한계가 원인인 경우 프롬프트 개선만으로는 한계가 있어 모델 수준 대응이 필요
Evidence
- TruthfulQA, HallucinationEval 두 개의 공인 벤치마크를 사용해 여러 모델 조건에서 사실성 평가 수행
- CoT 프롬프트가 PS(Prompt Sensitivity) 높은 시나리오에서 hallucination을 '유의미하게(significantly)' 감소시킨다고 보고 (구체적 수치는 abstract에 미공개)
- GPT-4, LLaMA 2, DeepSeek 포함 다수 SOTA(최신 성능) 모델을 통제된 프롬프팅 조건 하에서 비교 분석
How to Apply
- Hallucination이 자주 발생하면 먼저 PS 측정: 같은 질문을 다양한 프롬프트로 바꿔서 결과가 크게 달라지면 프롬프트 문제 → CoT나 구조화된 프롬프트로 교체
- 프롬프트를 여러 번 바꿔도 hallucination이 계속 나오면 MV(Model Variability) 높은 케이스로 판단 → 모델 교체 또는 파인튜닝 검토
- TruthfulQA 기반 평가 셋을 내부 LLM 파이프라인 테스트에 추가해 hallucination 발생률을 정기적으로 모니터링
Code Example
# Prompt Sensitivity(PS) 간이 측정 예시
import openai
question = "대한민국의 수도는 어디인가요?"
prompts = [
f"{question}",
f"다음 질문에 사실만을 바탕으로 답하세요: {question}",
f"단계적으로 생각한 뒤 답하세요 (Chain-of-Thought). 질문: {question}",
f"당신은 사실 확인 전문가입니다. 다음 질문에 정확하게 답하세요: {question}"
]
responses = []
for prompt in prompts:
response = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}],
temperature=0
)
responses.append(response.choices[0].message.content)
# 응답이 서로 다르면 PS 높음 → 프롬프트 개선으로 hallucination 감소 가능
print("=== 프롬프트별 응답 비교 ===")
for i, (p, r) in enumerate(zip(prompts, responses)):
print(f"[프롬프트 {i+1}] {r[:100]}...\n")
unique_responses = set(responses)
print(f"고유 응답 수: {len(unique_responses)} / {len(responses)}")
print("PS 높음 (프롬프트 개선 필요)" if len(unique_responses) > 1 else "PS 낮음 (모델 내재적 문제일 수 있음)")Terminology
관련 논문
Claude Code에서 HTML을 출력 포맷으로 쓰는 이유: Markdown보다 나은 점들
Claude Code 팀이 Markdown 대신 HTML을 LLM 출력 포맷으로 선호하기 시작한 이유와 그 실용적 장점을 정리한 글로, AI와 함께 문서/스펙/대시보드를 만드는 워크플로우에 직접적인 영향을 준다.
언제 투표하고 언제 다시 쓸까: Disagreement 기반 Test-Time Scaling 전략 라우팅
모델 출력이 얼마나 일치하는지 보고 쉬운 문제엔 majority voting, 어려운 문제엔 문제 rewriting을 자동으로 선택해 정확도 3~7% 올리고 샘플링 비용도 줄이는 학습 불필요 프레임워크.
Less Is More: Android 앱에 On-Device Small Language Model 통합할 때 실제로 겪는 엔지니어링 문제들
Wordle 게임에 온디바이스 SLM(Gemma 4 E2B, Qwen3 0.6B)을 5일간 붙여보면서 발견한 5가지 실패 유형과 8가지 실용 해결책 정리
확장 가능한 Synthetic Data 생성을 위한 Dynamic Context Evolution
VTS + Semantic Memory + Adaptive Prompt 3가지 메커니즘으로 구성된 프레임워크는 LLM 대량 synthetic data 생성 시 배치 간 중복·반복 현상을 완전히 제거한다.
Karpathy 워크플로우에서 영감받아 사전 컴파일된 Wiki로 세션당 토큰 90%+ 절감
사전에 정리된 코드베이스 Wiki를 활용하면 Claude 세션당 토큰 사용량을 90% 이상 줄인다.
3개월치 AI 생성 코드를 전부 삭제했다. 그리고 배운 것들.
AI로 작성된 코드베이스를 70% 삭제 후 2주 만에 재작성하니 절반 크기로 줄어들면서 완전한 이해 가능성을 확보했다.
Original Abstract (Expand)
Hallucination in Large Language Models (LLMs) refers to outputs that appear fluent and coherent but are factually incorrect, logically inconsistent, or entirely fabricated. As LLMs are increasingly deployed in education, healthcare, law, and scientific research, understanding and mitigating hallucinations has become critical. In this work, we present a comprehensive survey and empirical analysis of hallucination attribution in LLMs. Introducing a novel framework to determine whether a given hallucination stems from not optimize prompting or the model's intrinsic behavior. We evaluate state-of-the-art LLMs—including GPT-4, LLaMA 2, DeepSeek, and others—under various controlled prompting conditions, using established benchmarks (TruthfulQA, HallucinationEval) to judge factuality. Our attribution framework defines metrics for Prompt Sensitivity (PS) and Model Variability (MV), which together quantify the contribution of prompts vs. model-internal factors to hallucinations. Through extensive experiments and comparative analyses, we identify distinct patterns in hallucination occurrence, severity, and mitigation across models. Notably, structured prompt strategies such as chain-of-thought (CoT) prompting significantly reduce hallucinations in prompt-sensitive scenarios, though intrinsic model limitations persist in some cases. These findings contribute to a deeper understanding of LLM reliability and provide insights for prompt engineers, model developers, and AI practitioners. We further propose best practices and future directions to reduce hallucinations in both prompt design and model development pipelines.