llm.asm runs Qwen3-0.6B on bare metal, with no Linux or libc

llm.asm runs Qwen3-0.6B on bare metal, with no Linux or libc

The README for the 02-baremetal-os directory of the llm.asm project on GitHub describes a standalone bootable x86-64 operating system that runs Qwen/Qwen3-0.6B directly on hardware or KVM. It uses no Linux, no Windows, no C, no Rust and no libc.

The default build (FAST_Q8=1) is a stripped, static Multiboot 1 kernel of 24,252 bytes with zero dynamic dependencies, including 17,143 bytes of code. The legacy mode (FAST_Q8=0, with FP32 activations) comes to 23,612 bytes. Model weights are a separate .asmbin file: 614 MiB in the v2 format with FP16 scales, or 649 MiB in v1 with FP32 scales. The README reports a cold boot of 74 to 94 ms to an interactive multi-turn chat prompt, with all processor cores online and the model used straight from physical RAM, without copying, on 2 MiB huge pages.

On decode speed, the project reports 134.9 tokens per second on QEMU KVM with an AMD EPYC 7642 and 16 vCPUs. The same setup gave 23.7 tokens per second on 1 vCPU and 118.1 on 8, with a peak of 136.6. A live run on a Proxmox VE virtual machine with no disks (Intel Xeon E5-2670 v3, 12 cores, 2 GiB of RAM) reached 55.4 tokens per second. The README also claims the kernel beats both the project's Linux build from Phase 1, which uses mmap(), and llama.cpp running Q8_0 on CPU at every thread count. It credits huge-page identity mapping, which avoids walks through 4 KiB page tables.

Phase 2 compiles the same shared math, matrix multiplication, tokenizer and transformer assembly files as Phase 1, and adds 4,167 lines of bare-metal OS code. That code handles the switch into 64-bit Long Mode, wakes the additional processor cores, carves a 449 MiB arena for the KV-cache and scratch space, and drives a serial port, an 80x25 VGA console, a PS/2 keyboard, a timer and ACPI poweroff. According to the README, output matches Phase 1 token for token and byte for byte on 1 to 32 vCPUs, and all five parity test prompts match exactly.

The chat keeps its KV-cache between turns, so each new message processes only the new tokens. A status line shows context use out of 2048, and when the cache is nearly full the system prints a message and resets it. The project can also package the kernel, a GRUB2 configuration and the 649 MiB model into a single bootable BIOS and UEFI ISO of about 661 MiB. Because everything runs from RAM, a virtual machine booted from it needs no hard disk.

Key facts

  • The default kernel is 24,252 bytes stripped; the model weights are a separate file of 614 MiB or 649 MiB.
  • The project reports a 74 to 94 ms cold boot to an interactive chat that keeps its KV-cache across turns.
  • Reported decode speed on a 16 vCPU AMD EPYC 7642 under QEMU KVM is 134.9 tokens per second; a 12-core Xeon virtual machine on Proxmox reached 55.4.
  • The README says output matches the Linux-based Phase 1 build byte for byte on 1 to 32 vCPUs.
  • The CPU must support AVX2, FMA and F16C, and a bootable ISO of about 661 MiB runs with no disks at all.

Why it matters

The project takes the general-purpose operating system out of local inference: the machine boots straight into a chat with Qwen3-0.6B. The README argues this also helps speed. Because the boot code maps guest RAM with 2 MiB huge pages, the kernel avoids 4 KiB page-table walks across the model, and the author says it outperforms both the Linux Phase 1 build and llama.cpp CPU Q8_0 at every thread count.

Who it affects

It is most relevant to people interested in low-level x86-64 programming and in how an inference engine works with nothing underneath it. The code covers booting, paging, multicore startup and device drivers alongside the transformer itself. Users of QEMU KVM or Proxmox VE can try it in a virtual machine, provided the host processor has the required vector instructions.

How to use it

You need an x86-64 CPU with AVX2, FMA and F16C, plus nasm, binutils and qemu-system-x86 for the core build. You also need an exported Qwen3-0.6B .asmbin file, prepared as described in the Phase 1 setup; the v2 FP16 format is recommended. Running make os FAST_Q8=1 builds the kernel and make os-check inspects it. QEMU can then boot it with the model passed as -initrd, either over a serial terminal or in a VGA window with keyboard input. A one-shot prompt can be passed on the command line, with a clean shutdown afterwards.

For an ISO, install the GRUB, mtools and xorriso packages and run make os-iso. On Proxmox, upload the image and create a diskless VM; the example uses 12 cores and 2048 MB of memory. The --cpu host setting is required to expose AVX2 and FMA, and --balloon 0 keeps 2 GiB of contiguous guest RAM for the 649 MiB model and the 449 MiB cache arena.

How solid is it

The README gives concrete details: binary sizes, build commands, named processors and a verification script, scripts/verify_os.py, for the parity check against Phase 1. The scaling benchmark used the v2 FP16 model file, 34 prompt tokens, 64 generated tokens and greedy decoding.

Still, the speed and boot figures are the project's own, with no independent verification mentioned. The live results described come from virtual machines.

Risks and caveats

The small kernel figure does not include the model, which is hundreds of megabytes. The listed drivers cover serial, VGA, PS/2 keyboard, timer and ACPI poweroff, with no networking or storage driver among them. The VGA console falls back to ASCII for Cyrillic text, while the serial port receives raw UTF-8. Long conversations are cut off by design: when the context fills, the KV-cache is reset.

“A standalone bootable x86-64 operating system that runs Qwen/Qwen3-0.6B directly on hardware or KVM with no Linux, no Windows, no C, no Rust, and no libc.”

— llm.asm project README