r/computervision • u/GenJeppo • 17d ago
Discussion Codex built a handwritten digit recognizer without training it. It scored 95.1% using fixed weights and hand-written rules. Not sure how impressive this is?
I recently read that LLMs can write neural-network weights directly, and I wanted to see what that meant in practice. So I gave Codex (GPT6-Astra-Medium) a challenge : recognize the digits 0–9 as I drew them with my mouse on a 32×32 grid. One condition: no training.
Codex wrote formulas for pen strokes and varied their slant, curvature, and thickness. It even simulated what happens when a coarse scan makes a narrow gap disappear. Each synthetic drawing was converted into a weight vector, and a dot product measured how closely my digit matched it.
The recognizer ended up combining fixed weights with hand-written geometry.
The first version scored 66.4%. The final version got 1,709 of 1,797 digits correct (95.10%). The recognition code, including weight generation, came to 808 lines of Python, about 35.6 kB. No optimizer or backpropagation was used.
One caveat: the benchmark was scikit-learn’s 8×8 handwritten digits, resized to 32×32 and converted to black and white. We looked at mistakes on those same drawings as we refined the rules, so 95.1% is a development score. This took about 2h to do. Codex wrote the code and ran the evaluations. I set the challenge and tried it with my own handwriting. To me this is super impressive, what do you experts think?
40
u/Wannabe-Davinci 17d ago
I guess the weights of lots of MNIST models are in the training set. If not, the weights would be fully explainable, as the model can predict them.
Try giving it an architecture that does not exist anywhere on the entire internet. Curious how it would perform
76
u/DigitalMonsoon 17d ago
So this is fairly impressive but I wouldn't say completely unexpected for current models. That being said I don't think I would have ever thought to try it.
This is a very common model with probably tens of thousands of different examples in repos so it is well represented in the training data for LLMs.
Cool result and and interesting thing to try.
15
u/TheRealBobbyJones 17d ago
Granted most people probably don't use neural networks but digit recognition is a common computer vision assignment in college. I've done it. Someone probably could write one by hand with no machine learning that performs pretty decently. Maybe not record breaking scores but high enough to be noteworthy. With machine learning but no neural networks probably could end up over 90%
19
u/Infamous-Bed-7535 17d ago
'how impressive this is?'
Not at all.
I would be happy to explain, but this was a long day.
Please check a few facts.
'One condition: no training.' -> 'We looked at mistakes on those same drawings as we refined the rules'No swimming. -> We jumped into the water and started moving our hands.
Some questions.
How does your rule adjustment comparable of the ' LLMs can write neural-network weights directly'.
Based on the description you are doing some kind of template matching whose 'weights' has nothing to do with a neural network.
The original article was not even about writing weights from scratch, just edited existing ones to avoid fatal loops that greatly improved the model's score. (not read the article, but something similar).
Your whole description sounds like a mess and misses the basics of machine learning, data engineering, etc..
4
u/nicman24 17d ago
95 is kinda bad tbf
2
u/Lethandralis 17d ago
How are you sure that some kind of training (not necessarily backprop) is not applied here?
1
u/AlbertV999 17d ago
Could you try it over another datasets?
1
u/Cold-Conflict6047 16d ago
I tried the same for barcode scanning. The result was the currently best open source barcode scanner: tapirscan.
I think if you have a nice test set for the ai to optimize for, it will work very good. So get a bigger, better test set and you will reach perfect scores. Also I noticed that stronger AI models are able to optimize even further. So Opus 5.5 will find improvements when Astra stops finding any. And Fable 5.2 find improvements once Opus stalls.
1
u/traderemi 17d ago
Have it thought of using RAG + vector stores for that purpose? That wouldn't imply any ad-hoc formula, just examples of images for each class and similarity computing.
1
u/madeInSwamp 17d ago
I think for this simple examples build a neural network can be easy since LLMs have probably seen tons of them during training.
Even modifying the weights of a larger NN can be possible if we ask to solve a specific task. However if that NN was solving a bunch of other problems (i.e. the NN is a LLM itself), well I think the generalisation is not reliable anymore.
1
u/DadAndDominant 17d ago
One caveat you say, hmm?
1
u/dev-rsonx 15d ago
This is impressive to me. Early neural nets were hand-crafted too, before backpropagation came. If AI can genuinely figure out the weights to produce good features for a given task without hours of multi-epoch training, that would change how we build deep models.
1
u/SmileLonely5470 13d ago
Honestly I feel like with such a constrained problem you could probably just write a script without any NN to detect digits and get a decent score, just using a buncha heuristics with weights tweaked by hand. When I first started programming that was the approach I did but for an identity resolution kind of problem (take Spotify track data and resolve the matching Youtube video for the song based on yt vid metadata).
Although I guess if u tweak the weights by hand that's technically an optimization step 🤔.
1
u/Some_Anonim_Coder 12d ago
From https://github.com/Anyidoho/MNIST-DIGIT-RECOGNITION
Link to [2] is broken, unfortunately, but as we can see 5% of error is achievable with classical ML approaches like KNN and SVM, so your performance results are not that awesome. On the other hand, getting this results with manually selected weights is an interesting thing. I wonder if it's just overfitting to test, as you've admitted to using test set in training, and I'd love to see what are actual test results(with a new test set model didn't see)
0
u/Axelwickm 17d ago
In my book that's very cool. I think 'hand' programmed ai models are kinda up and coming