· via Hacker News – Front Page (native)
24 KB of hand-written assembly boots an interactive Qwen3-0.6B chat on bare metal
A pure x86-64 assembly OS weighing just 24 KB boots to an interactive Qwen3-0.6B chat session in under 100 ms, with no Linux, no C runtime and no libc — just a Multiboot kernel plus a 614 MiB model file.
A project named llm.asm, currently sitting on the front page of Hacker News, pushes minimal LLM inference to an unusual extreme: a complete bootable operating system written entirely in x86-64 assembly that runs the 0.6-billion-parameter Qwen3 model directly on the CPU. There is no Linux or Windows underneath it, and no C, Rust or libc in the build.
According to the repository's documentation, the kernel — the project's Phase 2 — is a stripped, statically linked Multiboot 1 image of 24,252 bytes, or 23,612 bytes in a legacy mode that keeps FP32 activations. Inside that footprint sit roughly 17 KB of code and 2.7 KB of read-only data, plus a 2.1 MiB zero-initialised .bss section that costs nothing in file size; there are no dynamic dependencies at all. The model weights are not part of the kernel: a Q8_0-quantised Qwen3-0.6B export — about 614 MiB with FP16 scales, or 649 MiB with FP32 — is passed in as a Multiboot module, either via QEMU's initrd mechanism or bundled into a self-contained, bootable hybrid BIOS+UEFI ISO of roughly 661 MiB.
Boots to a chat prompt in under 100 ms
The documentation reports a cold boot to an interactive multi-turn chat session — the asm-llm> prompt — in 74 to 94 milliseconds, with all SMP cores online. The console keeps conversation state across turns using a persistent KV-cache with a 2,048-token context by default, and offers slash commands for clearing history, toggling Qwen3's reasoning mode, running a built-in benchmark, and triggering a clean ACPI power-off. Input is polled simultaneously from an 80x25 VGA text display with a PS/2 keyboard and from a COM1 serial port at 115200 baud.
Throughput is reported at 134.9 tokens per second for decoding under QEMU KVM on an AMD EPYC 7642 with 16 vCPUs, scaling from 23.7 tok/s on a single vCPU to 118.1 tok/s at eight, with a 136.6 tok/s peak. On a diskless Proxmox VE virtual machine running on an Intel Xeon E5-2670 v3 with 12 cores, the author measured 55.4 tok/s. More striking than the speed is the correctness claim: outputs are said to match the project's earlier Linux-based Phase 1 implementation exactly, token for token, across configurations from 1 to 32 vCPUs.
What the 24 KB actually contains
The kernel is linked as a 64-bit ELF and then wrapped in an ELF32 container so that standard Multiboot 1 loaders such as GRUB2 and QEMU's -kernel option can handle it; the boot code immediately switches the machine into 64-bit long mode. The footprint covers roughly 4,167 lines of bare-metal OS code layered on top of the shared assembly modules for math, matrix multiplication, tokenisation and the transformer that Phase 1 already used.
The documentation spells out the internals. The boot path verifies the Multiboot magic number, builds identity-mapped 2 MiB huge pages covering the first 4 GiB (with the Local APIC MMIO region marked uncacheable), installs an exception table, and uses CPUID to confirm XSAVE, AVX, AVX2, FMA and F16C support — the last three being hard requirements. The runtime then binds the model file zero-copy at its physical load address and carves a 449 MiB KV-cache and scratch arena out of the largest usable region in the boot memory map. Symmetric multiprocessing is home-grown as well: the code walks the ACPI tables to enumerate cores, wakes them through a small trampoline at physical address 0x8000 using Local APIC INIT-SIPI-SIPI, and coordinates matrix work with a lock-free spin barrier that gives each core its own cache line.
Running it yourself
Hardware requirements are an x86-64 CPU with AVX2, FMA and F16C, and the core build toolchain is little more than nasm and binutils. QEMU boots the kernel and model as separate arguments, and a one-shot batch prompt with automatic ACPI shutdown is supported. The ISO variant runs entirely from RAM, which the author demonstrates with a Proxmox VM that has no disk whatsoever: 2 GiB of memory holds both the 649 MiB model and the KV-cache arena, with interaction over the web console or a virtual serial port.
Why it matters
Conventional LLM serving stacks rest on deep layers of software: a general-purpose OS, drivers, allocators and language runtimes. This project establishes how little is actually required. A complete environment for quantised, multi-turn, multi-core LLM chat fits into 24 KB of machine code and reaches an interactive prompt before most bootloaders have finished drawing a menu.
The exact parity with the Linux implementation is arguably the more consequential result: it demonstrates deterministic, reproducible inference numerics across radically different runtimes and core counts, which matters for testing and verification of inference engines. The work is clearly a demonstration rather than a product, but it sketches a floor for how small an LLM runtime can be — relevant to embedded devices, firmware-adjacent deployment, and appliance-style systems that boot straight into a model. As engineering, it also doubles as an unusually complete worked example of modern bare-metal x86-64 development: long mode, huge pages, ACPI enumeration, SMP bring-up and SIMD-optimised inference, all in a single auditable codebase.
- #assembly
- #bare-metal
- #llm
- #osdev
- #qwen