<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang" -->

---
title: I built an LLM where Gemini 4 wrote the initial weights...
description: An LLM can write a compiler that fills over 97% of a language model's stored weights with corpus statistics, with no gradient step. The compiler turns 31.8B...
canonical: https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes) | daily.dev
og:description: An LLM can write a compiler that fills over 97% of a language model's stored weights with corpus statistics, with no gradient step. The compiler turns 31.8B...
og:url: https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang
og:image: https://api.daily.dev/og/posts/qExylWanG.png
og:image:alt: I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)

**[Hacker News](https://daily.dev/sources/hn)** · 5 min read · 1 upvotes · 0 comments

## Summary

An LLM can write a compiler that fills over 97% of a language model's stored weights with corpus statistics, with no gradient step. The compiler turns 31.8B tokens into a 7.96 GiB bank of frozen sparse tables, and a 103M-parameter network trains on top. Perplexity on held-out FineWeb-Edu documents is 46.4, 11% lower than a same-size model without tables (52.1). An external edit layer adds new facts without training. Over 10,000 sequential edits it answers 99.9% of edited questions at 12 ms per fact, while fine-tuning and LoRA recall at most 36.3%.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://weights-as-code.pages.dev/>

## Questions this post answers

### How can I add new facts to a language model without fine-tuning or LoRA?

One approach is an external edit layer that stores each fact as a plain record: subject tokens, a hidden-state key and answer tokens. It needs one forward pass (about 12 ms per fact) and no gradient step. Over 10,000 sequential edits it answered 99.9% of edited questions and kept 98.2% of unrelated answers unchanged, while fine-tuning recalled at most 36.3%.

_Developers tracking LLM editing and continual learning techniques follow this research on daily.dev._

### Can precomputed n-gram statistics improve a small transformer language model's perplexity?

Yes. A 103M-parameter network trained on 10B tokens on top of frozen tables built from 31.8B corpus tokens reached word-level perplexity 46.4 on FineWeb-Edu, versus 52.1 for a parameter-matched model without tables. That 11% drop is comparable under standard scaling laws to making the network about 1.5 times larger.

_Anyone weighing architecture tricks against scaling up models can follow this debate on daily.dev._

## Community take

How the wider developer community reacted, aggregated from 1 discussion and 52 comments across hackernews (as of 2026-11-30).

**TL;DR:** Much of the discussion drifted into an unrelated and contested debate about whether frontier models like Claude deliberately sabotage advanced research, with the retraction of that claim also getting attention; on the actual topic, several technical commenters questioned how novel or scalable the approach really is.

**Sentiment:** 10% positive · 30% mixed · 60% skeptical

**The case for**

- Some found the code-as-data/weight-space-programming framing elegant and saw promise in continual knowledge updates without retraining.
- One commenter drew a parallel to Gödel Machines and hypernetworks, suggesting the timing may now be right for this kind of self-improving approach.

**The pushback**

- Several argued this is essentially a rebranded form of feature engineering or novel initialization dressed up as something more groundbreaking.
- One commenter expects the perplexity gain from the frozen tables to shrink or disappear at larger model sizes.
- Another pointed out the comparison ignores the large non-trainable memory footprint (8GB of tables) needed at inference alongside the small trainable model.
- A reviewer of the README noted the 'continual knowledge update' edits only fire on verbatim subject matches and fail on reverse or multi-hop questions, disputing that framing.
- Some called the title misleading, as it could be read to imply the LLM wrote weight values directly rather than designing a compiler that generates them.

**By community**

- hackernews (heated): The thread is dominated by a contentious tangent about alleged AI-lab sabotage of ML research (including a disputed/retracted viral claim), while the more substantive technical comments on the actual post are mixed-to-skeptical about its novelty and scalability.

**Hottest debate:** Whether frontier AI models intentionally sabotage users' advanced ML/research work, a claim some call confirmed and others call debunked misinformation.

**Open questions**

- How much compute/time does the compiler stage take compared to standard training?
- Would the perplexity improvement from the frozen tables hold up at larger model scales?
- Can the edit layer be extended to handle aliases, reverse questions, or multi-hop reasoning rather than only verbatim subject matches?

**Highlights**

> I don't see how this relates to WSP. The agent wrote a program to extract statistics and trained a model on top of it. Besides, the comparison at same number of trainable parameters forgets the many non-trainable parameters. Equal memory/disk space would be more appropriate.
> — [benob on hackernews · 2 comments](https://news.ycombinator.com/item?id=50700419)

> From the website: > the model supports continual knowledge updates without training. From the README: > Limitations. The layer fires only when the subject appears verbatim, so aliases are missed. Answers are emitted verbatim. Reverse ("who coaches X" → "which team does Y coach") and multi-hop questions are not answered from an edit. This method produces verbatim fact answer overrides: the answer is output when the subject appears verbatim. This isn't information the model can use, such as in reverse or multi-hop questions. I disagree with calling it "continual knowledge updates."
> — [13rac1 on hackernews](https://news.ycombinator.com/item?id=50700774)

> I don't think you get anything useful if you stitch a bunch of disparate, unrelated flakes of brain tissue together.
> — [jdiff on hackernews · 2 comments](https://news.ycombinator.com/item?id=50699865)

> At inference, you need 8GB of table data in addition to the ~103 million parameter model. The paper essentially claims that for the same training compute you get perplexity like a network about 1.5x larger, but you have to use 8 GB of memory at inference time.
> — [djoldman on hackernews](https://news.ycombinator.com/item?id=50700612)

**Source threads**

- [hackernews](https://news.ycombinator.com/item?id=50699217) · 169 points · 52 comments

## Similar posts on daily.dev

- [Build and Train a 25M Parameter LLM From Scratch on Your CPU](https://daily.dev/posts/build-and-train-a-25m-parameter-llm-from-scratch-on-your-cpu-hpb2ytmzl) · freeCodeCamp · 223 upvotes · 12 comments
- [My Understanding of How Large Language Models \(LLMs\) Work](https://daily.dev/posts/my-understanding-of-how-large-language-models-llms-work-z72lhwpn6) · RUBYLAND · 0 upvotes · 0 comments
- [28.9M-parameter LLM runs locally on ESP32-S3 at 9 tokens/s](https://daily.dev/posts/28-9m-parameter-llm-runs-locally-on-esp32-s3-at-9-tokens-s-xmajabusu) · CNX Software · 0 upvotes · 0 comments
- [Your Data Model Is the Semantic Layer](https://daily.dev/posts/your-data-model-is-the-semantic-layer-ro8bktzht) · MotherDuck · 0 upvotes · 0 comments

---

Tags: [#machine-learning](https://daily.dev/tags/machine-learning), [#llm](https://daily.dev/tags/llm), [#nlp](https://daily.dev/tags/nlp)

[View this post on daily.dev](https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)","url":"https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang"},"datePublished":"2026-11-30T13:58:57.413Z","dateModified":"2026-11-30T15:29:54.952Z","description":"An LLM can write a compiler that fills over 97% of a language model's stored weights with corpus statistics, with no gradient step. The compiler turns 31.8B...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fe7955735d852efb8308fe81e20a0e4e?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fe7955735d852efb8308fe81e20a0e4e?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Hacker News","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Hacker News","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/hn","url":"https://daily.dev/sources/hn"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"machine-learning,llm,nlp","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Hacker News","item":"https://daily.dev/sources/hn"},{"@type":"ListItem","position":3,"name":"I built an LLM where Gemini 4 wrote the initial weights as code (97% of bytes)"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-built-an-llm-where-gemini-4-wrote-the-initial-weights-as-code-97-of-bytes--qexylwang#faq","mainEntity":[{"@type":"Question","name":"How can I add new facts to a language model without fine-tuning or LoRA?","acceptedAnswer":{"@type":"Answer","text":"One approach is an external edit layer that stores each fact as a plain record: subject tokens, a hidden-state key and answer tokens. It needs one forward pass (about 12 ms per fact) and no gradient step. Over 10,000 sequential edits it answered 99.9% of edited questions and kept 98.2% of unrelated answers unchanged, while fine-tuning recalled at most 36.3%. Developers tracking LLM editing and continual learning techniques follow this research on daily.dev."}},{"@type":"Question","name":"Can precomputed n-gram statistics improve a small transformer language model's perplexity?","acceptedAnswer":{"@type":"Answer","text":"Yes. A 103M-parameter network trained on 10B tokens on top of frozen tables built from 31.8B corpus tokens reached word-level perplexity 46.4 on FineWeb-Edu, versus 52.1 for a parameter-matched model without tables. That 11% drop is comparable under standard scaling laws to making the network about 1.5 times larger. Anyone weighing architecture tricks against scaling up models can follow this debate on daily.dev."}}]}
```

