A 24 KB Bootable OS Written in Assembly Runs Qwen3-0.6B at 135 Tokens a Second, With No Linux and No libc
A GitHub project called llm.asm has a second phase that removes the operating system from LLM inference. The 02-baremetal-os directory builds a Multiboot x86-64 kernel that runs Qwen3-0.6B directly on hardware or under KVM, with no Linux, no Windows, no C, no Rust and no libc. The stripped kernel is 24,252 bytes: 17,143 bytes of code, 2,772 bytes of read-only data and a 2.1 MiB zero-initialised block. It reaches an interactive asm-llm> prompt in 74 to 94 ms.
Numbers
On QEMU/KVM on an AMD EPYC 7642, decode runs at 23.7 tokens per second on one vCPU, 118.1 on eight and 134.9 on sixteen, with a peak of 136.6. Past that it plateaus: 133.1 at 24 vCPUs and 132.4 at 32. On a diskless Proxmox VM with 12 cores of an Intel Xeon E5-2670 v3 (a 2014-era part), the author measured 55.4 tokens per second live.
| vCPUs | Boot ready | Prefill | Decode |
|---|---|---|---|
| 1 | 73 ms | 31.7 tok/s | 23.5 tok/s |
| 4 | 84 ms | 104.7 tok/s | 78.2 tok/s |
| 16 | 85 ms | 160.5 tok/s | 134.9 tok/s |
The README claims every one of 64 generated tokens matches the Linux-hosted phase one build, byte for byte, across 1 to 32 vCPUs, covering five test prompts including a Russian one and Qwen3’s reasoning mode. It also says the bare-metal kernel beats both its own Linux build and llama.cpp’s CPU Q8_0 path at every thread count, attributing the gain to identity-mapping RAM with 2 MiB huge pages so the 614 MiB model avoids 4 KiB page-table walks. That comparison is the author’s own and was not independently reproduced.
What is actually in the 24 KB
The kernel is about 4,200 lines of OS assembly plus shared math, matmul, tokenizer and transformer code. It enters long mode from Multiboot, verifies AVX2, FMA and F16C via CPUID, and wakes the other cores through ACPI tables and INIT-SIPI-SIPI with a hand-written 16-to-64-bit trampoline. Drivers cover COM1 serial, 80x25 VGA text and a PS/2 keyboard. The model file, an 8-bit quantised format with FP16 scales (614 MiB; the older FP32-scale variant is 649 MiB), is passed as a Multiboot module and used in place from physical memory, with no copy. A separate 449 MiB arena holds the KV cache.
So the kernel is small only because the weights are not part of it. The ISO that packages both is about 661 MiB, and the model is roughly 26,500 times larger than the code that runs it.
Limits
Context is capped at 2,048 tokens by default, the KV cache resets when it fills, and the CPU must support AVX2, FMA and F16C. Qwen3-0.6B is a model for demonstrations, not for work. The value is as a floor measurement: it shows how little software a transformer needs when the only job is matrix multiplication on cores that are already awake, and how much of a typical inference stack’s overhead is the stack.