A new preprint describes a language model whose starting weights were written as code by another LLM. The approach, called weight-space programming, has the LLM write a compiler that fills more than 97% of the model’s stored bytes with corpus statistics, using no gradient step. Gradient descent only trains a small 103M-parameter network layered over those tables.
The author is Youngseong Kim, an independent researcher, and Gemini 4 Neon designed the compiler.
What was built
The concept behind weight-space programming is that a leading LLM can inspect and set a neural network’s weights itself. Until now it has been limited to small networks or sparse edits of existing models. This work uses it to build a language model from scratch.
From 31.8B tokens of FineWeb-Edu text, the compiler counts statistics and emits sparse tables totaling 7.96 GiB. These frozen tables hold over 97% of the model’s stored bytes. The 103M-parameter network learns on top of them and trains to combine their suggestions, since every channel hands back a few candidate next tokens, each with a score.
The table bank is sparse, so most of the model’s bytes are lookup data and not learned parameters. The tables supply broad word statistics, and the small trained network learns how much to trust each one at each position.
Results
With 10B training tokens and one GPU, the table model scores 46.4 word-level perplexity on 2,000 held-out FineWeb-Edu documents. A parameter-matched model without tables scores 52.1, so the tables give 11% lower perplexity. Under standard scaling laws, roughly what a network 1.5 times bigger would buy. Mean zero-shot accuracy across ten tasks rises by 1.2 points.
Tasks that depend on common word and event associations improve most. The author also kept only the most frequent slice of table entries after training, without retraining, and perplexity got better each time that slice doubled, with no sign of leveling off.
Editing facts without training
Once pretraining ends, a separate edit layer can insert new facts without any training. It saves each one as a record holding the subject, a key taken from the hidden state at the point where the answer belongs, and the answer tokens. A single forward pass, about 12 ms per fact, writes it.
A record fires only when the subject appears word for word within the last 64 tokens and the model’s hidden state matches the key with cosine similarity of at least 0.93. The stored answer token is then pushed 1.5 above the current top logit, one token at a time, until the answer is complete. Because records are simple data, either a person or an LLM can write, read or remove them, and a later edit on the same subject and relation overwrites the earlier one.
- Over 10,000 sequential WikiBigEdit edits, the layer gets 99.9% of the edited questions right, plus 97.4% of rephrased versions.
- Unrelated answers stay the same 98.2% of the time, and perplexity moves by just 0.003%.
- Fine-tuning and LoRA remember no more than 36.3% of the edits, and perplexity climbs past 1,000.
Putting facts into the tables didn’t work, the author found, since the tokens right before an answer nearly always repeat one question template. So the facts live in the edit layer instead.
The comparison methods include weight editing, which keeps learning the new facts but forgets the old ones and damages the model. The editing cost of 12 ms per fact was measured on a single T4 GPU, and the facts were applied in batches one after another and never undone.
Caveats and next steps
This is a preprint, so it hasn’t been peer reviewed. The model is small, at 103M trained parameters, and the tests use a limited set of benchmarks. The appendix covers all 21 evaluated tasks, and the code sits in the Kim-Ai-gpu/wtable-lm repository on GitHub.
The open question is whether the approach holds at larger sizes. If it does, updating a model’s knowledge could become a data operation rather than a training run.
Source: weights-as-code.pages.dev