Skip to main content

Evaluation harness for Vision-Language Models on non-standard axes (calibration under distribution shift, and beyond)

Project description

vlm-eval

A lightweight evaluation harness for Vision-Language Models (VLMs) on axes that mainstream benchmarks don't cover. First task module: calibration under distribution shift — how well a model's confidence tracks its actual correctness as images are blurred or corrupted with noise.

Quickstart

uv sync --all-extras --dev
uv run vlm-eval run --task calibration_shift --model mock

This runs the calibration_shift task against the deterministic MockVLMWrapper over the tiny fixture dataset in tests/fixtures/, and writes report/leaderboard.md + report/leaderboard.json.

Add --shift blur or --shift noise to evaluate under a corruption.

Design

  • vlm_eval/models/ — thin wrappers around real VLM backends (transformers, open_clip), all implementing one VLMWrapper interface so tasks and scorers are model-agnostic.
  • vlm_eval/tasks/ — a task pairs a dataset with a prompt template and a scorer.
  • vlm_eval/scorers/ — accuracy, Expected Calibration Error (ECE), Brier score.
  • vlm_eval/data/ — dataset loading and distribution-shift transforms.
  • vlm_eval/report/ — markdown/JSON leaderboard output.

CI runs entirely offline against MockVLMWrapper and synthetic fixture images — no real model downloads or GPU required. Running real VLMs against real datasets is a manual/local workflow (see models/clip_wrapper.py).

First real result: CLIP

ClipWrapper (vlm_eval/models/clip_wrapper.py) wraps open_clip's ViT-B-32-quickgelu / openai checkpoint and does standard zero-shot classification — cosine similarity between the image embedding and a "a photo of a {label}" text embedding per candidate label, softmaxed into a probability distribution. It ignores the free-form prompt argument (built for instruction-following models); CLIP compares an image against labels directly.

uv sync --extra clip --dev
uv run vlm-eval run --task calibration_shift --model clip
uv run vlm-eval run --task calibration_shift --model clip --shift noise

On the tiny synthetic fixture set (solid dark/light gray squares):

model shift accuracy ece brier_score
clip none 0.5000 0.4188 0.7756
clip blur 0.5000 0.4188 0.7756
clip noise 1.0000 0.3365 0.2786

Blur is a no-op on uniform-color squares, as expected. CLIP essentially guesses on "dark"/"light" gray squares — they're not natural photos, so "a photo of a dark" isn't a meaningful query — which is itself a useful data point: the harness surfaces a real, non-trivial calibration gap (50% accuracy, but a non-zero ECE means its confidence still doesn't track that chance-level correctness). A richer, more photographic fixture set would give a more representative result; this one mainly demonstrates the harness computing real metrics end-to-end against a real model, not a benchmark claim about CLIP itself.

Development

uv sync --all-extras --dev
uv run pytest tests/unit tests/integration
uv run ruff check .
uv run black --check .
uv run mypy vlm_eval/

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

vlm_eval-0.1.0.tar.gz (150.5 kB view details)

Uploaded Source

Built Distribution

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

vlm_eval-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: vlm_eval-0.1.0.tar.gz
  • Upload date:
  • Size: 150.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vlm_eval-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b6de4e7bb51b38ef73042deff4424220e1a0e6487c002d8ccb4db430d989264f
MD5 5ead360548d717ba3882a34c0df098d4
BLAKE2b-256 a95ddae6f35101f4b0089b892e77e8f56cac1deaa9d93ef9e7eee1635f7d5d1f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: vlm_eval-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for vlm_eval-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bcb82d7a0f6dc80c05c8005efed42b222abdb668457b2dd2ecffb587a5b09655
MD5 0f9759202356a1ed16e069b81b83602b
BLAKE2b-256 cf2987e978c340cc4adcdddc2d0fcc1fbeaf2189202c592b3142177600f66022

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