world

llm.asm Runs Qwen3-0.6B in a 24 KB Pure Assembly OS 54% Faster

Alexey Fateev's MIT-licensed llm.asm boots Qwen3-0.6B in a 24 KB pure x86-64 assembly OS without Linux or libc, beating native llama.cpp by 31%–54%.

llm.asm Runs Qwen3-0.6B in a 24 KB Pure Assembly OS 54% Faster

Developer Alexey Fateev has published llm.asm under the MIT license (PC Watch), demonstrating a bootable bare-metal operating system (asm-llm-os.elf, roughly 24 KB) written in 100% pure x86-64 NASM assembly that runs Qwen3-0.6B inference directly in RAM without Linux, Windows, C, Rust, libc, or a dynamic linker. On an AMD EPYC 7642 test machine, the bare-metal kernel boots to an interactive prompt in 74–94 ms and decodes tokens 1.31x to 1.54x faster than native Linux llama.cpp (Q8_0), hitting 134.94 tok/s versus 103.03 tok/s on a 16-vCPU QEMU/KVM VM.

How Stripping the OS Stack Unlocks 31%–54% Higher CPU Throughput

asm-llm-os.elf requires an x86-64 CPU with AVX2, FMA, and F16C instructions, storing the quantized model (614 MiB FP16 / 649 MiB FP32 scale) plus a 449 MiB KV-cache and scratch region entirely in RAM—allowing it to boot on diskless VMs with 0 GB storage. Drivers are limited to COM1 serial, 80x25 VGA console, PS/2 keyboard, PIT/RDTSC timers, and ACPI power-off, with a 2,048-token context limit.

Critically, the OS maps the first 4 GiB of memory using 2 MiB hugepages. Instead of walking multi-level 4 KB OS page tables and suffering TLB misses while streaming 614 MiB of weights on every token, the CPU reads contiguous hugepages with zero OS scheduler interrupts.

Why Bare-Metal Inference Matters Beyond a Clever Demo

llm.asm sits alongside a 12 KB Linux ELF engine and a 32 KB from-scratch trainer in the same repository. While a 0.6B model with a 2,048-token buffer is not a drop-in replacement for multi-user serving stacks like vLLM or full-featured llama.cpp, it exposes how much latency and TLB overhead general-purpose OS abstractions impose on memory-bandwidth-bound CPU inference.

Second-Order Effects for Edge AI, Appliances, and Security

First, this proves that single-purpose AI appliances—such as voice wake-word routers, local classifiers, or embedded industrial controllers—can run as tiny unikernels or bare-metal images under a hypervisor in under 5 seconds (as verified on Proxmox VE). Second, removing libc, Python, and third-party loaders eliminates the exact parsing and dependency attack surface highlighted by ZDI's recent 17 advisories against PyTorch and llama.cpp.

Winners, Losers, and What to Watch

  • Clear beneficiaries: Embedded/unikernel engineers, hypervisor appliance builders, and low-level performance researchers studying hugepage memory layouts.
  • Under pressure: Bloated containerized inference wrappers that burn hundreds of megabytes of RAM just to serve sub-1B models.
  • What to watch next: Whether mainstream CPU inference engines adopt stricter hugepage/TLB pinning and whether llm.asm expands to larger 2B–7B edge models.

// sources

// WebZona Studio products

Need a product or service that does not exist yet?

Pitch your idea in our "50 Hours" program — every month we build one community idea free for everyone. Or explore our released products.

// comments (0)

// no comments yet.