Skip to main content

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.

Metadata

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)

Table of built distributions (wheels) for aks-shannon-entropy 0.1.0
File Interpreter ABI Platform Actions
aks_shannon_entropy-0.1.0-py3-none-any.whl Python 3 none any Details for aks_shannon_entropy-0.1.0-py3-none-any.whl

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

Security for aks-shannon-entropy 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page