Downloads · 30 days
6
21% of all-time downloads
Butanium/simple-stories-2L16H256D-attention-only-toy-transformer
simple-stories-2L16H256D-attention-only-toy-transformer is a machine learning model from Butanium. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is a simplified transformer model with 2 attention layer(s) and 16 attention head(s), hidden size 256, designed for studying attention mechanisms in isolation.
Downloads · 30 days
6
21% of all-time downloads
All-time downloads
28
Public
Parameters
3M
12.1 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors12.1 MB · 100%
From the Hugging Face model README
This is a simplified transformer model with 2 attention layer(s) and 16 attention head(s), hidden size 256, designed for studying attention mechanisms in isolation.
Removed Components:
Kept Components:
This minimal architecture isolates the attention mechanism, making it useful for mechanistic interpretability research as described in A Mathematical Framework for Transformer Circuits.
config_class = LlamaConfig
def __init__(self, config: LlamaConfig):
super().__init__(config)
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size)
self.layers = nn.ModuleList([AttentionLayer(config) for _ in range(config.num_hidden_layers)])
self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
model = AttentionOnlyTransformer.from_pretrained('Butanium/simple-stories-2L16H256D-attention-only-toy-transformer')
The model is trained on the SimpleStories dataset for next-token prediction.