---
id: 18712
lang: en
title: "Gemini 4 wrote code for 97% of a language model's weights, and new facts go in within 12 ms"
published_at: "2026-11-30 14:37:04"
source_name: "Hacker News AI"
source_url: "https://weights-as-code.pages.dev/"
canonical_url: "https://news.hamidun.com/en/news/18712"
categories: ["llm", "research"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# Gemini 4 wrote code for 97% of a language model's weights, and new facts go in within 12 ms

> **Краткая суть (BLUF):** Gemini 4 wrote a compiler that turned statistics from 31.8 billion tokens of text into lookup tables, accounting for 97% of the model's bytes with no training step involved. Only a network of 103 million parameters was trained, and its perplexity (a measure of how "surprised" the model is by real text) dropped from 52.1 to 46.4, an 11% improvement. A separate layer adds a new fact, such as a recent API version, in 12 ms without fine-tuning. For knowledge that goes stale quickly, this is an alternative to fine-tuning.  • After 10,000 consecutive edits, the layer answers correctly on 99.9% of questions • Fine-tuning and LoRA recall no more than 36.3% of edits, with perplexity above 1000 • Unrelated answers stay intact: 98.2% are unchanged, and perplexity shifts by 0.003%

Imagine a language model running in your product, and yesterday a pricing tier changed or a new API version shipped. There are two familiar ways to get the model to learn this: fine-tune it (expensive, and it may forget what it already knew) or feed fresh data into the prompt via RAG (which bloats the context). Researcher Youngseong Kim, in a preprint, demonstrated a third option and, along the way, an unusual way to build the model itself: most of its weights were written not by gradient descent but by code composed by another LLM (called Gemini 4 Neon in the work).

## How an LLM assembled 97% of a model without training

Normally, weights come from billions of gradient descent steps on expensive GPUs. Here, the author asked a frontier LLM to write not a model but a compiler. The program went through 31.8 billion tokens of the FineWeb-Edu corpus and counted which words typically sit next to each other, which concepts are linked, and which phrases recur. The result is a bank of sparse tables totaling 7.96 GiB. That is more than 97% of all stored bytes in the model, and none of them passed through gradient descent.

There are eighteen such reference tables ("channels"). Each one answers the same way: with a short list of likely next tokens and their scores. On top of the frozen tables, a standard transformer with only 103 million parameters is trained. It reads the tables at every position in the text: through a dedicated block after the fourth layer and through gated mixing with the final logits. Its job is to learn which table to trust, and how much, at each point in the text.

Training ran on 10 billion tokens on a single GPU. Perplexity (a measure of how "surprised" the model is by real text; lower is better) on held-out FineWeb-Edu documents came to 46.4, versus 52.1 for the same network without the tables, an 11% improvement. By Kaplan's scaling laws, this is comparable to enlarging the network by roughly 1.5 times. Average accuracy across ten zero-shot tasks rose by only 1.2 points, most strongly where frequent associations between words and events help. If only the most frequent share of table entries is kept in the trained model, perplexity improves with each doubling of the tables, and the author sees no signs of saturation.

## The edit layer: a new fact in 12 ms

The second part of the work is more practical. Writing new facts directly into the tables did not work: the last tokens before an answer are almost always the same, the question template, and the statistics cannot tell facts apart. So facts live outside the tables, as ordinary data records. A record consists of subject tokens (for example, the name of a pricing tier), a key (the model's hidden state at the point where the answer should appear), and the answer tokens themselves. Adding a fact takes a single forward pass, about 12 ms per fact on a T4 GPU, with no gradient descent.

A record fires if the subject appears verbatim in the last 64 tokens and the hidden state matches the key (cosine similarity of at least 0.93). The correct answer token is then raised by 1.5 above the current leader, and this continues through the end of the answer. If a new edit arrives about the same subject and the same relation, it replaces the old one. Records can be read, checked, and deleted by hand, or the task can be handed to another LLM.

On 10,000 consecutive edits from WikiBigEdit, the layer answers correctly on 99.9% of the changed questions and on 97.4% of their paraphrases. Meanwhile, 98.2% of unrelated answers stay the same, and perplexity changes by 0.003%. In the same test, fine-tuning and LoRA recall no more than 36.3% of edits, and their perplexity rises above 1000: the model forgets what it knew and degrades.

## What this means in practice, and where the catch is

For developers, the takeaway is this: knowledge that changes often (prices, policies, library versions) is better kept in verifiable records alongside the model than baked in through gradients. This resembles RAG, but it operates at the level of hidden states and takes no space in the prompt.

There are many caveats. This is a single author's preprint, not peer-reviewed. The network has only 103 million parameters, and testing ran on one GPU and one corpus, not on models at the level of current LLMs. Benchmark gains are modest. The tables are heavy: 7.96 GiB against a tiny trainable part. The requirement that the subject appear verbatim in the last 64 tokens limits which facts can be edited. How the approach will behave on large models remains unknown.

Still, the technique is interesting: an LLM is writing neither text nor an application, but a tool that builds the foundation for another model. The author has published the code and results on GitHub in the wtable-lm repository, so the claims can be checked independently.

---
- **Первоисточник:** [Hacker News AI](https://weights-as-code.pages.dev/)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18712
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
