TransformerLensOrg / TransformerLens

A library for mechanistic interpretability of GPT-style language models
https://transformerlensorg.github.io/TransformerLens/
MIT License
1.43k stars 274 forks source link

[Proposal] Add support for Mamba #462

Open joker3212 opened 9 months ago

joker3212 commented 9 months ago

Proposal

Mamba shows "best-in-class on every single evaluation result, and generally matches baselines at twice the model size." It won't be long before we see more language models in the wild with the Mamba architecture.

Screenshot 2023-12-09 at 10 40 58

Paper: https://arxiv.org/ftp/arxiv/papers/2312/2312.00752.pdf Code: https://github.com/state-spaces/mamba

joker3212 commented 9 months ago

If there is support for the proposal, I would like to work on the implementation.

ArthurConmy commented 9 months ago

I'm excited for people to work on adding new architectures to TransformerLens! :)

However, your figure is not the most important figure in that paper. None of the models use the "Transformer++" Swiglu+Parallel Attention+GroupedQuery+overtraining that Llama and Mistral use -- when comparing to Transformer++, Mamba is not a clear winner. But it may be better!

image

joker3212 commented 9 months ago

Ahh good catch. Thanks for pointing that out. As the adoption picks up, I'd be interested to see the evaluation metrics compared to Transformer++ based architectures.

In the meantime I'll get started on adding Mamba and should have a PR out soon.

SeuperHakkerJa commented 9 months ago

I could also help, would love to do some cool mech interp things on state space models!

joker3212 commented 9 months ago

I could also help, would love to do some cool mech interp things on state space models!

That would be awesome! I started some work here. Feel free to take a look and let me know what you think.