PenGPT: A Generative Transformer for Handwriting and Sketches greydanus.github.i...
HN Best 200 @best
PenGPT: A Generative Transformer for Handwriting and Sketches greydanus.github.io · 71 points · 10 comments · HN thread
TL;DR Greydanus describes PenGPT, two small transformers: a 6M-parameter model that writes print and cursive in many hands (including a new hand from a few sample words) and a 54M-parameter model that sketches from a text prompt. He credits most of the results to data (about 80% of effort) and training speed rather than architecture, and frames it as his first project following the Bitter Lesson.
- Handwriting model (6M parameters) was trained on 495,590 words from 1,255 writers, mostly scanned and traced into strokes with InkSight; between a third and a half of words survived quality checks.
- Drawing model (54M parameters) was trained on 477,670 sketches from ten public datasets, keeping the best 0.5% of Quick, Draw!.
- Ablations show data volume and augmentation matter most; BPE merges, pen-position input, vocabulary size and model doubling changed little or made scores slightly worse, while BPE cut sequence length 3.2x for speed.
- New handwriting styles can be picked up by prompting with a few real words from one writer, with no fine-tuning; a photo can be used by fitting one writer vector to traced words.
- Captions matter for drawings: a picture-only model drew scribbles, and labels alone gave 78% label matching but only 10% phrase matching vs 43% with captions.
- Limits: the drawing model blends concepts but doesn't bind attributes (e.g. who wears the hat), and sampled handwriting is less legible than real ink (54% vs 66%). Training took about 8 minutes for handwriting and 35 for sketches on an 8xA100 node.
Discussion The thread is short and mostly appreciative. Commenters praise the demo and the project's small size (one noted it fits in 50MB), with some playful tests of its limits. The most substantive exchange centers on the post's Bitter Lesson point, with one commenter relating it to their own habit of over-engineering. Other threads flag concrete failures: it stops early on some odd inputs, handles Spanish poorly, and does not learn real cursive stroke order, and one notes the training data came from older handwriting.
- Impressive, fun demo and useful for practical projects (many): Several commenters call it very impressive or great, and one says they are building a handwriting-teaching app with it. Enthusiasm is the dominant tone.
- Bitter Lesson applies to over-engineering in own work (some): One commenter says they often try to out-clever existing solutions when a clean application of known methods would work better, echoing the post's point about data over architecture.
- Weak on non-English and unusual inputs (some): Users report it handles Spanish poorly (for example enséñame) and stops prematurely on some symbol-heavy strings, suggesting limited coverage beyond its training data.
- Stroke order and training data quality are problems (a few): One commenter says it does not know the proper strokes for cursive letters, and another suspects 2000s-era handwriting in the training data hurt quality. Both point at the scanned, traced data.
- Drawing quality is limited (a few): A commenter jokingly notes it cannot draw a pelican riding a bicycle, pointing to the limits of a small sketch model.
Links from the comments
#handwriting #generativeAI #transformers #sketchGeneration #bitterLesson #machineLearning