PenGPT: Transformer Learns Handwriting and Sketches

Original: PenGPT: A Generative Transformer for Handwriting and Sketches

Why This Matters

Shows data-driven scaling beats domain-specific architecture for pen-stroke generation.

Researcher Sam Greydanus built PenGPT, a small transformer that generates handwriting in unseen writers' styles and draws from text prompts, trained on ~500K words from 1,255 writers and 477K sketches.

Sam Greydanus, known for prior work training a tiny GPT to write cursive, has released PenGPT — two transformer models that generate handwriting and sketches from text. The smaller 6M-parameter model handles print and cursive, adapting to a new writer's style from just a few sample words. The larger 54M-parameter model draws from typed prompts using SigLIP 2 vectors as a bridge between text and visual sketches.

The approach is notably low-tech on the architecture side. Pen strokes are snapped to an 8-direction grid, then compressed via byte-pair encoding — a 156-move word becomes 47 tokens. A standard decoder with cross-attention handles the rest. The same tokenizer serves both handwriting and drawing tasks.

Data was the real lift. Greydanus assembled 495,590 words from 1,255 writers using public archives and research collections, running a vision-language model to transcribe scans, InkSight to recover stroke data, and quality filters that cut 50–67% of samples. The 477K sketch dataset drew from Quick, Draw! and nine other sources, keeping only the top 0.5% of Quick, Draw!'s 50 million entries.

Greydanus credits the project's success to following the "Bitter Lesson" — data and compute over hand-crafted priors. Paper, code, and weights are publicly available.

Source

greydanus.github.io — Read original →