You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52Lines changed: 52 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -115,6 +115,56 @@ The system combines three key components:
115
115
116
116
## Adaptive Classification with LLMs
117
117
118
+
### Hallucination Detector
119
+
120
+
The adaptive classifier can detect hallucinations in language model outputs, especially in Retrieval-Augmented Generation (RAG) scenarios. Despite incorporating external knowledge sources, LLMs often still generate content that isn't supported by the provided context. Our hallucination detector identifies when a model's output contains information that goes beyond what's present in the source material.
121
+
122
+
The classifier categorizes text into:
123
+
124
+
-**HALLUCINATED**: Output contains information not supported by or contradictory to the provided context
125
+
-**NOT_HALLUCINATED**: Output is faithfully grounded in the provided context
126
+
127
+
Our hallucination detector has been trained and evaluated on the RAGTruth benchmark, which provides a standardized dataset for assessing hallucination detection across different task types:
The detector shows particularly high recall (80.68% overall), making it effective at catching potential hallucinations, with strong performance on data-to-text generation tasks. The adaptive nature of the classifier means it continues to improve as it processes more examples, making it ideal for production environments where user feedback can be incorporated.
139
+
140
+
```python
141
+
from adaptive_classifier import AdaptiveClassifier
if prediction[0][0] =='HALLUCINATED'and prediction[0][1] >0.6:
160
+
print("Warning: Response may contain hallucinations")
161
+
# Implement safeguards: request human review, add disclaimer, etc.
162
+
```
163
+
164
+
This system can be integrated into RAG pipelines as a safety layer, LLM evaluation frameworks, or content moderation systems. The ability to detect hallucinations helps build more trustworthy AI systems, particularly for applications in domains like healthcare, legal, finance, and education where factual accuracy is critical.
165
+
166
+
The detector can be easily fine-tuned on domain-specific data, making it adaptable to specialized use cases where the definition of hallucination may differ from general contexts.
167
+
118
168
### LLM Configuration Optimization
119
169
120
170
The adaptive classifier can also be used to predict optimal configurations for Language Models. Our research shows that model configurations, particularly temperature settings, can significantly impact response quality. Using the adaptive classifier, we can automatically predict the best temperature range for different types of queries:
@@ -223,6 +273,8 @@ This real-world evaluation demonstrates that adaptive classification can signifi
0 commit comments