Dev.to AI 🤖 Ai 👁 0 📖 3 min read

A 14 KB Binary Runs Qwen3 in Pure Assembly. It BEATS llama.cpp by up to 36% 👇

A 14 KB Binary Runs Qwen3 in Pure Assembly. It BEATS llama.cpp by up to 36% 👇 llm.asm runs a language model from a 14 KB binary. The binary holds Qwen3-0.6B inference, a bootable LLM operating system, and a Mini-GPT tr

A 14 KB Binary Runs Qwen3 in Pure Assembly. It BEATS llama.cpp by up to 36% 👇

llm.asm runs a language model from a 14 KB binary. The binary holds Qwen3-0.6B inference, a bootable LLM operating system, and a Mini-GPT trainer. Every line is pure x86-64 NASM assembly. The repo uses zero C, zero libc, and zero runtime libraries. It appeared on GitHub on November 25, 2026, and it already has 2,599 stars. The license is MIT, so you can use it free.

What it runs

The repo holds four projects in 17,252 lines of assembly. Project one runs Qwen3-0.6B inference in a 14,712-byte static binary. It decodes at 126.8 tokens per second on 40 threads. That is 18 to 36 percent faster than llama.cpp on the same CPU and model. Its output matches PyTorch FP32 with a cosine of 0.99965 and 64 of 64 exact greedy tokens.

Project two boots Qwen3-0.6B as a bare-metal operating system in 24,252 bytes. It boots in 74 to 94 milliseconds and needs no Linux or Windows at all. Project three trains a Mini-GPT from scratch in a 32,944-byte binary. It cuts TinyShakespeare validation loss from 4.19 to 1.51 in four minutes. Project four is a Ring -1 hypervisor, a program that runs below the operating system, and it live-patches Linux kernel crashes. It runs a MiniCPM5-2B engine under Linux and scores 97.54 percent pass on 122 held-out fault tests.

How to try it

You need an x86-64 CPU with AVX2, FMA, and F16C. That means Intel Haswell or AMD Excavator, or any newer chip. You also need nasm and GNU binutils on Linux. Install them with this command.

sudo apt install nasm binutils

Then clone the repo and build all four projects.

git clone https://github.com/alesha-pro/llm.asm.git
cd llm.asm
make all

The model weights need one export step in Python. The script converts Qwen3-0.6B into the repo's own .asmbin format. Then run the binary with a prompt.

python3 scripts/export_weights.py --model-dir models/qwen3-0.6b-bf16 --out models/qwen3-0.6b-q8_0.asmbin --scale-dtype fp16
make inference FAST_Q8=1
./build/asm-llm -m models/qwen3-0.6b-q8_0.asmbin -p "Explain how a CPU cache works in 3 concise sentences." -n 128 -t 16

Add --chat to start a multi-turn chat that remembers past turns. Try the trainer first if you want the fastest win. It needs no model download and no Python at runtime.

mkdir -p data checkpoints && curl -fsSL https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt -o data/tinyshakespeare.txt
make train
./build/asm-gpt-train --data data/tinyshakespeare.txt --steps 400 --seq 128 -t 16 --save checkpoints/shakespeare.ckpt

What can go wrong

The repo is three days old, and it has only four commits. Treat the benchmarks as the author's own numbers until others repeat them. The speed win applies to CPU decode of a 0.6B model, not to large models or GPUs. Qwen3-0.6B is a small model, so its answers stay simple. ARM machines and Apple Silicon cannot run it at all. The bare-metal OS and the hypervisor need QEMU, KVM, or real hardware skill.

Most readers should start with project one or three, not two or four. Project two needs a virtual machine or a spare machine to boot. Project four patches a live kernel, so a mistake can crash the host. Read the per-project README files before you touch either one.

Verdict

llm.asm is a stunt with real engineering behind it. A 14 KB binary that beats llama.cpp by 18 to 36 percent is not a toy result. The trainer is the best first step. It teaches you how a transformer trains, with no Python in the loop. Clone it, run make all, and watch a language model boot from assembly.

Follow along

I test AI tools and build in public:

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.