Skip to main content

A benchmark for evaluating Sparse Autoencoders (SAEs) on Vision Transformers

Project description

VISAEBench

Tests PyPI

VISAEBench is a benchmark for evaluating Sparse Autoencoders (SAEs) trained on Vision Transformer (ViT) patch activations. It scores an SAE across four interpretability dimensions (reconstruction, concept detection, spatial coherence, disentanglement) using 7 metrics (M1 through M7). It supports cross-backbone evaluation across CLIP, DINOv2, SigLIP, MAE, and DeiT (all ViT-B/16 or ViT-B/14).

Installation

# From PyPI (after v0.1.0 release)
pip install visaebench

# From source (development)
git clone https://github.com/vraj130/visaebench && cd visaebench
pip install -e .

Quickstart

import visaebench
from visaebench.hub import load_sae

sae = load_sae("visaebench/clip-vitb16-saes", subfolder="batchtopk_16x_k128")
results = visaebench.evaluate(
    sae=sae,
    backbone_name="clip_vitb16",
    imagenet_path="/path/to/imagenet/val",  # or None to stream from HF
)
for r in results:
    print(f"{r.name:30s} {r.value:.4f}")

Available SAE checkpoints

One HuggingFace repo per backbone; each holds 12 configs as subfolders (batchtopk_{8x,16x,32x}_k{64,128,192,256}).

Backbone HuggingFace repo
CLIP ViT-B/16 visaebench/clip-vitb16-saes
DINOv2 ViT-B/14 visaebench/dinov2-vitb14-saes
SigLIP ViT-B/16 visaebench/siglip-vitb16-saes
MAE ViT-B/16 visaebench/mae-vitb16-saes
DeiT ViT-B/16 visaebench/deit-vitb16-saes

The detailed 12-config table (all batchtopk_{8x,16x,32x}_k{64,128,192,256} subfolders) lives in docs/quickstart.md.

Documentation

Metrics

# Registry key Dimension Description
M1 localization spatial_coherence Per-feature spatial coherence on patch grid
M2 fvu reconstruction Fraction of variance unexplained
M3 downstream_preservation reconstruction Linear probe accuracy after reconstruction vs raw
M4 sparse_probing concept_detection Sparse logistic probe AUC over class labels
M5 monosemanticity concept_detection Cross-model feature consistency
M6 cross_domain concept_detection Generalization to OOD datasets (EuroSAT, DTD)
M7 absorption disentanglement WordNet-hierarchy concept absorption rate

Citation

@inproceedings{visaebench2026,
  title     = {ViSAEBench: Cross-Backbone Evaluation of Vision Sparse Autoencoders Reveals Backbone-Dominated Variance and Metric Dissociations},
  author    = {TODO: maintainer to fill in author list},
  booktitle = {ICML 2026 Mechanistic Interpretability Workshop},
  year      = {2026}
}

License

Apache 2.0. See LICENSE.

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

visaebench-0.1.0.tar.gz (75.0 kB view details)

Uploaded Source

Built Distribution

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

visaebench-0.1.0-py3-none-any.whl (91.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for visaebench-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ffaa3ab6450f884bfc6c463eb1373371cd85acb872224324d93a417c01cb167b
MD5 a6d24af577c873a867bd1fa5fb18180c
BLAKE2b-256 80b3a29aa821055f82a3d649ac49aee3409ef66f55966111a53c76195a74dfcc

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on vraj130/visaebench

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

File details

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

File metadata

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

File hashes

Hashes for visaebench-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aaedfcd842f45f243625a3ba23e2983af9897e85bd7020c41557ad138ae76cea
MD5 12ddc604b1da07a67362382636cbb2f0
BLAKE2b-256 c399b5478540d0789504e0b02ecf26674bde4095664d2fe93b7aac9a2f1b1346

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on vraj130/visaebench

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