Sparse Autoencoder Superposition Engine (At1uri/sparse-autoencoder-superposition-engine)

A research-grade Overcomplete Top-K Sparse Autoencoder (SAE) for Mechanistic Interpretability and Superposition Disentanglement (Bricken et al., Anthropic 2023; Gao et al., OpenAI 2024). Maps dense polysemantic bottleneck activations $\mathbf{h} \in \mathbb{R}^{32}$ into a $4\times$ overcomplete sparse monosemantic dictionary $\mathbf{z} \in \mathbb{R}^{128}$ while enforcing exact $L_0 \le K$ sparsity and unit-norm decoder atoms.

Mathematical Architecture

Neural networks store $M \gg d$ sparse concepts inside $d$-dimensional bottlenecks via near-orthogonal Equiangular Tight Frame (ETF) geometry. The Top-K Sparse Autoencoder disentangles these superposed activations:

z=TopK ⁣(ReLU ⁣(Wenc(h−bdec)+benc), K)\mathbf{z} = \text{TopK}\!\left( \text{ReLU}\!\left( \mathbf{W}_{\text{enc}} (\mathbf{h} - \mathbf{b}_{\text{dec}}) + \mathbf{b}_{\text{enc}} \right), \, K \right) h^=WdecTz+bdec,s.t. ∥Wdec,j∥2≡1\hat{\mathbf{h}} = \mathbf{W}_{\text{dec}}^T \mathbf{z} + \mathbf{b}_{\text{dec}}, \quad \text{s.t. } \|\mathbf{W}_{\text{dec}, j}\|_2 \equiv 1


Model Specifications & Verified Metrics

Parameter Value
Bottleneck Dimension ($d_{\text{model}}$) 32
Overcomplete Latents ($n_{\text{latents}}$) 128 ($4\times$ Expansion Factor)
Top-$K$ Sparsity Limit K = 2
Weights Format model.safetensors
Decoder Unit-Norm Error 2.17e-08
Mean $L_0$ Active Latents 1.87 ($\max L_0 = 2$)
Activation Reconstruction MSE 3.85e-03 ($R^2 = 0.9249$)
Mean Max Cosine Similarity (MMCS) 0.9976

Quickstart & Usage

import numpy as np
from sae_model import SparseAutoencoder

# Load pretrained Top-K Sparse Autoencoder
sae = SparseAutoencoder.from_pretrained(".")

# Create a superposed activation from 2 ground-truth features
F_true = sae.weights["ground_truth_features"]
h = 1.15 * F_true[10] + 0.85 * F_true[42]

# Disentangle into sparse monosemantic latents
h_hat, z = sae.forward(h)
active_indices = np.where(z > 1e-6)[0]
print("Recovered Monosemantic Latent Indices:", active_indices.tolist())
print("Latent Magnitudes:", z[active_indices].round(3).tolist())

Developed by Ramprasad Atluri (At1uri).

Downloads last month
-
Safetensors
Model size
12.4k params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using At1uri/sparse-autoencoder-superposition-engine 1

Collection including At1uri/sparse-autoencoder-superposition-engine

Evaluation results

  • Mean Max Cosine Similarity (MMCS) on At1uri/superposition-monosemantic-benchmarks
    self-reported
    0.998
  • Explained Variance (R²) on At1uri/superposition-monosemantic-benchmarks
    self-reported
    0.925
  • Mean L0 Active Latents on At1uri/superposition-monosemantic-benchmarks
    self-reported
    1.870