llm.asm
Qwen3 inference, a bootable bare-metal OS, and a Mini-GPT trainer — all in pure x86-64 assembly, in tens of kilobytes.
Source repositoryOverview
Most language model runtimes arrive as megabytes of libraries, drivers and dependencies before a single token appears. Strip it all away and the transformer is still there — a few thousand lines of arithmetic in a file smaller than a photo.
llm.asm runs Qwen3-0.6B in a 15.1 KB static binary of pure x86-64 assembly, with no C, no libc, and no runtime dependencies. On a 40-thread AMD EPYC it decodes at 126.8 tokens per second, 18–36% faster than llama.cpp.
What it includes
- Qwen3 inference in 15.1 KB — INT8 AVX2 kernel with token-for-token PyTorch parity
- A bootable bare-metal OS in 25.4 KB — boots in 74–94 ms, 134.9 tokens per second on KVM
- A Mini-GPT trainer in 33.9 KB — gradients matching PyTorch to 1.0000000000, live Braille display
- Two further phases — a Ring -1 hypervisor patching live kernel crashes, an eBPF module for Linux 6.12
How it runs
Build with make, NASM and GNU binutils on an x86-64 CPU with AVX2, FMA and F16C. Weights export offline from a Qwen3-0.6B checkpoint; the bare-metal phase boots under QEMU/KVM or Proxmox, the eBPF phase targets Linux 6.12. MIT licensed.
Who it is for
Systems programmers, OS developers and ML engineers who want to see a transformer's true cost.