hn.today

PenGPT: A Generative Transformer for Handwriting and Sketches

greydanus.github.io155 points26 comments
Screenshot of PenGPT: A Generative Transformer for Handwriting and Sketches

PenGPT explores whether ordinary, relatively small transformers can generate handwriting in many styles and make sketches from text. Its 6-million-parameter model writes print and cursive, including in the style of an unfamiliar writer after seeing just a few sample words; its 54-million-parameter model draws from text prompts. Both represent pen movements as sequences of tokens built from movements in eight directions plus pen-up and pen-down events. The handwriting model was trained on nearly 496,000 words from 1,255 writers, reconstructed from scanned pages, while the drawing model used about 478,000 sketches from public datasets. For drawings, the model receives a text-image embedding, and augmentation helps it connect prompts to sketches.

The experiments point to data quality and training setup, rather than architectural novelty, as the main sources of performance. Reducing handwriting data worsened scores and style matching; training on isolated words sharply weakened its ability to adopt a writer’s hand. Removing drawing augmentation nearly eliminated prompt-following, while a larger vocabulary, pen-position input, or twice as many parameters brought little benefit. The model can imitate handwriting from photos after traced samples are used to fit a writer vector, without fine-tuning the full model. Its sketches can combine familiar concepts but struggle with relationships and directions, and sampled writing is less legible than real handwriting. The project’s central lesson is practical: substantial effort on data, quality control, and fast training mattered more than clever model design.

Read on greydanus.github.io26 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in AI

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.