On November 12, 2026, independent researcher Sam Greydanus published PenGPT, a small transformer that writes handwriting and draws sketches one pen move at a time.
It reached the Hacker News front page on November 25, and its thread showed 399 points and 77 comments at my last check. This post covers how it works, what the experiments show, and where it falls short.
Not to be confused with the "PenGPT" AI smart pens sold on online stores, which are unrelated consumer gadgets.
TL;DR #
- Two small models: a ~6M-parameter one that writes print and cursive and imitates unseen writers from a few of their words, and a54M-parameter one that draws from a text prompt.
- The released weights are 5.8 MB and 50 MB , and inference runs in NumPy.
- The author's main finding: data, augmentation and how training sequences are built mattered most. Clever architecture mattered little.
- It is a preprint with real limits: sampled handwriting is read correctly less often than real ink (54% vs 66%), and the drawing model can't reliably bind words to each other.
How it works #
Tokenizer. Pen points are snapped to a grid, and motion becomes a walk in eight directions, plus two symbols for pen down and pen up.
Byte-pair encoding then merges common runs of moves into short-stroke tokens (512 merges for handwriting, 1,024 for drawings). That's the only modality-specific part, and the same tokenizer serves both models.
Model. A decoder-only transformer with cross-attention in every block, trained with the Muon and AdamW optimizers.
The handwriting model is told the text to write. The drawing model is told a single SigLIP 2 vector, so a typed phrase can stand in for a picture.
Imitating a new hand, without a style encoder. Each handwriting training sequence holds up to four words by the same writer. That teaches the model that later words look like earlier ones, so at sampling time you give it one to three real words and it carries on in that hand.
From a photo. There is also a photo route: trace a few words with the InkSight model and fit one new writer vector to them, leaving all other weights frozen.
The data (the real effort) #
| Handwriting | Drawings | |
|---|---|---|
| Size | 495,590 words, 1,255 writers, 7 sources | 477,670 sketches, 10 sources |
| Notes | Mostly traced from scanned pages, including letters, diaries and research collections | Best 0.5% of Quick, Draw!'s 50M, plus nine other datasets |
Few collections of English pen strokes exist, so the author built one from scans, in four steps:
- Find: a vision-language model (the paper names Claude) grades pages for legibility and scan quality.
- Cut: pages are transcribed and cut into words.
- Trace: InkSight turns each word image into strokes.
- Check: automated checks drop bad traces.
Between a third and a half of words survive this process. The datasets are not released, though the paper's appendix explains how to rebuild them.
What the ablations show #
Each row changes one thing about the base recipe. Score is held-out nats per pen move, so lower is better.
| Handwriting | Score change | Style rank* | Legible |
|---|---|---|---|
| PenGPT base | 0.716 | 1.9 | 54% |
| Graves-style LSTM, same tokens | +0.029 | 2.2 | 49% |
| One-tenth of the data | +0.050 | 3.0 | 47% |
| No augmentation | +0.028 | 2.0 | 52% |
| One word per sequence | +0.009 | 6.0 | 52% |
| Pen-position features removed | +0.001 | 1.9 | 52% |
| Twice the parameters | −0.004 | 1.9 | 55% |
| Real ink | 66% |
*How well the model tells whose hand it's continuing: 1 is best, 8.5 is chance.
For drawings, SigLIP 2 picked a drawing's own label for 76% of drawings and its own caption phrase for 43%. A same-token LSTM managed 40% and 20%. Removing augmentation dropped those figures to roughly 4% and 6%. Takeaways
- Cutting data or augmentation hurts most.
- Training on several words at once is what makes new-hand transfer work.
- A vocabulary 60x larger from another tokenizer changed nothing, and the BPE merges mainly buy speed (sequences are 3.2x shorter).
- The drawing model needed captions : trained on picture vectors alone, it scribbled and followed typed prompts only 4–6% of the time.
The author traces that last result to SigLIP 2's sketch vectors sitting in a narrow cone nearly at right angles to its text vectors.
Training is cheap: about 8 minutes (handwriting) and 35 minutes (drawings) on an eight-GPU node. The post and release notes say A100s, though the author's Hacker News reply says H100s.
The author's earlier Cursive Transformer needed over 10 hours on one A100 and learned a single hand.
Try it #
- Code and weights: the GitHub repo and its releases page, under Apache 2.0 according to a third-party index of the repo.
- Released models: handwriting (6.1M parameters, 1,192 known hands, 5.8 MB), drawing (54M, 50 MB), plus SigLIP 2's text encoder (375 MB) to turn typed prompts into vectors. Weights are stored at 8 bits.
- Run: CLI commands for
writeanddrawininference/pen.py. There is also an in-browser demo linked from the post.
Limitations #
From the author
- The drawing model gets one pooled vector, close to a bag of words, so "facing left" and "facing right" produce the same drawing, and "who wears the hat" fails.
- Most handwriting was traced from scans, so stroke order is an inference, and the training words lean short and neat.
- Drawing quality is scored by the same model family that conditions it.
- All baselines are the author's own implementations, and each ablation is a single run read against the noise of three base seeds.
From Hacker News
- Poor results with Spanish and Polish accented characters.
- Cursive strokes that don't follow the proper stroke order.
- A muddled pelican riding a bicycle, since the model blends ideas rather than binding them.
- Wobbly slanted lines that look like aliasing from the coarse grid.
On the wobble, the author replied that he chose the coarsest grid he could for speed, which cut iteration time to roughly five minutes, and that a small post-processing change has mostly fixed it.
One commenter argued the grid is itself human-injected knowledge that more data can't fix, which sits awkwardly with the bitter-lesson framing.
Misuse
The impact statement flags that a model which picks up someone's hand from a few words could be used to imitate their writing. The author judges that risk modest next to generative models of faces, voices and video.
One Hacker News commenter called it a forgery tool and was uneasy that the code is public.
A note on sourcing
On Hacker News the author said the post's body text (all but the conclusion) was written by Claude, apologized for it, and said his other posts are handwritten. A commenter said the paper reads similarly.
The figures in this blog are the author's reported numbers from the paper and release notes, and I haven't reproduced them.
Why it matters #
PenGPT is a clean case study in the "bitter lesson": the author reports spending about 80% of the effort on data, 15% on training speed and 5% on architecture.
The result is a model small enough to run in a browser, and the measurements say where its quality came from.