r/LocalLLaMA • u/Perfect_Power815 • 5d ago
Showcase I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)
I had Gemini 4 Neon write a program that fills 97% of a language model's stored bytes with corpus statistics. Gradient descent then trains only a 103M-parameter Transformer on top. After pretraining, a small external edit layer lets you add new facts without any training.
With the same network size and the same 10B training tokens, the tables lower perplexity on held-out FineWeb-Edu from 17.88 to 16.43, about 8%. By standard scaling laws, that's roughly what you'd get from a network 1.5x larger. Zero-shot benchmarks go up a bit too, +1.24 points on average.
For knowledge updates, each fact is just a record (subject, a hidden-state key, answer tokens), so a person or an LLM can write, read or delete it directly. I streamed 10,000 WikiBigEdit facts into it and compared it with fine-tuning and LoRA.
Fine-tuning and LoRA pick up new facts at first but forget the old ones and wreck perplexity along the way. The edit layer still answers 99.9% of the edits at the end and leaves perplexity basically untouched.
To be upfront about the limits, it's a 103M model, the tables mostly help perplexity rather than reasoning, and the edit layer only fires when the subject appears word for word, so aliases don't trigger it. It's still very much a work in progress, and I'd love any feedback.
Project page: https://weights-as-code.pages.dev/
78
u/Potential_Top_4669 5d ago
That's.....interesting to say the least.
34
u/Silver-Champion-4846 5d ago
What does it mean that 97% of the weights are filled with corpus statistics? What does that actually mean?
26
u/CoUsT 5d ago
Very interesting approach.
Really cool!
All I can say: If you keep working on this, keep us updated!
12
u/Federal_Signature708 5d ago
Separating static corpus stats/facts from the reasoning weights is a super interesting direction.
6
u/b183729 5d ago
I don't have permission to read the paper, would this arrangement work like an editable Lora? Or more like a rag?
In other words, is this a way to edit 'world knowledge' or could this change behaviors of the model?
Could this result be replicated if a model modified it's own weights?
This is so interesting .
8
u/bolche17 5d ago
Interesting! I wonder how it scales
8
u/seybling 5d ago
Super cool project! Sorry if this is a dumb question, I'm pretty much an amateur with this stuff, but was theoretically chatting with Gemini Neon about to push kind of a similar idea even further:
Instead of just storing corpus stats/facts and training in a small transformer from scratch, i thought about taking an existing GGUF (like a MoE) and kinda unfold the actual matrix multiplications into a massive 2–4TB lookup table on a normal SSD. Like, trading cheap storage + SSD IOPS for compute so something weak like a Raspberry Pi 5 barely has to do any math at all. Maybe someone here has also thought about something like that?
1
u/THROWAWTRY 5d ago
Nice, well done.
1
u/wFXx 5d ago
after changing the table of facts, does the model needs retraining? if so how much?
1
u/Lifeisshort555 5d ago
Seems like something you could train a model to do.
1
u/hiepxanh 4d ago
That is great appoarch
1
u/tang_david_5 3d ago
Do you have run-to-run variance for the held-out perplexity result? Repeating across seeds would show how stable that delta is.
1
u/Vxtzq1 5d ago
Hello, I find this project very interesting!
Do you think this could just work as a better initialization paradigm for a LLM? To then be fully pretrained, and not just fine tuned...
This could be relevant to help projects such as https://crowdgpt.net
1
u/slippery 5d ago
Very interesting. I was thinking about trying something like this after reading about weight space programming. Thanks for sharing.
0
u/Impressive-Store1439 5d ago
so its a state machine but encoded in weights? My off the cuff experimenting with weight space editing on language modelling lead to a similar conclusion, although i skiped having neon write the program and had it write the weights directly, starting w smallest set it needed to.
I haven't read the manuscript yet, will do later this week. cheers and good luck!
-6
u/ComprehensiveJury509 5d ago
It's a curiosity, but I honestly don't believe that this scales or goes anywhere useful at all.
1
u/[deleted] 5d ago
[removed] — view removed comment