OpenSAESAEBase

Build with SAEBase.

Python tools and an HTTP API for research workflows.

Start locally

git clone --branch v0.5.0 https://github.com/OpenSAE/SAEBase.git
cd SAEBase
python -m pip install -e ".[analysis]"
python examples/interventions/pythia_feature_edit.py

Read the API

Start the Research Lab backend, then browse models and results.

python -m pip install -r apps/research-lab/requirements.txt
cd apps/research-lab
uvicorn backend.api:app --host 127.0.0.1 --port 8000
curl http://127.0.0.1:8000/api/health
curl 'http://127.0.0.1:8000/api/sites?limit=5'
curl http://127.0.0.1:8000/api/explore/traces
curl http://127.0.0.1:8000/api/docs
Connect the Workspace ↗

Explore features

Capture feature activations locally with a supported model and SAE.

from saebase.api import load_registered, capture_features
bundle = load_registered(model_key="pythia70m", sae_key="pythia70m_resid_sm", layer=3, device="cpu")
tokens = bundle.model.tokens(prompt="Alice Emma Alice")
snapshot = capture_features(bundle.model, bundle.sae, site=bundle.site, tokens=tokens)
print(snapshot.codes.shape)

See the Python API reference ↗ for setup and additional examples.

Intervene

The public API validates edits; actual compute uses the private worker.

curl -X POST http://127.0.0.1:8000/api/jobs/preflight \
 -H 'Content-Type: application/json' \
 -d '{"site_id":"YOUR_VERIFIED_SITE","text":"Example prompt", "operation":"ablate", "feature_ids":[1819], "strength":1, "max_new_tokens":0}'

Operator-only execution: POST /api/private/inputs, then POST /api/private/jobs, then GET /api/private/jobs/{job_id}/result. Requires a configured GPU worker and operator token.

Generate

Compare baseline and edited continuations using the Workspace examples. For local model-backed generation, see the Python API and examples ↗.

Evaluate

JAXTYPING_DISABLE=1 python scripts/m3_native_saebench_smoke.py

Train

Train a compatible SAE locally, then load its saved checkpoint to explore reconstruction and feature behavior. See the Python examples for setup.

Interpret

Review proposed feature explanations against activating and non-activating examples. Interpretations should be evaluated before publication.