ByteDance-Seed/SAE-interprets-MoE
Python
Captured source
source ↗ByteDance-Seed/SAE-interprets-MoE
Language: Python
License: Apache-2.0
Stars: 1
Forks: 1
Open issues: 0
Created: 2026-11-05T10:06:17Z
Pushed: 2026-11-06T07:03:36Z
Default branch: main
Fork: no
Archived: no
README:
Sparse AutoEncoders Reveal That MoE Experts Exhibit Human-Interpretable Fine-Grained Specialization
Code and data to reproduce the experiments of the paper on Qwen3-30B-A3B (layers 4, 30 and 46).
The activation of an SAE latent on the output of an MoE block decomposes exactly over the activated experts, because the SAE encoder is affine. Averaging the resulting contribution fractions over a corpus and thresholding them gives a bipartite *dominance graph* between experts and latents, and auto-interpreting the latents an expert dominates describes what the expert does.
Links: Project page · SAE weights · Paper
Layout
common/ shared helpers: paths, SAE loading, explanation files, LLM client contribution/ the contribution statistics every experiment starts from (Section 3) experiments/ rank_profile/ Section 4.1, Figure 2 dominance_graph/ Section 4.2, appendix "Degree distributions of the dominance graph" dominance_overlap/ Section 4.3, Table 1, appendix "Pairwise overlap of dominant sets" wordclouds/ Section 5.1, Figures 3 and 4, appendix word clouds of all experts theme_check/ Section 5.2, Table 2 expert_domains/ Section 5.3, Figure 5, appendix "Expert labels and domains" data/ released explanations, labels, domains and theme judgements docs/ the project page, served by GitHub Pages (see "Project page" below)
Every experiment directory has a run.sh that reproduces its results with the settings of the paper, and every script documents its inputs, outputs and options in its docstring. All commands below are run from this directory; results go to outputs/.
Setup
pip install -r requirements.txt
The contribution statistics need the per-expert ModuleList of Qwen3MoeSparseMoeBlock, hence transformers", "explanation": ..., "confidence": ...}. The file lists the exact sample, including latents whose explanation is Uninterpretable or null; the scripts skip those. experiments/wordclouds/sample_latents.py draws a fresh sample the same way.
- Labels and domains. Outputs of
label_experts.pyandgroup_experts.pyused in the paper. - Theme judgements.
e{expert}_{theme}.jsonjudges every interpretable explanation of the
expert, and e{expert}_{theme}_random.json judges 2000 explanations drawn from all other experts with seed 0. In the random files, entries from experts other than the four above keep the latent id, expert and judgement but not the explanation text. Two random runs hold 1999 judgements because one request failed.
Project page
docs/ holds the static project page, including the interactive explorer of all 128 experts of layer 30. It is a prebuilt site that needs no build step: on GitHub, enable *Settings → Pages → Deploy from a branch → main / /docs*, and the page is served at . Page assets are produced inside the project and copied into docs/static/; to change the page, edit docs/index.html and docs/static/ and push.
Citation
@misc{zhuo2026saeinterpretsmoesparse,
title={SAE Interprets MoE: Sparse AutoEncoders Reveal That MoE Experts Exhibit Human-Interpretable Fine-Grained Specialization},
author={Anyuan Zhuo and Shaohua Zhang and Yuan Lin and Pinyan Lu},
year={2026},
eprint={2611.08089},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2611.08089},
}License
The code in this repository is released under the [Apache License 2.0](LICENSE).
Third-party models, data and services used by this work keep their own terms:
- Qwen3-30B-A3B (`Qwen/Qwen3-30B-A3B`), the model
under study, is released by the Qwen team under the Apache License 2.0.
- Validation data. The statistics are computed on data drawn from the Olmo 3 training corpus
released by Ai2: Dolma 3, Dolci-Think-SFT and Dolci-Instruct-SFT, all made available under the ODC Attribution License (ODC-BY) v1.0 and intended for research and educational use under Ai2's Responsible Use Guidelines. The released data contains information derived from these datasets. This repository does not redistribute the corpus itself.
- GPT-5.5. The latent explanations, expert labels, domains and theme judgements in
data/layer30
were generated by OpenAI's GPT-5.5 and are machine-generated, not human-written. Their use is subject to the OpenAI Terms of Use.