← Back to blog

Can an AI write model weights by hand?

Saranyan38 min read
AINeural NetworksInterpretabilityExperimentsClaude

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.

Random numbers
Random numbers bird, crashing after 0 pipes
Crashed before the first pipe
Copy a teacher
Copy a teacher bird, crashing after 135 pipes
Crashed after 135 pipes
Claude, quick
Claude, quick bird, crashing after 244 pipes
Crashed after 244 pipes
Evolved
Evolved bird, reaching the finish at 272 pipes
Finished all 272 pipes
Claude, careful
Claude, careful bird, reaching the finish at 272 pipes
Finished all 272 pipes

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.

Random weights
0 of 1,000
Copy a teacher
555 of 1,000
The teacher rule itself
549 of 1,000
Claude, quick
743 of 1,000
Evolved
949 of 1,000
Claude, careful
1,000 of 1,000

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.

200 new courses, about 2,700 pipes each
ModelCourses with no crashAverage pipesWorst course
Claude, careful (try 1)200 of 2002,7262,726
Claude, careful (try 2)200 of 2002,7262,726
Evolved (run 3)112 of 2002,0656
Evolved (run 1)90 of 2001,8316
Evolved (run 2)89 of 2001,87632
Evolved from Claude's quick model31 of 2001,16118
Claude, quick (try 3)19 of 2001,0055
Copy a teacher0 of 2004923
Teacher rule0 of 2004423

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)

Same question, asked three times
TryThinking timeWeights usedAverage pipes
113.6 min30 of 129272 (perfect)
211.8 min22 of 129272 (perfect)
32.7 min4 of 129236
The quick model, complete. The other 125 weights are zero.
WeightConnects
20input "how far below the gap" → layer-1 neuron 1
-3.2bias of layer-1 neuron 1
5layer-1 neuron 1 → layer-2 neuron 1
1layer-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.

050100150200250292generation 02040608099
best model, starting from random weights (3 runs)best model, starting from Claude's quick model (3 runs)average model
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.

How often the flap decision changes when one input is replaced by its average. A dot means the model ignores that input.
Modelheightspeeddistancebelow gap?next gap
Claude, careful··3.0%12.4%·
Claude, quick···9.6%·
Copy a teacher·6.0%·4.7%·
Evolved2.7%4.4%4.0%8.8%3.5%
Evolved from Claude's quick model0.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.

Which game is it? (The research paper's own model got 4 of 4 on the paper's models.)
Model fromReal gameClaude Opus 5.5Qwen3.8-27BKimi-K3
the paperBreakout✓ Breakoutno final answer✗ said Freeway
the paperPong✓ Pong✗ said Snake✓ Pong
the paperPac-Man✓ Pac-Manno final answer✗ said Snake
the paperFreeway✓ Freeway✓ Freeway✓ Freeway
me (new)Catch✓ Catchno final answer✓ Catch
me (new)Breakout✗ said something else✗ said Pac-Man✗ said Snake
me (new)Freeway✓ Freewayno final answer✓ Freeway
me (new)Snake✗ said something else✓ Snake✓ Snake
Is there a backdoor? The real trigger is one square at row 4, column 7. When it lights up, the model always moves left.
ModelClaude Opus 5.5Qwen3.8-27BKimi-K3
normal model✓ said cleanno 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 offno final answer
Real shapeClaude Opus 5.5Qwen3.8-27BKimi-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 shape is it? The real answer in green, each AI's drawing in black.

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.

Reading: Claude with and without being told what the inputs mean
Real gameWith a descriptionWeights 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
Total6 of 85 of 8
Writing: Claude's bird model, average pipes (272 is perfect)
What Claude was givenTry 1Try 2
The game's full code272 (perfect)272 (perfect)
A short description, no code03
Nothing (just "5 inputs, 1 output")00

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
Full results on 1,000 courses no model had seen
MethodDetailsRunsMean pipesReached the endPractice games
Random weightsGaussian init, no training10.00%0
Claude by hand, long thinkzero init, one reply, no tools; ~12-14 min, ~72k output tokens2272.0100%0
Claude by hand, quicksame prompt; 2.7 min, ~15k output tokens1235.974%0
Imitation of a scripted teacherDAgger, 105k labelled states1203.156%0
Evolution from randomGA, pop 64, 100 generations, 6 games per score3262.893%38,400
Evolution from Claude's quick weightsGA, pop 64, 30 generations, 24 games per score, sigma 0.13242.679%46,080
Evolution from Claude's quick weights (first try)6 games per score, sigma 0.3: fitness saturated3234.474%11,520
Teacher rulehand-written rule, not a model1201.155%–

Share this post

Comments

Loading comments…

Leave a comment

© 2026 Saranyan Vigraham