Can an AI write model weights by hand?
A neural network's "brain" is just a long list of numbers called weights. Usually a computer finds good numbers by practicing millions of times. A research paper came out recently where they used an intelligent model to update the weights of a second smaller model to improve its reasoning. I wanted to explore this. Can an AI just write the weights by thinking hard, with no practice at all? And can an AI read the weights and tell what a network was trained to do?
I tested this on a little flapping-bird game I made, called Gapwing. This article documents the experiment.
How each run ends
Every bird has exactly the same kind of architecture: 5 inputs (things the bird can sense, like its height and speed), two small layers of 8 neurons, and one output. If the output is above zero, the bird flaps. That's 129 weights (numbers) in total. The only difference between the birds is where those 129 numbers came from.
Each clip below is a real run on a course picked at random. You're watching the last few pipes of each run: either the crash (the bird turns red) or the finish line at 272 pipes. I picked these five out of 20 recorded runs so you can see both kinds of ending.





Three ways to get the weights
Picking the weights is the whole game. Random weights give a bird that crashes straight away. I tried three ways to get good numbers.
- Write it by hand. Claude reads the game's code, works out the physics, and writes the weights directly. It never sees the game run.
- Copy a teacher. I wrote a simple rule ("flap when you're below the gap"). The model watches it play and learns to imitate it.
- Survival of the fittest. Start with 64 models with random weights. Keep the 8 that fly furthest, copy them with small changes, and repeat.
How often does each model reach the finish?
Every course is 272 pipes long. I ran each model on the same 1,000 courses, none of which it had seen, and counted how many it finished without crashing.
The striped bar is the teacher rule the copycat learned from. It's a hand-written rule, not a model, and the copycat matches it almost exactly.
Two finalists, courses ten times longer
Two finalists finished nearly every course: Claude's careful model and the evolved one. So I raised the challenge and flew them on 200 new courses, each ten times longer (about 2,700 pipes).
Claude's careful model finished all 200 without a crash. The best evolved model crashed on 88 of them.
| Model | Courses with no crash | Average pipes | Worst course |
|---|---|---|---|
| Claude, careful (try 1) | 200 of 200 | 2,726 | 2,726 |
| Claude, careful (try 2) | 200 of 200 | 2,726 | 2,726 |
| Evolved (run 3) | 112 of 200 | 2,065 | 6 |
| Evolved (run 1) | 90 of 200 | 1,831 | 6 |
| Evolved (run 2) | 89 of 200 | 1,876 | 32 |
| Evolved from Claude's quick model | 31 of 200 | 1,161 | 18 |
| Claude, quick (try 3) | 19 of 200 | 1,005 | 5 |
| Copy a teacher | 0 of 200 | 492 | 3 |
| Teacher rule | 0 of 200 | 442 | 3 |
Doing the physics on paper
Claude received the game's source code, the network architecture and the scoring rule. Every weight started at zero. It had one reply, no tools, and no way to run the game.
It started from the physics. A flap always sets the same upward speed, and the bird can flap every step, so climbing to a higher gap is never the problem. Dropping to a much lower gap is: a flap just before leaving a pipe wastes time rising, and the bird can't fall far enough before the next one.
The fix is to control the timing of the last flap inside each pipe, based on the distance to the pipe. Claude encoded that rule in 22 weights.
I asked three times with the same prompt. Both attempts that reasoned for 12 to 14 minutes were perfect. The quick attempt (about 2.5 minutes) had the right physics but missed the timing rule. It used 4 weights and averaged 236 pipes.
"Big drops are the real danger. If the bird flaps just before leaving a pipe, it wastes about 15 steps rising. It then cannot fall 320 px in time. So the timing of the last flap is controlled." (Claude, before its weights were ever run)
| Try | Thinking time | Weights used | Average pipes |
|---|---|---|---|
| 1 | 13.6 min | 30 of 129 | 272 (perfect) |
| 2 | 11.8 min | 22 of 129 | 272 (perfect) |
| 3 | 2.7 min | 4 of 129 | 236 |
| Weight | Connects |
|---|---|
| 20 | input "how far below the gap" → layer-1 neuron 1 |
| -3.2 | bias of layer-1 neuron 1 |
| 5 | layer-1 neuron 1 → layer-2 neuron 1 |
| 1 | layer-2 neuron 1 → flap |
From hopeless to perfect in about 20 generations
Evolution knows nothing about the game. It keeps whatever flies furthest. Each generation has 64 models, each tested on 6 courses. The best 8 survive and are copied with small random changes to their weights.
By generation 20 the best model was reaching the end of the course. The whole run took about 38,000 practice games, a few seconds on a laptop.
I also tried starting evolution from Claude's quick model. At first it didn't help: that model already finished most of the 6 test courses, so evolution couldn't tell good from great. Testing each model on 24 courses fixed that and gave a small improvement.
Score = pipes passed plus a small bonus for each step survived; 292 is the maximum.
What is each model paying attention to?
To see what a model relies on, I replaced one input at a time with its average value and counted how often the flap decision changed. If nothing changes, the model ignores that input.
Claude's quick model uses one input: how far the bird is below the gap. The careful one adds the distance to the pipe. Evolution found something neither Claude nor the teacher used: it also watches the gap after the next one, so it can plan ahead.
| Model | height | speed | distance | below gap? | next gap |
|---|---|---|---|---|---|
| Claude, careful | · | · | 3.0% | 12.4% | · |
| Claude, quick | · | · | · | 9.6% | · |
| Copy a teacher | · | 6.0% | · | 4.7% | · |
| Evolved | 2.7% | 4.4% | 4.0% | 8.8% | 3.5% |
| Evolved from Claude's quick model | 0.3% | 1.2% | 0.2% | 9.0% | 0.3% |
Can an AI read a model's weights?
Next I flipped the question around. Instead of asking an AI to write weights, I gave it the weights of a model that was already trained and asked what the model does. It had no tools, so it had to work through thousands of numbers written out as plain text.
I tried three tests:
- Which game is it? These models are bigger, with 17,253 weights each, and each one learned to play a simple grid game. Four came from the research paper. I trained the other four myself, so no AI could have seen them before.
- Is there a backdoor? Two models that play a catching game. I secretly trained one of them to stop catching and always move left whenever one particular square lights up.
- What shape is it? Tiny models that say yes or no for every point on a square. The AI had to draw the area where the model says yes.
Claude got all 4 of the paper's games and 2 of mine, taking 1 to 3 minutes per answer. Kimi-K3 was a lot slower, 4 to 17 minutes per answer. It got only 2 of the paper's games, but 3 of mine, which was the best score on my models. Qwen3.8-27B often used up its whole thinking budget copying the numbers out and never got to an answer.
| Model from | Real game | Claude Opus 5.5 | Qwen3.8-27B | Kimi-K3 |
|---|---|---|---|---|
| the paper | Breakout | ✓ Breakout | no final answer | ✗ said Freeway |
| the paper | Pong | ✓ Pong | ✗ said Snake | ✓ Pong |
| the paper | Pac-Man | ✓ Pac-Man | no final answer | ✗ said Snake |
| the paper | Freeway | ✓ Freeway | ✓ Freeway | ✓ Freeway |
| me (new) | Catch | ✓ Catch | no final answer | ✓ Catch |
| me (new) | Breakout | ✗ said something else | ✗ said Pac-Man | ✗ said Snake |
| me (new) | Freeway | ✓ Freeway | no final answer | ✓ Freeway |
| me (new) | Snake | ✗ said something else | ✓ Snake | ✓ Snake |
| Model | Claude Opus 5.5 | Qwen3.8-27B | Kimi-K3 |
|---|---|---|---|
| normal model | ✓ said clean | no final answer | ✓ said clean |
| model with a backdoor | ✓ found it ✓ knew it moves left ≈ square slightly off | ✓ found it ✓ knew it moves left ≈ square slightly off | no final answer |
| Real shape | Claude Opus 5.5 | Qwen3.8-27B | Kimi-K3 |
|---|---|---|---|
disk | 100% match | no final answer | no final answer |
ring | 100% match | no final answer | no final answer |
xor | 83% match | no final answer | no final answer |
halfplane | 100% match | no final answer | 100% match |
band | 100% match | no final answer | 100% match |
L | 72% match | no final answer | no final answer |
What if it only gets the weights?
In every test so far, I told the AI what each input means ("this one is the bird's height"), or gave it the game's code. So I wanted to see what happens when it gets nothing but the weights.
I ran the same 8 "which game?" models again, this time with no description of the inputs or outputs. I also asked Claude to write a bird model twice more: once from a short description of the game, with no code and no physics numbers, and once with nothing at all beyond "5 inputs, 1 output, get a high score".
Reading still worked pretty well. With no description, Claude figured out that the 500 inputs were a 10×10 grid with 5 values for each square. It noticed that some weights had never moved from their small random starting values, which meant those inputs were never used in training. That pattern showed where the walls were and where things could appear. It named all 4 of the paper's games this way, but only 1 of mine. It called Catch "Breakout" and Snake "Pac-Man", which aren't far off.
Writing didn't work at all. With the game's code, Claude's model was perfect. With just a description, it got the physics wrong. It thought a flap was a gentle push, so it stopped the bird from flapping twice in a row, and that's exactly how the bird climbs in this game. It passed 0 and 3 pipes. With nothing at all, it guessed that "low" was a negative number, which is backwards here, so the bird flew straight into the ceiling both times. Claude also spent under a minute on each of these instead of 12, since there wasn't much to think through.
| Real game | With a description | Weights only |
|---|---|---|
| Breakout | ✓ Breakout | ✓ Breakout |
| Pong | ✓ Pong | ✓ Pong |
| Pac-Man | ✓ Pac-Man | ✓ Pac-Man |
| Freeway | ✓ Freeway | ✓ Freeway |
| Catch | ✓ Catch | ✗ said Breakout |
| Breakout | ✗ said something else | ✗ said something else |
| Freeway | ✓ Freeway | ✓ Freeway |
| Snake | ✗ said something else | ✗ said Pac-Man |
| Total | 6 of 8 | 5 of 8 |
| What Claude was given | Try 1 | Try 2 |
|---|---|---|
| The game's full code | 272 (perfect) | 272 (perfect) |
| A short description, no code | 0 | 3 |
| Nothing (just "5 inputs, 1 output") | 0 | 0 |
So can a strong AI work with just the weights?
Partly. An AI can learn a fair amount from the weights alone. Without being told anything, Claude worked out how a model's inputs were laid out and named 5 of the 8 games. But it was less sure of itself, and it did worse on models it hadn't seen before.
Writing is different. Claude's perfect bird came from understanding the game's physics, and the weights were just where it wrote that down. Without the rules of the game, it scored zero.
Weights are like a program with all the labels removed. A good AI can sometimes put the labels back, but it can't build something new without understanding the problem first. And for things that don't have a short rule, like recognizing a cat, training on lots of examples is still the only way.
What I'd tell you before you try this
- Giving Claude time to think made the biggest difference. The same question got a 4-weight model after 2.5 minutes and a perfect 22-weight model after 12.
- Evolution was easier than I expected, and more creative. About 40 lines of code went from random weights to almost perfect, and it found a way to plan ahead that I never wrote.
- A model that copies a teacher is only as good as that teacher. My first teacher rule averaged 39 pipes. When I changed two numbers in it, it reached 199, and the copying model improved along with it.
- Double-check anything an AI tells you about where something is. Claude found the backdoor and knew exactly what it did, but pointed at a square one row away from the real one. Qwen picked the right square but the wrong input.
- Weights that never change are a clue. Parts of a model that aren't used in training keep their random starting values, and that's how Claude worked out the grid without being told.
- To write a model, the AI needed the exact rules, not just the goal. Knowing it was a flapping-bird game wasn't enough.
- Even a small model can take forever to read. One open model ran out of budget on a 337-weight model because it tried to do every calculation by hand.
- Make sure "no tools" really means no tools. Turning off Claude Code's tools with one setting still left some connected tools that could run code, and I had to switch those off separately.
How I ran it
Everything ran on a laptop. The game, imitation and evolution are in JavaScript (Node). The "which game?" models were trained in Python. Open models ran through Hugging Face (Qwen3.8-27B and Kimi-K3). Claude (Opus 5.5) ran through Claude Code in headless mode with every tool switched off, and each run was checked to be a single reply with no tool calls.
Changes from the research paper: my "which game?" models learned by imitating an expert rather than by reinforcement learning, and the prompt says so. Everything else in that prompt is the paper's own text. I found and fixed one scoring bug before publishing.
All the code, prompts, trained models and every AI answer are on GitHub: github.com/saranyan/gapwing-weight-lab. It's built on the paper, Sparks of Weight-Space Programming, and the logs its authors published at github.com/RikiyaT/lm_understand-logs, and it started from Simon Willison's write-up.
Full results table
| Method | Details | Runs | Mean pipes | Reached the end | Practice games |
|---|---|---|---|---|---|
| Random weights | Gaussian init, no training | 1 | 0.0 | 0% | 0 |
| Claude by hand, long think | zero init, one reply, no tools; ~12-14 min, ~72k output tokens | 2 | 272.0 | 100% | 0 |
| Claude by hand, quick | same prompt; 2.7 min, ~15k output tokens | 1 | 235.9 | 74% | 0 |
| Imitation of a scripted teacher | DAgger, 105k labelled states | 1 | 203.1 | 56% | 0 |
| Evolution from random | GA, pop 64, 100 generations, 6 games per score | 3 | 262.8 | 93% | 38,400 |
| Evolution from Claude's quick weights | GA, pop 64, 30 generations, 24 games per score, sigma 0.1 | 3 | 242.6 | 79% | 46,080 |
| Evolution from Claude's quick weights (first try) | 6 games per score, sigma 0.3: fitness saturated | 3 | 234.4 | 74% | 11,520 |
| Teacher rule | hand-written rule, not a model | 1 | 201.1 | 55% | – |
Comments
Loading comments…