Mechanistic interpretability study: executable replacement of all Qwen2.5-0.5B attention heads and MLPs

#22
by maxwelhelp - opened

Hello Qwen team and community,

I am Maxim Zhivotok, an independent researcher from Ukraine. I have released a fully reproducible mechanistic interpretability study based directly on Qwen2.5-0.5B-Instruct:

“Executable Matrix Programs: Faithful Weight-Derived Replacement and Factorized Intervention in Pretrained Transformers.”

The method derives executable component-level matrix programs directly from the pretrained weights and reinserts them into the model’s native forward pass, without retraining the model or training a separate replacement network.

Main replacement results:

  • all 336 attention heads replaced inside the native forward pass;
  • all 24 SwiGLU MLP sublayers replaced;
  • 0.258% median full-logit replacement discrepancy;
  • 0.566% p95 discrepancy;
  • 0.923% maximum discrepancy;
  • 100% top-1 preservation across 64 prompts.

The work also provides:

  • factorized QK routing and VO payload representations;
  • native SwiGLU gate/read/write decomposition;
  • factorized causal interventions;
  • machine-readable attention, MLP, intervention, and downstream propagation results.

Preprint:
https://doi.org/10.5281/zenodo.21312311

Code and complete results:
https://github.com/maxwelhelp/matrix-programs

ORCID:
https://orcid.org/0009-0005-7722-6811

I would appreciate technical feedback from the Qwen team and community, particularly on:

  1. validation on larger Qwen2.5 or newer Qwen architectures;
  2. additional Qwen-specific benchmarks or prompt sets;
  3. the interpretation of the QK routing and VO payload factors;
  4. possible integration with existing Qwen analysis tooling.

Separately, this is my first arXiv cs.LG submission, and I am currently blocked by the endorsement requirement. If an eligible cs.LG endorser considers the public manuscript appropriate for the category after a brief look, I would be grateful if they could contact me privately.

Sign up or log in to comment