Vizuara logoVizuara AI LabsThe Weight Space / Reviewed

Neural Network Writing

We asked an AI to write a neural network by hand, with no data and no training. Sometimes it beat 10 million examples. Sometimes it was worth 12.

A number that checks itself

When you type a long number into a form, one wrong key can send a payment or a parcel to the wrong place. So many long numbers carry a small safety feature. The last digit is not new information. It is worked out from all the other digits. Change any digit, or swap two digits next to each other, and the check fails. The computer knows something is wrong without looking anything up.

This is called a checksum. We used a well-known one called Verhoeff, published in 1969 and still used in real ID numbers, including India's Aadhaar.

It works like a small board game. You start at position 0. You read the digits one at a time, from right to left, and a lookup table tells you where each digit moves you. If you finish back at 0, the number is valid. Here it is on a made-up number, 1234 5678 9010.

Step123456789101112
Digit read010987654321
New position050709343990

You finished at 0, so the number is valid. Try it yourself below. Press a digit to change it and watch the check fail.

What we asked the AI to do

We gave three Claude models this rule and its lookup tables, and we asked each one to write a neural network that does the same job.

There was one catch. Normally nobody writes the numbers inside a neural network. You show it millions of examples and it adjusts them slowly, which is called training. We asked the AI to write every number by hand. It got no examples, and it was not allowed to run its network even once to see if it worked.

To be clear, the AI did not discover the rule. We gave it the rule. What it had to work out was how to build that rule from neural network parts.

The network it wrote

Opus saw that the rule is a small machine with 10 positions, and it built that machine directly. One group of units remembers the current position. The next group asks a simple question: am I at this position, and is the next digit this one? There are 100 of those units, one for each pair, and exactly one of them switches on. The last group turns that into the next position. This block repeats for each digit.

The network Opus wrote
the number12 digits, 120 inputsposition10 unitsjoin130100 AND unitsone per pair10 OR outputsnext positionnext digit: repeat, 11 blocks in allreadout2 logitsAND units: exactly one switches on, for the current position and the next digit.OR outputs: that one unit decides the next position.Readout: valid if you finish at position 0.24 linear layers, 11 ReLU layers, 156,442 weights, 4,420 nonzero.
Drawn from the network's own specification.

Of its 156,442 numbers, only 4,420 are not zero. And because it is so tidy, you can read the rule straight back out of it. Below is one block of the real weights, written as a table. It is the lookup table for that step, and our build script checks that this holds for all 11 blocks.

The rule, read back out of the weights
0123456789
08916043527
19527104638
25638210749
36749321805
47805432916
52194567083
63250678194
74361789250
80472895361
91083956472
Row: current position. Column: next digit. Each entry is the next position. These are real weights, and each colour is one position.

All three models found a machine like this, though they built it in different ways. Every network scored 100% on 100,000 numbers it had never seen.

ModelTriesLinear layersReLU layersWeightsNonzero weightsSealed accuracy
Fable512 to 2511 to 12170,962 to 513,2624,533 to 13,720100%
Opus52411156,4424,412 to 4,420100%
Sonnet56 to 353 to 1247,922 to 250,0324,101 to 12,530100%

Here is the network from the figure on our made-up number.

NumberWhat it isThe network says
1234 5678 9010The correct numbervalid
1234 5778 9010One digit changedinvalid
1234 5687 9010Two neighbours swappedinvalid
1234 5678 9013Wrong last digitinvalid

Then we tried to train one

This is the part we like most. We took the same design, filled it with random numbers, and trained it the normal way. We also trained two standard networks of similar size. We showed them up to 10 million labelled examples, half valid and half invalid.

Twelve digits: training stays at a coin toss
0%20%40%60%80%100%101,000100,00010Mlabelled examples used for trainingNormal training, same designPlain MLPGRUThe network the AI wrote (100.0%)0%20%40%60%80%100%101,000100,00010Mlabelled examples used for trainingNormal training, same designPlain MLPGRUThe network the AI wrote (100.0%)
Half the test numbers are valid and half are not, so 50% is what guessing gets. The two extra lines are standard networks of similar size, trained on up to 10 million examples.
Table view
NTraining accuracy %
1050.0
10050.0
1,00050.0
10,00050.0
100,00050.0
1,000,00050.0
10,000,00050.0

After 10 million examples, training was still at 50%. That is a coin toss. The written network, with no examples at all, was exactly right.

100%
Written by AI, with no examples and no training
50.1%
Trained, with 10 million examples
2.8%
Of the written network's numbers are not zero

One limit, to be fair: our training was not unlimited, and a longer run might do better. A longer test we ran was still at 49.9%. So we can say that our training did not learn this rule. We cannot say that no training ever could.

So what is a written network worth?

This gave us a simple way to measure it. Take a network the AI wrote with no data. Then count how many labelled examples normal training needs to become just as good. That count is what the written network is worth.

We tried this on three more jobs, and the answer changed enormously.

The taskScore of the AI-written networkNormal training catches up after
Name the clothing item in a small photo47.7%12 examples
Read a handwritten digit60.2%25 examples
Say which of 50 languages a sentence is in92.7%437 examples
Verify a 12-digit Verhoeff checksum100%not after 10 million examples
Where training catches the written network
Clothing: about 120%50%100%1050Digits: about 250%50%100%1050Languages: about 4370%50%100%1001,00010,000Checksum: never crossed0%50%100%101,000100,00010M
Purple: normal training, as it sees more examples. Magenta: the written network. Training catches up where the lines cross. On the checksum they never cross. Each panel shows one typical network, so its crossing can differ a little from the table, which gives the middle value across 15 networks.

Clothing items: worth about 12 examples

The job is to look at a tiny photo and name the item: a shirt, a shoe, a bag. Nobody can write that down as a rule.

So the AI did something charming. It drew a rough picture of each item from memory, and it scored a new photo by how well the photo matched each picture. Those drawings are the network. Here they are, exactly as they sit in the weights.

The AI drew these from memory. They are the real weights of the network.
Ten small silhouettes of clothing classes: T-shirt, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, boot.
From a typical network, by Sonnet, with a score of 47.7%. In order: T-shirt, trouser, pullover, dress, coat, sandal, shirt, sneaker, bag, ankle boot. The model never saw a picture.
The first test image of each class, and what the network said
The first test image of each of ten classes.
True classT-shirtTrouserPulloverDressCoatSandalShirtSneakerBagBoot
Network saidT-shirtTrouserShirtDressTrouserSandalShirtSneakerBagSneaker
Images chosen by position in the test set, not by outcome.
Where it goes wrong
T-shirtT-shirt5633TrouserTrouser936PulloverPullover203834DressDress5638CoatCoat1762055SandalSandal503612ShirtShirt141991637SneakerSneaker98BagBag17986752BootBoot3266
Each row is the true item, each column what the network said, in percent.

It scored 47.7%, well above the 10% you would get by guessing. But normal training catches up after about 12 examples. Trousers and sneakers have distinctive shapes, so it gets those right. Many coats, pullovers and shirts look like the same filled block, and they end up called bags.

Handwritten digits: worth about 25 examples

The same idea again. The AI drew each digit from memory, and the network looks for the closest match. Here are its drawings, as they sit in the weights.

The digits 0 to 9, as the AI drew them. Again, these are the real weights.
Ten small grey templates of the digits 0 to 9.
From a typical network, by Fable, with a score of 60.2%. The model described each digit as strokes from memory.
The first test image of each class, and what the network said
The first test image of each of ten classes.
True class0123456789
Network said0125940789
Images chosen by position in the test set, not by outcome.
Where it goes wrong
0083131180162211748711763386611644105272655206302856620863778808881477714371199132157
Each row is the true digit, each column what the network said, in percent.

It scored 60.2%, which is worth about 25 examples. The best of the 15 networks, by Opus, reached 84.7% by looking for strokes at different angles first.

The best network starts by looking for strokes at six angles
Six oriented line filters, each 7 by 7.
By Opus, the best of 15, with a score of 84.7%. Red is positive and blue is negative. It then compares the strokes it finds to digit shapes it wrote by hand.

So for images, writing by hand buys you a few dozen examples, or about a hundred at the very best. Someone could label that many in a few minutes.

Fifty languages: worth about 437 examples

The job is to read a paragraph and say which of 50 languages it is in. Here the AI did very well, with 92.7%, where guessing would give 2%.

How? For each language, it wrote out about 150 to 250 words from memory, counted which letter patterns came up, and stored those counts in a single table. That one table is the whole network.

The language families are visible in the weights
GermanicRomanceSlavic W.Other LatinCyrillicGreekPerso-ArabicHebrewDevanagariOther IndicDravidianSinhalaCJK
From a typical network, by Sonnet. Each square compares two languages, and darker means their weights look more alike. Languages are sorted by family. There was no training, so these blocks come only from what the model wrote from memory.

Normal training needs about 437 examples to match it. The mistakes are mostly between close relatives, such as Malay and Indonesian. Konkani is the exception, and we did not look into why.

Hardest languagesAccuracyMost often taken for
Konkani41.2%Swedish
Malay42.8%Indonesian
Indonesian74.8%Malay
Maithili75.6%Nepali
Danish83.4%Norwegian
Bengali87.6%English

What about the legal citations network?

A lot of this excitement began with Jacob Lauritzen's network, which told real legal citations from fake ones. By his own numbers, the version Fable wrote with no labels scored 97.8%, while a trained network with 8,192 labels scored 94.6%. We did not rerun this, so those are his numbers.

It fits the same pattern. Legal citations follow written rules: which law reports exist, which courts they cover, and which volumes belong to which years. A related project, CiteNet, builds its network from exactly such a list.

There is a limit too. CiteNet's own page says it only reads the text of a citation, so a fake that copies a valid format will pass. It can tell you that a citation could exist, and it cannot tell you that it does.

What we conclude

If you can say the rule in words, an AI can write it into a network. A checksum is pure rule. Languages and legal citations are close to rules, because the AI remembers which words belong to which language and which law reports exist. There, a written network can be worth thousands of examples or more.

But how do you know that a scribble is a 7? You cannot really say. So there, a written network is worth only a few dozen examples.

Two things to keep in mind. We gave the AI the checksum rule, so this shows it can translate a rule and does not show it can discover one. And "no data" means none during the session. These models learned from a lot of text long before this.

For researchers: the mathematics, full numbers and caveats

The exact rule

Validity is a function \(f : \{0,\dots,9\}^{12} \to \{\text{valid},\text{invalid}\}\). With \(c_0 = 0\), \(c_{i+1} = d(c_i, p^{\,i \bmod 8}(s_{11-i}))\), and \(f\) is valid exactly when \(c_{12} = 0\). Here \(d\) is multiplication in the dihedral group \(D_5\), and \(p\) is a fixed permutation of the digits.

d(a, b): row a, column b. The shading shows the two cosets: 0 to 4 are rotations, 5 to 9 reflections. Note that d(1, 5) = 6 and d(5, 1) = 9, so the table is not symmetric.
0123456789
00123456789
11234067895
22340178956
33401289567
44012395678
55987604321
66598710432
77659821043
88765932104
99876543210
pi(x): row i, column x. One permutation applied i times. It has order 8, which is why the rule uses i mod 8.
0123456789
p00123456789
p11576283094
p25803796142
p38916043527
p49453126870
p54286573901
p62793806415
p77046913258

The network, and why it is exact

With one-hot state \(h\) and input \(x \in \{0,1\}^{120}\): \(u_{c,d} = \mathrm{ReLU}(h_c + x_{\mathrm{pos},d} - 1)\) and \(h'_k = \sum u_{c,d}\) over pairs with \(d(c,p^i(d)) = k\). The sum inside the ReLU is 2 for exactly one pair and at most 1 for the rest, so \(h'\) is again one-hot. By induction, the network computes \(f\) exactly. The model wrote this argument in its notes before anyone ran the network.

The worth of a network

For accuracy \(A\), \(N^* = \min\{N : G(N) \ge A\}\), where \(G(N)\) is mean test accuracy of gradient descent on the same architecture from random weights with \(N\) labelled examples.

The clothing and language networks

Clothing: Bernoulli naive Bayes, \(\mathrm{score}_c(m) = \sum_i m_i \log\frac{p_{c,i}}{1-p_{c,i}} + \sum_i \log(1-p_{c,i})\). Languages: multinomial naive Bayes on hashed n-grams, \(\mathrm{score}_c(x) = \sum_i x_i \log p_c(i)\).

The last digit of the numbers we used carries no information of its own. It is a checksum, computed with an algorithm that the Dutch mathematician Jacobus Verhoeff published in 1969, built on the symmetries of a pentagon. It catches every mistyped digit and every swap of two neighbouring digits, which are the mistakes people make most.

We gave three Claude models the rule and its two tables and asked each for a neural network that checks such a digit on 12-digit strings. They were allowed no data and no forward pass, so a model could not run its network even once. The strings we tested on are random and synthetic, never real identifiers. All 20 networks scored 100% on 100,000 sealed strings, and a separate agent found no errors on 180,000 fresh and adversarial ones. The median budget-0 network has 4,520 nonzero weights.

We tried to train the same thing. An MLP with 226,434 parameters reached 50.10% after 10 million fresh examples, and a GRU reached 50.01%. Chance is 50%.

The same rule on shorter numbers

The networks above work on 12 digits. As a check that our training pipeline works at all, we ran the same rule on made-up shorter numbers of 3, 4, 5, 6 and 8 digits. "3 digits" below means the Verhoeff rule on a 3-digit number, which has only 1,000 possible inputs.

Verhoeff on shorter numbers: training fits them largely by covering the input space, then falls away
40%60%80%100%1,00010,000100,0001M10Mtraining examples100%3 digits100%4 digits100%5 digits85.6%6 digits50.1%8 digits3 digits4 digits5 digits6 digits8 digits40%60%80%100%1,00010,000100,0001M10Mtraining examples100%3 digits100%4 digits100%5 digits85.6%6 digits50.1%8 digits3 digits4 digits5 digits6 digits8 digits
Reference MLP, mean of 5 seeds, the same pipeline as the 12-digit runs. Chance is 50%. These are accuracies on all test strings, many of which are in the training set at short lengths. Above 100,000 examples these are single online passes with few steps, so the right end is undertrained.
Table view
LengthNMean accuracy
3 digits1,00092.1%
3 digits10,000100.0%
3 digits100,000100.0%
3 digits1,000,000100.0%
3 digits10,000,000100.0%
4 digits1,00054.3%
4 digits10,00098.2%
4 digits100,000100.0%
4 digits1,000,000100.0%
4 digits10,000,000100.0%
5 digits1,00050.0%
5 digits10,00061.3%
5 digits100,00098.0%
5 digits1,000,00095.4%
5 digits10,000,000100.0%
6 digits1,00050.0%
6 digits10,00050.1%
6 digits100,00062.6%
6 digits1,000,00050.0%
6 digits10,000,00085.6%
8 digits1,00050.0%
8 digits10,00050.1%
8 digits100,00050.1%
8 digits1,000,00050.1%
8 digits10,000,00050.1%

That contrast is the reason we built a unit for this. Everyone who saw a hand-written network last week asked whether it was impressive. A better question is what it is worth, and worth can be measured. For a network with sealed-test accuracy A, we define its data equivalent N* as the number of labelled examples gradient descent needs, on the same architecture from random weights, to reach A. We searched learning rates and schedules on a validation split for every N, over 10 seeds.

12
labels: median N* on Fashion-MNIST, accuracy 47.7%
25
labels: median N* on MNIST, accuracy 60.2%
437
labels: median N* on WiLI, 50 languages, accuracy 92.7%
>10M
labels: median N* on Verhoeff, accuracy 100%

We ran 80 writers, in fresh contexts, in random order: Fable, Opus and Sonnet at budget 0, and Fable again with 10 peeks at a dev set. 77 ran. A judge re-executed each build script in a sandbox with no network, and every weight file came back byte-identical. Every network beat 5 copies of itself with the weights permuted, which all scored at chance.

Three kinds of knowing

The range tells you what a hand-written network actually is. On images, where nobody can write the rule down, the median network is worth about as much as a couple of dozen labels. The best of 15 on MNIST, an Opus network built from an orientation map and nearest templates, scored 84.7%. A convolutional network with augmentation, given one example per class, reaches about 47%. So writing vision by hand is possible, and it is worth very little.

Six filters from that network, written with no data
Six small grayscale convolution filters showing oriented bars, written by hand by Opus
Writer w014, Opus, best of 15 at budget 0. These are weights the model typed out. It never saw a digit or ran the network.

On language identification the models know something that can be written down. The notes we read describe a naive Bayes table recalled from memory and hashed through the feature map, and the median reached 92.7% over 50 languages, including 18 South Asian ones. That is worth about 437 labels, which is a real number of examples for someone to collect.

On the checksum, the models were handed the rule, so this measures compilation, not recall. Our Verhoeff/WiLI ratio of medians is at least 22,905, and that is a lower bound that depends on where we stopped training. Strictly, our ordering of the two only needs Verhoeff above about 43,700.

Where to be careful

Our training runs on Verhoeff were not generous. One online pass at batch size 1024 gives 9,667 steps at N = 10 million, so "above 10 million" means within those steps. A separate agent probed further on CPU with one seed at batch 128, and an MLP on 12 digits was still at 49.9% after 78,000 steps and a GRU at 50.1% after 27,500. The pipeline does fit short strings, but largely by covering the input space: at length 4 with 10,000 examples, 74% of test strings are already in the training set, and balanced accuracy on unseen strings is only 55%. At length 5 with 100,000 examples it is 81%. The cost of each extra digit up to length 5 matches the growth of the input space, so that slope does not extrapolate to 12 digits. We can say that this pipeline did not learn 12 digits. We cannot say that 12 digits are unlearnable, or put a limit on N*.

The same-architecture number also mixes two things. Three of the best MNIST networks, at 75.6% to 84.7%, train to only about 50% to 55% on their own architecture at N = 2,000, because they contain long chains of narrow layers that suit a hand design and not gradient descent. Against a fixed reference CNN they are worth 36 to 108 labels. That gap surprised us, and for perception the reference number is the fairer rate.

Class count explains part of the ordering. Per class, WiLI over MNIST is not significant on the same architecture (Holm p = 0.116). And "zero data" means none in the session. These models were trained on text that surely describes MNIST and Wikipedia in many languages, so N* measures what transfers, not how it got there.

Two more results are worth a sentence each. Hand-written networks were not more robust than matched trained ones on MNIST-C (mean difference 0.020, 95% CI -0.011 to 0.052), which we had guessed they would be. And the weights are a good place to begin training: on WiLI at 50 examples, starting from written weights gives 91.6% against 70.7% from random, though the advantage is gone by 1,000.

The practical reading is narrow but real. If your task has a rule you can state, an agent can compile it into a network that training may never find, and you need no data at all. If your task is perception, you are buying a couple of dozen labels. Both of those seem worth knowing before you pay for either.

★★★½☆We give networks written by hand three and a half stars.