Skip to main content

llm-metrics-lite

MIT License Python Status PyPI version Downloads

llm-metrics-lite

PyPI: https://pypi.org/project/llm-metrics-lite/


llm-metrics-lite

A lightweight, dependency-minimal evaluation toolkit for Large Language Model (LLM) output quality.

License Version Python Versions


Quick Start • Features • Examples • CLI Usage • Roadmap • Contributing • License

llm-metrics-lite provides simple, reliable metrics to evaluate generated text from LLMs. It offers coherence scoring, reference-free perplexity, groundedness checks, token statistics, latency utilities, and a clean CLI interface — all without heavy dependencies.


Quick Start

Install from PyPI:

pip install llm-metrics-lite

# llm-metrics-lite

A lightweight, dependency-minimal evaluation toolkit for Large Language Model (LLM) output quality.

## Why This Library Exists

Existing LLM evaluation tools often:

- require large models or embeddings  
- are part of heavy research frameworks  
- depend on GPU or complex installations  
- lack simple, general-purpose APIs  

llm-metrics-lite was created to be:

- minimal and fast  
- easy to install anywhere  
- suitable for research and production  
- extendable and open-source  

## Features

### Core Capabilities

- **Coherence Scoring**  
  Measures similarity between consecutive sentences to estimate textual flow.

- **Reference-Free Perplexity**  
  Character-level n-gram perplexity that works without any pretrained models.

- **Groundedness and Factuality Checks**  
  Compares model output against reference context for basic factual alignment.

- **Latency Measurement**  
  Simple utilities to benchmark model inference time.

- **Token Statistics**  
  Word count, character count, and approximate token usage.

- **Command Line Interface (CLI)**  
  Evaluate text files directly in the terminal.

### Why it is lightweight

- Zero heavy dependencies  
- No transformers, no GPU required  
- Pure Python implementation  

## Quick Start

Install from PyPI:

pip install llm-metrics-lite


Install from source:

git clone https://github.com/supriyabachal/llm_metrics_lite.git cd llm_metrics_lite pip install -e .


## Examples

### Basic Python Usage

```python
from llm_metrics_lite import train_default_perplexity_model, evaluate_output

corpus = [
    "Artificial intelligence enables machines to learn from data.",
    "Language models process and generate human-like text."
]

model = train_default_perplexity_model(corpus)

output = "Generative AI models help automate reasoning tasks."
context = "AI systems can understand language and produce responses."

result = evaluate_output(
    output_text=output,
    context_text=context,
    perplexity_model=model
)

print(result)

CLI Usage

Evaluate output text:

llm-metrics-lite evaluate output.txt

Evaluate with context reference:

llm-metrics-lite evaluate output.txt --context reference.txt
llm-metrics-lite --help

Roadmap

Planned enhancements include:

  • Embedding-based coherence evaluation
  • Semantic groundedness metrics
  • Batch evaluation support
  • Model-output comparison tools
  • Evaluation dashboard and visualizations
  • Integration helpers for RAG pipelines

Show help:

llm-metrics-lite --help

Metadata

Release files for llm-metrics-lite 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-metrics-lite 0.2.3
File Size Uploaded Provenance
llm_metrics_lite-0.2.3.tar.gz 8.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-metrics-lite 0.2.3
File Interpreter ABI Platform
llm_metrics_lite-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / llm_metrics_lite-0.2.3.tar.gz

Download URL llm_metrics_lite-0.2.3.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ec8ad69f94f4ccfc988702a5ec115910a92b77b1fd8e685b6a5f5d811b849bf6
BLAKE2b-256 checksum
How to use checksums
e2d8dd0aaa6e25d65678412765b01478210ab1ac39f13f2c05feedb14f4f8052
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 19, 2025.

Transparency log

Release files / llm_metrics_lite-0.2.3-py3-none-any.whl

Download URL llm_metrics_lite-0.2.3-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98fdcb31b8cfd88ae2d836305fab207486e431a22f4f170c7bff069f43d2a77b
BLAKE2b-256 checksum
How to use checksums
f0f240787f57148e67639494023d861d37f90b330084e38be86796ad229fbccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 19, 2025.

Transparency log

Security for llm-metrics-lite 0.2.3

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_metrics_lite-0.2.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 19, 2025.

Transparency log

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.

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