Codex 编写可读的手写数字识别器
AI 总结
一名社区实验者让 Codex 为鼠标绘制的 32×32 网格输入编写数字识别器,方案采用固定权重和手写几何规则,而非优化器。最终生成的 808 行 Python 程序在经过缩放和预处理的 scikit-learn 手写数字样本上识别出 1,797 个中的 1,709 个,准确率为 95.10%。但实验者根据同一批标注样本的错例修改了规则,因此该结果属于开发集成绩,并非独立验证。
深度见解
该实验表明 Codex 能生成内容完整且便于阅读的代码项目,但由于规则修订与评测使用同一批样本,95.10% 的准确率不能被视为通用性能证明。
I’d read that LLMs can write neural-network weights directly, and I wanted to see what that meant in practice. So I asked Codex to build a recognizer for digits I could draw with my mouse on a 32×32 grid. It could design the weights and write rules, but it couldn’t use an optimizer or use benchmark drawings as templates.
Codex started with pen strokes. It wrote formulas for different ways of drawing each digit, varied their slant and thickness, and simulated what happens when a coarse scan makes a small gap disappear. Each synthetic drawing became a detector: a numerical vector that scores how closely a new drawing matches it.
The final recognizer combines fixed detector weights and hand-written geometry.
The first version scored 66.4%. The final one got 1,709 of 1,797 correct (95.10%) on scikit-learn’s handwritten digits, resized from 8×8 to 32×32 and converted to black and white. The recognition code, including weight generation, is 808 lines of Python, about 35.6 kB.
We inspected labeled mistakes and revised the rules on those same 1,797 drawings, so 95.1% is a development score. What I wanted to find out was whether Codex could turn a visible difference between two digits into a detector I could read and understand.
I set the challenge and tried it with my own handwriting. Codex wrote the code and ran the evaluations. You can try it yourself with uv run draw_shapes.py.
https://github.com/jesper-adolfsson-001/digits-by-hand submitted by /u/GenJeppo
[link] [comments] |