# 用 CMake 实现 GPT-2 模型

Original title: Implementation of GPT-2 in pure CMake

> Hacker News story 49412909 · language: zh · submitted 2026-08-23
> Web version: https://zeli.app/zh/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

开发者 AlpinDale 在 GitHub 上发布了一个令人瞠目结舌的项目，仅使用 CMake 语言就完整实现了 GPT-2 模型。该项目利用 Q16.16 定点整数算术进行计算，证明了构建工具语言也能胜任复杂的神经网络推理任务。无论是完整的模型版本还是精简的玩具模型，都展示了 CMake 在表达能力上的惊人潜力。这不仅是一次技术炫技，更是对构建系统边界的一次有趣探索，让开发者重新思考 CMake 的可能性。

## Key quote

> 这是一个纯 CMake 实现的 GPT-2 模型，使用 Q16.16 整数算术执行。

## HN discussion (19 comments)

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

> 用 Python 当构建工具，用 CMake 当编程语言，现在缺的只是再加点 ASM 里的配置了。

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

> 顺便说一句，这大概率甚至慢到让人笑不出来——要能让人笑出声，得在不到一小时左右看到点动静。
>
> 它一次只能用一颗核心，但这还不是最糟的：CMake 是解释执行的，而且类型是字符串式的，所以每个数字每次使用时都得进行字符串转数字，通常还得再转回来。

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

> 让我想起了 https://github.com/mmozeiko/hello-world-winui3-c

---

## Cite

- Page: https://zeli.app/zh/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

- en: https://zeli.app/story/49412909 · markdown: https://zeli.app/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
