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.
Release files for aks-shannon-entropy 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aks_shannon_entropy-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / aks_shannon_entropy-0.1.0-py3-none-any.whl
| Download URL | aks_shannon_entropy-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13fe638ac519d34177fa96aa34b29c0689f51c3d3e086ab851cb70da659a7fa2
|
|
BLAKE2b-256 checksum How to use checksums |
2028106b367587bdc75ca4d6c483832f357321888753197a3d11197fc688dca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|