Skip to main content

Failure case analysis in the era of LLM.

Project description

EvalVitals

CI PyPI Python Docs License: CC0-1.0

EvalVitals is an sklearn-like toolkit for failure-case analysis in the era of LLMs, VLMs, omni (text+image+audio+video) models, and agentic systems. Model identity (ModelSpec) is separate from runtime (Backend); analyzers (Analyzer) connect to models by capability matching (Capability), so the same spec runs through a black-box API or a white-box local backend — only the capability set changes.

Contract Role
ModelSpec Model identity: family, HF repo, architecture traits, modalities.
Backend Runtime: local HF internals, black-box API, or offline batch engines.
Model A runnable object with generate() and forward(capture=...) -> Trace.
Analyzer An sklearn-style estimator: Analyzer(**params).run(model, data) -> Result.
Capability Vocabulary matching analyzers to compatible model runtimes.
FailureCase Central data unit for prompts, labels, provenance, agent trajectories.
Result Uniform output: human-readable summary + structured findings.

What's Inside

EvalVitals covers three layers of the analysis workflow, usable independently or chained into one automated loop:

  1. Analyzer toolkit — 26 registered analyzers (attention, uncertainty, hallucination, Shapley attribution, logit lens, representation geometry, agent-trajectory analysis) run against any model/backend pair through the same Analyzer(**params).run(model, data) -> Result call shape. See the Demo below and the Analyzer Zoo.
  2. Data analysis agent (M2/M3)evalvitals explore points a coding agent at a raw results directory (any JSON/JSONL shape, no host-side parsing) and gets back descriptive takeaways, charts, and 1-3 falsifiable hypotheses — no code required. See Exploratory Analysis (M2/M3).
  3. Intervention (M4/M5)HypothesisTester verifies a hypothesis statistically and against the stated experiment protocol; FixAgent then proposes and validates candidate repairs (prompt → scaffold → internals → parameter space) against the unmodified baseline with paired McNemar + e-value. See Intervention & Verification (M4/M5).

VLDiagnoseLoop chains all three (M1→M2→M3→M5, M4 post-loop) into one automated failure-attribution pipeline — see Quickstart.

Demo

Relative attention on a VLM — "MLLMs Know Where to Look" (code):

from PIL import Image
from evalvitals import compose, Capability
from evalvitals.analyzers.attention import RelativeAttentionAnalyzer
from evalvitals.core.case import Inputs

# Load Qwen2.5-VL with white-box attention capture
model = compose("qwen2.5-vl-7b-instruct", "hf_local", want={Capability.ATTENTION})

# Run relative attention: ratio of task-specific vs generic image attention
result = RelativeAttentionAnalyzer(layer=22, top_k=5).run(
    model,
    Inputs(prompt="What color is the car?", image=Image.open("scene.jpg")),
)

print(result.summary())   # agent-readable findings
result.plot()             # (H, W) heatmap — requires evalvitals[viz]

The same call shape works for any registered model/analyzer pair — a plain text LLM, a config-driven YAML run, or an explicit backend — see Quickstart for those and for the automated failure-attribution loop (VLDiagnoseLoop, M1→M2→M3→M5) and no-code exploratory analysis (evalvitals explore).

Install

pip install -e .
pip install -e ".[viz]"
pip install -e ".[dev]"

Documentation

Examples

Each directory under examples/ is a self-contained, runnable demo:

cd examples/analyzer_demos/qwen_attention  && docker compose up   # attention analysis on a text LLM
cd examples/m2_statistics/deco_hallu_explore && docker compose up # M2/M3 explore, real M1 data
cd examples/m2_statistics/deco_hallu_explore && bash run_attn.sh  # ... attention-enriched: FAIL/PASS distributions + cross-checkpoint geometry (no GPU; data ships with the repo)
cd examples/m2_statistics/deco_hallu_explore && bash run_attn_pipeline.sh  # ... FULL held-out pipeline: propose → held-out test + LLM judge → L1..L3b fix → one 4-tab report (SKIP_FIX=1 for the no-GPU half)
cd examples/diagnosis_loops/qwen_loop_agy  && docker compose up   # VLDiagnoseLoop M1→M5 (VLM)

See examples/README.md for the full list, grouped by layer (single analyzers, standalone M2/M3, full diagnosis loop).

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

evalvitals-0.1.0.tar.gz (523.3 kB view details)

Uploaded Source

Built Distribution

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

evalvitals-0.1.0-py3-none-any.whl (636.5 kB view details)

Uploaded Python 3

File details

Details for the file evalvitals-0.1.0.tar.gz.

File metadata

  • Download URL: evalvitals-0.1.0.tar.gz
  • Upload date:
  • Size: 523.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evalvitals-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a6913a9319aaaf9d618f6bd84ffd04147c6a566ae4e680c2eb02749680387f0b
MD5 df16cf55595648b50d0684802e231714
BLAKE2b-256 d759e668830d494c69fbc7337fea82ca867fc4feef8e1341189202709fb74098

See more details on using hashes here.

Provenance

The following attestation bundles were made for evalvitals-0.1.0.tar.gz:

Publisher: release.yml on evalvitals/evalvitals

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file evalvitals-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: evalvitals-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 636.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evalvitals-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ec494955ccf411324843d9a18ed34fba897d9f8266557eec157f94f176b40b8
MD5 c0e706f05bb06eb3d56612d061327107
BLAKE2b-256 97a576f90b15042bae30b45e3302237c2c610208693af5c76d99b8741bda22cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for evalvitals-0.1.0-py3-none-any.whl:

Publisher: release.yml on evalvitals/evalvitals

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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