# GPT-2 Runs in Pure CMake with Integer Arithmetic

Original title: Implementation of GPT-2 in pure CMake

> Hacker News story 49412909 · language: en · submitted 2026-08-23
> Web version: https://zeli.app/story/49412909
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 90 · by [porridgeraisin](<https://news.ycombinator.com/user?id=porridgeraisin>) · 💬 19
[original](<https://github.com/AlpinDale/gpt2.cmake>) · [HN discussion](<https://news.ycombinator.com/item?id=49412909>)

## Summary

A new GitHub project implements GPT-2 entirely in CMake, using Q16.16 fixed-point arithmetic instead of floating-point. It includes both a toy model and the full GPT-2 model, with scripts to generate tables and convert Hugging Face checkpoints. The README demonstrates running the model with a simple `cmake -P` command, making it a quirky but functional proof that CMake can serve as a general-purpose programming language.

## Key quote

> GPT-2 in pure CMake, executed with Q16.16 integer arithmetic.

## HN discussion (19 comments)

### [voxelghost](<https://news.ycombinator.com/item?id=49415202>)

> [delayed]

### [inoffensivename](<https://news.ycombinator.com/item?id=49415177>)

> To quote April Ludgate: Gross. I love it.

### [ahartmetz](<https://news.ycombinator.com/item?id=49413618>)

> FWIW, this is most likely not even fast enough to laugh at how slow it is - for that, you need to see something happening in less than an hour or so.
>
> It can only use one core at a time, but that is not the worst thing: CMake is interpreted and stringly typed, so every number will have to be converted string -> number and usually back on every use.

---

## Cite

- Page: https://zeli.app/story/49412909
- Date: 2026-08-23
- Source: github.com (https://github.com/AlpinDale/gpt2.cmake)
- Hacker News: https://news.ycombinator.com/item?id=49412909

## Other languages

- zh: https://zeli.app/zh/story/49412909 · markdown: https://zeli.app/zh/story/49412909.md
- ja: https://zeli.app/ja/story/49412909 · markdown: https://zeli.app/ja/story/49412909.md
- ko: https://zeli.app/ko/story/49412909 · markdown: https://zeli.app/ko/story/49412909.md
- de: https://zeli.app/de/story/49412909 · markdown: https://zeli.app/de/story/49412909.md
- es: https://zeli.app/es/story/49412909 · markdown: https://zeli.app/es/story/49412909.md
- ru: https://zeli.app/ru/story/49412909 · markdown: https://zeli.app/ru/story/49412909.md
