{"slug": "i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes", "title": "I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)", "summary": "An independent researcher released wtable-lm, a language model in which an LLM-written compiler builds 97% of the model's stored weights as a 7.96 GiB bank of sparse tables from 31.8B tokens of corpus statistics with no gradient step, leaving gradient descent to train only a 103M-parameter network on top. Trained on 10B tokens on a single GPU, the table model reached a word-level perplexity of 46.4 on 2,000 held-out FineWeb-Edu documents versus 52.1 for a parameter-matched model without tables, and an external edit layer applied over 10,000 sequential WikiBigEdit edits answered 99.9% of edited questions and 97.4% of paraphrases at 12 ms per fact, while fine-tuning and LoRA recalled at most 36.3% of edits and pushed perplexity above 1,000. Code and results are posted at github.com/Kim-Ai-gpu/wtable-lm.", "body_md": "Independent Researcher\n\nAn LLM writes the program that fills **97% of a language model's stored weights** with corpus statistics, with no gradient step.\nGradient descent trains only a 103M-parameter network on top, and the model supports **continual knowledge updates without training**.\n\nAbstract\n\nWeight-space programming (WSP) is the idea that a frontier LLM can read and write the weights of a neural network directly,\n  without gradient descent. So far, however, WSP has been limited to small networks or to sparse edits of existing models, and it has\n  not been used to build a language model from scratch. We instead have an LLM write a compiler that builds the model's initial weights.\n  The compiler turns 31.8B tokens of corpus statistics into a 7.96 GiB bank of sparse tables, over 97% of the model's stored bytes,\n  without a single gradient step. Gradient descent then trains a 103M-parameter network on top of the frozen tables. After pretraining,\n  an external edit layer adds new facts without any training, enabling continual knowledge updates. Trained on 10B tokens on a single\n  GPU, the table model reaches a word-level perplexity of 46.4 on held-out FineWeb-Edu documents, 11% lower than a parameter-matched\n  model without tables (52.1), comparable under standard parameter scaling laws to making the network about 1.5 times larger, and\n  raises mean zero-shot accuracy on ten tasks by 1.2 points. Over 10,000 sequential WikiBigEdit edits, the edit layer answers 99.9% of\n  the edited questions and 97.4% of their paraphrases, leaves 98.2% of unrelated answers unchanged, and changes perplexity by only\n  0.003%, at 12 ms per fact with no gradient step. Fine-tuning and LoRA, by comparison, recall at most 36.3% of the edits and push\n  perplexity above 1,000. Code and results are available at\n  [github.com/Kim-Ai-gpu/wtable-lm](https://github.com/Kim-Ai-gpu/wtable-lm).\n\nHover over any bar or point for exact values.\n\nBoth models have the same backbone, about 103M trained parameters, and the same 10B training tokens. The only difference is the frozen tables.\n\nWord-level perplexity on 2,000 held-out FineWeb-Edu test documents, context 1,024. The 1.5× estimate uses the\n      parameter scaling law of Kaplan et al. (2020), loss ∝ N<sup>−0.076</sup>.\n\nKeep only the most frequent fraction F of table entries in the trained model, without retraining. Perplexity improves with every doubling and shows no sign of saturating.\n\nAccuracy of the table model minus the baseline on ten tasks. The largest gains come on tasks that reward common associations between words and events.\n\nlm-eval 0.4.13, zero-shot, length-normalized accuracy where available. Results on all 21 evaluated tasks are in the paper's appendix.\n\nWikiBigEdit facts are applied one batch after another and never undone. The edit layer stores each fact as a record and trains nothing. Weight editing keeps learning the new facts but forgets the old ones and damages the model.\n\nEM is SQuAD-normalized exact match (%). Loc keep is the share of unrelated questions whose answer did not change. Perplexity is word-level on 2,000 validation documents. Time is the editing cost per fact on one T4 GPU.\n\nWriting facts into the tables fails, because the last few tokens before an answer are almost always the same question template. The edit layer keeps facts outside the tables instead.\n\n1\n\nSubject tokens, a key (the hidden state where the answer should be given) and the answer tokens. One forward pass, about 12 ms, no gradient step.\n\n2\n\nThe subject must appear verbatim in the last 64 tokens (stored with and without a leading space, never inside a longer word), and the raw hidden state must match the key, cos(h<sub>t</sub>, k<sub>i</sub>) ≥ 0.93. No statistics of the prompt template are needed.\n\n3\n\nThe stored answer token is raised 1.5 above the current top logit, one token after another, until the answer ends.\n\nRecords are plain data, so a person or an LLM can write, inspect or delete them. A new edit for the same subject and relation replaces the old one.\n\nEvery channel answers in the same form, a short list of next-token candidates with scores, so the network only learns how much to trust each one at each position.\n\n| Group | Predicts the next token from | Channels | \n|---|---|---|\n| n-gram | the last 1 to 5 tokens | 5 | \n| Skip-gram | earlier tokens, with gaps | 3 | \n| Synonym | synonym clusters of recent tokens | 2 | \n| Concept | associations between concepts | 2 | \n| Rule | explicit phrase and fact rules | 2 | \n| In-context | the current document | 4 | \n\nThe first five groups are counted from 31.8B FineWeb-Edu tokens, disjoint from the network's training data. The compiler was designed by Gemini 4 Neon.\n\n```\n@article{202611.3172,\n\tdoi = {10.20944/preprints202611.3172.v1},\n\turl = {https://doi.org/10.20944/preprints202611.3172.v1},\n\tyear = 2026,\n\tmonth = {November},\n\tpublisher = {Preprints},\n\tauthor = {Youngseong Kim},\n\ttitle = {A Language Model Architecture Whose Initial Weights an LLM Can Write as Code},\n\tjournal = {Preprints}\n}\n```\n\n", "url": "https://wpnews.pro/news/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes", "canonical_source": "https://weights-as-code.pages.dev/", "published_at": "2026-11-30 13:00:19+00:00", "updated_at": "2026-11-30 13:42:51.728405+00:00", "lang": "en", "topics": ["large-language-models", "machine-learning", "ai-research", "artificial-intelligence"], "entities": ["wtable-lm", "FineWeb-Edu", "WikiBigEdit", "Kaplan et al. (2020)", "lm-eval 0.4.13", "LoRA", "github.com/Kim-Ai-gpu/wtable-lm"], "also_reported_by": [], "takeaway": "Freezing LLM-written sparse tables holding 97% of stored bytes and training only a 103M-parameter network on top cut word-level perplexity to 46.4 versus 52.1 for a parameter-matched baseline, and an external edit layer applied 10,000 WikiBigEdit facts at 12 ms each with 99.9% recall versus at most ", "recommendation": {"advice": "For frequent knowledge updates, store facts in an external edit layer keyed on hidden states (cosine ≥ 0.93) instead of fine-tuning weights; the source recalled 99.9% of 10,000 edits versus at most 36.3% for LoRA.", "playbook": "training-data", "playbook_url": "https://wpnews.pro/playbooks/training-data"}, "alternates": {"html": "https://wpnews.pro/news/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes", "markdown": "https://wpnews.pro/news/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes.md", "text": "https://wpnews.pro/news/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes.txt", "jsonld": "https://wpnews.pro/news/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes.jsonld"}}