Skip to main content

A high-performance NLP evaluation metrics library with a Rust core.

Project description

BlazeMetrics

BlazeMetrics Logo

100x Faster LLM Evaluation

Rust-powered evaluation suite processing 1M+ evaluations/sec.
Complete LLM quality, safety, and performance monitoring in one unified API.

BlazeMetrics Dashboard

Downloads Python Versions Documentation Last Commit Platform/Wheel Made with Rust & Python


Quick Links


Don't Stop Until Done

BlazeMetrics is designed to make evaluation, guardrails, monitoring, and analytics continuous and actionable at production scale. Whether you're running compliance, safety, real-world production, or benchmarking workflows, BlazeMetrics is built to keep evaluating, analyzing, and monitoring—all the way to the finish line. No matter how large your data or how demanding your workflow, you get complete, automated, and live insights. Don't stop until you're done.


Why BlazeMetrics?

  • All-in-one evaluation: BLEU, ROUGE, WER, METEOR, and more—plus analytics and real guardrail safety
  • Rust-powered performance: 100x speed improvement, process millions of LLM/NLP samples in seconds
  • Built-in guardrails: Blocklists, PII detection, regex validation, JSON schema enforcement, safety scoring, and LLM-based factuality assessment
  • Enterprise and research ready: Advanced analytics, anomaly detection, dashboards, monitoring, and instant reporting
  • Seamless integration: Out-of-the-box support for LLMs, RAG systems, and agent workflows

Live Benchmark: Speed vs Leading Industry Libraries

Benchmark Objective: Speed and memory comparison for computing BLEU, ROUGE, METEOR, and other metrics between BlazeMetrics and leading evaluation libraries.

Library Time (s) Relative Speed
BlazeMetrics 4.85 1.00x (baseline)
NLTK 5.40 1.11x slower
SacreBLEU 5.51 1.13x slower
Huggingface Evaluate 18.19 3.75x slower
TorchMetrics 63.59 13.10x slower

Test Configuration: 10,000 normalized candidate/reference text pairs, median of 3 runs with full normalization and psutil RAM/CPU monitoring.

For detailed benchmarks and comparisons, visit our benchmarks page.


Key Features

  • State-of-the-art metrics: BLEU, ROUGE, WER, METEOR, CHRF, BERTScore, and more
  • Advanced guardrails: Block unsafe content, redact PII, enforce custom policies with regex/JSON validation
  • Real-time streaming analytics: Outlier detection, trending analysis, alerts for continuous evaluation
  • LLM and RAG integration: Seamless compatibility with OpenAI, Anthropic, LangChain, HuggingFace, and agent workflows
  • Factuality and judge scoring: Hallucination and faithfulness assessment using LLM judges
  • Production-scale performance: Rust-powered core with easy parallelism and batch processing
  • Comprehensive dashboards and reporting: Instant model cards, web dashboards, and analytics visualization
  • Highly extensible: Custom guardrails, exporters, and analytics for your specific workflow needs

Installation

Stable release (CPU, core features):

pip install blazemetrics

With dashboards and monitoring features:

pip install "blazemetrics[dashboard]"

Development installation from source:

git clone https://github.com/2796gaurav/blazemetrics.git
cd blazemetrics
pip install -r requirements.txt
maturin develop

Quick Start: Evaluate Key Metrics in Seconds

Get comprehensive evaluation metrics with just 3 lines of code—no configuration required:

from blazemetrics import BlazeMetricsClient

candidates = ["The quick brown fox.", "Hello world!"]
references = [["The fast brown fox."], ["Hello world."]]

client = BlazeMetricsClient()
metrics = client.compute_metrics(candidates, references)
print(metrics)  # {'rouge1_f1': [...], 'bleu': [...], ...}

aggregated = client.aggregate_metrics(metrics)
print(aggregated)  # {'rouge1_f1': 0.85, ...}

Complete LLM Workflow: Metrics, Guardrails, Analytics, and Factuality

Comprehensive evaluation pipeline combining traditional metrics, safety guardrails, real-time analytics, and LLM-based factuality scoring:

from blazemetrics import BlazeMetricsClient
from blazemetrics.llm_judge import LLMJudge

# Sample LLM generations and ground truth references
candidates = ["Alice's email is alice@example.com.", "2 + 2 is 5."]
references = [["Her email is alice@example.com."], ["2 + 2 = 4"]]

# Initialize client with comprehensive configuration
client = BlazeMetricsClient(
    blocklist=["bitcoin"],
    redact_pii=True,
    regexes=[r"\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b"],
    enable_analytics=True,
    metrics_lowercase=True,
)

# 1. Compute traditional NLP metrics
metrics = client.compute_metrics(candidates, references)
aggregated_metrics = client.aggregate_metrics(metrics)

# 2. Run safety and guardrail checks
violations = client.check_safety(candidates)

# 3. Update analytics and get trend analysis
client.add_metrics(aggregated_metrics)
analytics_summary = client.get_analytics_summary()

# 4. LLM-based factuality scoring (requires OpenAI API key)
judge = LLMJudge(provider="openai", api_key="YOUR_OPENAI_KEY", model="gpt-4o")

def factuality_scorer(output, reference):
    result = judge.score([output], [reference])
    return {"factuality": result[0].get("faithfulness", 0.0)}

client.set_factuality_scorer(factuality_scorer)
factuality_scores = client.evaluate_factuality(candidates, [r[0] for r in references])

# 5. Generate comprehensive model evaluation report
model_card = client.generate_model_card(
    "my-llm", 
    metrics, 
    analytics_summary, 
    config=vars(client.config),
    violations=violations, 
    factuality=factuality_scores
)
print(model_card)

Integration Examples

BlazeMetrics integrates seamlessly with popular ML and LLM frameworks:

  • LLM Providers: Drop-in evaluation for HuggingFace, OpenAI, Anthropic, LangChain workflows
  • RAG Systems: Built-in support with semantic_search, agentic_rag_evaluate, and provenance tracking
  • Real-time Monitoring: Live dashboards via blazemetrics-dashboard (available with [dashboard] installation)
  • Export Formats: Built-in exporters for Prometheus, StatsD, CSV, and HTML reports

For detailed integration examples, check our real-world use cases.


Advanced Features

Parallel and Asynchronous Processing

# Parallel evaluation for large datasets
parallel_metrics = client.compute_metrics_parallel(candidates, references)

# Asynchronous processing for non-blocking evaluation
async_metrics = await client.compute_metrics_async(candidates, references)

Real-time Analytics and Monitoring

# Streaming analytics with anomaly detection
client.add_metrics_sample(sample_metrics)
anomalies = client.detect_anomalies()
trends = client.get_trends()

Interactive Dashboards

After installing with dashboard support:

blazemetrics-dashboard

Or embed the dashboard server in your WSGI application pipeline.

RAG and Agent Evaluation

# Evaluate RAG systems and agent workflows
rag_results = client.agentic_rag_evaluate(
    queries=queries,
    contexts=contexts,
    answers=answers,
    ground_truths=ground_truths
)

Configuration Options

The BlazeMetricsClient supports extensive configuration options:

Metrics Configuration:

  • metrics_include: Specify which metrics to compute
  • metrics_lowercase: Enable lowercase normalization
  • metrics_stemming: Apply stemming to text

Guardrails and Safety:

  • blocklist: Custom blocked terms and phrases
  • regexes: Custom regex patterns for validation
  • redact_pii: Automatic PII detection and redaction
  • case_insensitive: Case-insensitive pattern matching

Analytics and Monitoring:

  • enable_analytics: Real-time analytics tracking
  • analytics_window: Sliding window for trend analysis
  • analytics_alerts: Threshold-based alerting
  • analytics_anomalies: Anomaly detection settings

Performance Optimization:

  • parallel_processing: Enable parallel computation
  • max_workers: Maximum worker threads for parallel processing

Export and Integration:

  • enable_monitoring: Export metrics to monitoring systems
  • prometheus_gateway: Prometheus pushgateway integration
  • statsd_addr: StatsD server address for metrics export

For complete configuration details, visit our documentation.


Resources and Learning


Contributing and Community

We welcome contributions from the community! Here's how you can get involved:

  • Star the project on GitHub to show your support
  • Report issues or submit feature requests via GitHub Issues
  • Contribute code by creating pull requests
  • Join discussions and help evolve LLM benchmarking and safety standards

License

This project is licensed under the MIT License. See the LICENSE file for details.


BlazeMetrics © 2025 by Gaurav

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blazemetrics-0.1.6.tar.gz (735.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

blazemetrics-0.1.6-cp38-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.8+Windows x86-64

blazemetrics-0.1.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

blazemetrics-0.1.6-cp38-abi3-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file blazemetrics-0.1.6.tar.gz.

File metadata

  • Download URL: blazemetrics-0.1.6.tar.gz
  • Upload date:
  • Size: 735.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.6

File hashes

Hashes for blazemetrics-0.1.6.tar.gz
Algorithm Hash digest
SHA256 b39ec07a2043c26c91590d9da4b074384926f5d53a5f23c4ae6eccc536e0b39b
MD5 4a80810221dfe5bea80d4440ea7edff1
BLAKE2b-256 66626b98596c9d34c69e0ca31e4351e42ba59283a71b8bad9855c4153935058e

See more details on using hashes here.

File details

Details for the file blazemetrics-0.1.6-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for blazemetrics-0.1.6-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 94d2e5c3bbaacb25d094a818b409038794aa32c629d10b0d26d3f4790fa10f08
MD5 e934b04cfc916aa77ebf71216c431c3e
BLAKE2b-256 7e4bc19b91a9bcd37daa9d0ddbf2ef7ce62cfa59461c26277f364d7f352b9d14

See more details on using hashes here.

File details

Details for the file blazemetrics-0.1.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for blazemetrics-0.1.6-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 80a9edf38f522e0ae966c4c0e0ab44b0caddfc9353e82040d86a3981119b9a80
MD5 4223b2e9e9a0a878c34b480731ca0ba9
BLAKE2b-256 cf0a3b28c9e98cd75de7bbf78680eec6e467307536e7e6b08ddab508fde9a5dc

See more details on using hashes here.

File details

Details for the file blazemetrics-0.1.6-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for blazemetrics-0.1.6-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3f721d43879d8eb8d169ecb8ae33322a50e5e3f731f1f56bb01315328766d63
MD5 930773d56cea3db9a1e6eed63caafc65
BLAKE2b-256 373b78c31e0a000ebf6b902a47aa5fdc7518c6acba41a1afc23f7a711f7c6fed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page