Halüsinasyonları Algılama ve Ölçme
Bir RAG sisteminin getirilen bağlam tarafından desteklenmeyen gerçekleri uydurduğunu algılamak için pratik teknikleri ve değerlendirme kapsamında halüsinasyon oranını nicel olarak ölçmeyi öğrenin.
Halüsinasyonları Algılama ve Ölçme, CoddyKit'te ücretsiz bir LLM Apps in Production (RAG + Vector DB + Caching) dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, LLM Apps in Production (RAG + Vector DB + Caching) öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. LLM Apps in Production (RAG + Vector DB + Caching) kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
What Is a RAG Hallucination?
A hallucination is an answer that is fluent and confident but not supported by the retrieved context. In RAG, the cure is grounding: every claim should trace back to a source.
Measuring hallucination rate is essential to trust your system.
Faithfulness vs Correctness
Two different things to measure:
- Faithfulness — is the answer supported by the provided context?
- Correctness — is the answer factually true in the real world?
A RAG answer can be correct but unfaithful (right by luck) or faithful but wrong (the source was wrong).
Claim Decomposition
To check faithfulness, break the answer into atomic claims, then verify each against the context.
answer = 'Paris is the capital of France and has 5 million people.'
claims = [c.strip() for c in answer.replace(' and ', '. ').split('.') if c.strip()]
for c in claims:
print('CLAIM:', c)Context Entailment
For each claim, ask: does the retrieved context entail it? An NLI model or an LLM judge labels each claim as supported, contradicted, or not-mentioned.
- Supported = grounded
- Not-mentioned = potential hallucination
- Contradicted = definite error
LLM-as-Judge for Faithfulness
A common pattern: prompt a strong model with the context, the answer, and ask it to score whether the answer is fully supported. Calibrate the judge against human labels.
Computing Hallucination Rate
Hallucination rate = fraction of claims (or answers) that are unsupported.
labels = ['supported', 'supported', 'not_mentioned', 'contradicted']
bad = sum(1 for x in labels if x != 'supported')
rate = bad / len(labels)
print('Hallucination rate:', round(rate, 2))Citation Coverage
If your system outputs citations, you can measure citation coverage: the share of sentences that point to a retrieved chunk that actually supports them. Low coverage signals hallucination risk.
Detecting Missing Context
Many hallucinations happen because retrieval failed and the model filled the gap. Track cases where the context lacks the answer but the model still answered confidently instead of saying 'I do not know'.
A Simple Faithfulness Score
Aggregate per-claim labels into a single score per answer.
def faithfulness(labels):
return sum(1 for x in labels if x == 'supported') / len(labels)
print(faithfulness(['supported', 'supported', 'not_mentioned']))Reducing Hallucinations
Once measured, reduce hallucinations by:
- Improving retrieval recall
- Instructing the model to abstain when unsupported
- Requiring inline citations
- Post-hoc filtering of unsupported claims
Tracking Over Time
Add hallucination rate to your regular eval runs. Watch it on every prompt or model change so a regression is caught before it reaches users.
Quick Check
Test your understanding of faithfulness.
Recap
You learned to detect hallucinations by separating faithfulness from correctness, decomposing answers into claims, checking entailment against context with an LLM judge, and computing a hallucination rate. Track it over time and reduce it with better retrieval, abstention, and citations.
Sıkça Sorulan Sorular
“Halüsinasyonları Algılama ve Ölçme” dersi ücretsiz mi?
Evet — “Halüsinasyonları Algılama ve Ölçme” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve LLM Apps in Production (RAG + Vector DB + Caching) kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. LLM Apps in Production (RAG + Vector DB + Caching) kursu toplamda 4 dersten oluşur.
“Halüsinasyonları Algılama ve Ölçme” dersinde ne öğreneceğim?
Bir RAG sisteminin getirilen bağlam tarafından desteklenmeyen gerçekleri uydurduğunu algılamak için pratik teknikleri ve değerlendirme kapsamında halüsinasyon oranını nicel olarak ölçmeyi öğrenin. LLM Apps in Production (RAG + Vector DB + Caching) ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
LLM Apps in Production (RAG + Vector DB + Caching) öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te LLM Apps in Production (RAG + Vector DB + Caching), başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Halüsinasyonları Algılama ve Ölçme” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu LLM Apps in Production (RAG + Vector DB + Caching) dersinde kod yazıp çalıştırabilir miyim?
Evet. Her LLM Apps in Production (RAG + Vector DB + Caching) dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- RAG Performansı İçin Temel Ölçütler
- Değerlendirme Karşılaştırma Ölçütleri Geliştirme
- A/B Sınaması ve Kullanıcı Geri Bildirim Döngüleri
- Halüsinasyonları Algılama ve Ölçme