Compute shannon entropy from LLM responses to detect hallucinations
Project description
Shannon Entropy
Compute Shannon entropy from LLM responses to detect hallucinations and measure uncertainty in natural language generation.
Installation
pip install aks-shannon-entropy
Features
- Shannon Entropy Computation: Calculate entropy from LLM response distributions
- Hallucination Detection: Identify unreliable or hallucinated model outputs
- Uncertainty Quantification: Measure model confidence and uncertainty
- LLM Integration: Works with HuggingFace transformers and other LLM frameworks
Usage
from shannon_entropy import compute_entropy
responses = ["response1", "response2", "response3"]
entropy = compute_entropy(responses)
print(f"Entropy: {entropy}")
Dependencies
See pyproject.toml for full dependencies.
License
MIT - See LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aks_shannon_entropy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aks_shannon_entropy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13fe638ac519d34177fa96aa34b29c0689f51c3d3e086ab851cb70da659a7fa2
|
|
| MD5 |
95418779a51d7e3a05374963c46e91a7
|
|
| BLAKE2b-256 |
2028106b367587bdc75ca4d6c483832f357321888753197a3d11197fc688dca0
|