Puppet-166M
Puppet is a Language Model (LM) that I've been working on for the past few months. It combines Mamba with an experimental Stepped Weight Generation architecture.
Model definition:
main.py
Pretrained weights:
Puppet-166M.pth
Due to compute limitations, I was only able to train the model for ~3.5 billion tokens. While this follows the Chinchilla rule where is the parameter count), it's still a small fraction of the dataset size used to train models such as GPT-2 Small or Pythia-160M.
While I may resume pre-training in the future, Puppet-166M currently achieves an acc_norm score of % on HellaSwag.
Architecture
I originally started Puppet as an experiment, aiming to train a functioning Language Model using Weight Generation, without relying on Attention.
Base Idea
The idea behind this architecture is to generate transformations specific to the current latent vector, rather than relying on a fixed set of weights. Several existing architectures currently achieve this, typically by selecting between multiple pre-existing sets of parameters. Puppet instead generates a unique weight matrix and bias vector using the latent as the input. This approach is known as Weight Generation.
Despite the benefits, full Weight Generation is rarely used in modern LLMs, largely due to its substantial parameter cost. To generate a weight matrix for a latent of dimensions, a matrix is needed, taking parameters for that layer alone (plus for the bias). This rapidly increasing parameter count limits the number of context-mixing modules that can be feasibly included in the model.
Previous Models
My previous iteration of Puppet used this full Weight Generation approach, exposing some of its practical limitations. Training suffered from a stalled validation loss of approximately nats, and I noticed weak context retention during evaluation.
Puppet-166M
To solve these issues, I staggered Weight Generation in Puppet-166M. Each Block contains multiple Bundle classes, each containing, in order: a Mamba2 module, Weight Generator, and shuffle matrix.
The Weight Generator only generates a fraction of the full weight matrix, controlled by matrix_div . The latent vector is split into sections, each multiplied by a corresponding matrix generated by the Weight Generator. The latent is then reconstructed and multiplied by the shuffle matrix.
This is equivalent to multiplying the latent by a matrix containing dense blocks along its diagonal. The shuffle matrix allows information from different sections of the latent to interact with every other section across sequential transforms, fixing the main flaw of smaller independent dense blocks.
By staggering Weight Generation, the parameter cost is distributed across multiple smaller generators, allowing me to interleave more context-mixing Mamba2 modules between the sequential transforms, whilst still retaining a fully generated matrix transformation.
Training
I trained Puppet-166M for approximately 3.5 billion tokens over the course of a month (intermittently), from random initialisation to a validation loss of nats and a HellaSwag score of %.
Training was highly inefficient, as this was my first converged model. I varied the effective batch size several times before settling on tokens for the majority of the run. For the learning rate, I kept it at for the majority of the run before lowering it linearly at the end (WSD schedule). The optimiser I used was AdamW with betas of .
One of the main flaws during training was likely the dataset choice. I used several shards from the section of FineWeb, leading to temporal bias which a distribution sampled from multiple years (or the 10B subset of FineWeb) would have reduced. The dataset consisted of around billion tokens, of which only ~ billion were seen by the model (sampled randomly).
Training lasted optimiser steps
Benchmarks
Puppet-166M achieves a HellaSwag score of %. Despite its larger parameter count, it still falls behind similarly sized models like Pythia-160M and GPT-2 Small. Here is a comparison of how Puppet-166M performs against these mainstream models, along with their parameter counts and training tokens.
| Model | HellaSwag | PIQA | WinoGrande | Arc Easy | Parameters | Training Tokens |
|---|---|---|---|---|---|---|
Puppet-166M |
% | % | % | % | ||
Pythia-160M |
% | % | % | % | ||
GPT-2 Small |
% | % | % | % |
Accuracy shown as
acc_normwhere available, otherwiseacc
Final Thoughts
Puppet-166M was an experiment to test whether an unconventional architecture (Weight Generation + Mamba2) could compete with, or even outperform, similarly sized models. Despite falling behind smaller models in multiple benchmarks, Puppet-166M remained within percentage points of the mainstream models in some tests, with the largest difference being percentage points in Arc Easy. For my first converged (and my largest trained) model, I would not consider this a failure.
I may continue training in the future, or develop a revised variant. Were I to retrain, these would be the main issues I would address:
- Use a more evenly distributed FineWeb sample rather than shards from a single year
- Train for much longer β at least ~ billion tokens
- Use a consistent WSD training schedule
- Improve context mixing, either through more Mamba layers or an adapted variant
Licence
This project is licensed under the MIT License
