llm.asm is a GitHub repo that runs a real language model, Qwen3-0.6B, from a 14,712-byte program written entirely in x86-64 assembly. It gained 1,352 stars in a single day on GitHub's trending list. Its README claims 18 to 36 percent faster CPU decode than llama.cpp on the author's AMD EPYC test machine. That claim comes from the repo itself, on one machine and one model, so this post separates what is measured from what is generalized.
The repo, alesha-pro/llm.asm, is MIT licensed and bundles three projects: the inference engine, a bootable operating system that chats with the model, and a GPT trainer. It is a showpiece, and a good one. It is not a replacement for the runtimes most people use.
TL;DR: what is claimed and what to do with it
| Question | Answer |
|---|---|
| What is it? | Three LLM programs in pure x86-64 NASM assembly: inference, a bootable LLM OS, a Mini-GPT trainer |
| Which model? | Qwen3-0.6B, converted to a custom Q8_0 file called .asmbin |
| Binary sizes? | 14,712 B inference, 24,252 B OS, 32,944 B trainer (README figures) |
| Speed claim? | 18 to 36 percent faster decode than llama.cpp Q8_0, 1 to 40 threads, on an AMD EPYC 7642 |
| Where llama.cpp wins? | Prompt prefill: llm.asm runs token by token, llama.cpp batches |
| License? | MIT |
| Needs? | x86-64 with AVX2, FMA and F16C; Linux; nasm; Python with numpy once for weight export |
| Use it for? | Learning how a transformer runs on a CPU. Not for production |
What is llm.asm and what is inside the repo?
The README describes "three complete LLM projects written in 100% pure x86-64 NASM assembly" with no C, C++, Rust, libc or libm. The author hand-wrote every part a normal runtime borrows from a library: the math kernels for exp, sine and cosine, RMSNorm, RoPE, SiLU and softmax; an AVX2, FMA and F16C matrix engine; a byte-pair-encoding tokenizer; a thread pool built on raw clone and futex system calls; and, for the trainer, a backward pass and the AdamW optimizer. The README counts 17,252 lines across all three projects, of which 3,857 are a shared core.
| Project | Binary | What it does |
|---|---|---|
| 01-qwen3-inference | 14,712 B | Static Linux ELF that runs Qwen3-0.6B at Q8_0, with single-shot and multi-turn chat modes and a KV cache |
| 02-baremetal-os | 24,252 B | Multiboot kernel that boots into long mode and chats with the model on VGA and keyboard, no OS underneath |
| 03-minigpt-train | 32,944 B | FP32 Mini-GPT trainer and sampler with a live Braille-character terminal chart |
The model file is not part of those sizes. The converted Qwen3-0.6B weights are about 614 MiB, so the "14 KB LLM" headline describes the engine, not the whole system. That is how every runtime works. llama.cpp is also small next to the weights it loads. Still, a complete Qwen3 forward pass in 14 KB of machine code is a striking engineering result.
How does it compare with llama.cpp, and what is the evidence?
The README publishes a table measured on one machine: an AMD EPYC 7642, CPU only, Qwen3-0.6B at Q8_0, 34 prompt tokens, 64 generated tokens, three-run average. Here are the decode speeds it reports for the default fast mode.
Inference speed gauge showing llm.asm decode throughput on CPU against llama.cpp
| Threads | llama.cpp Q8_0 | llm.asm FAST_Q8=1 | Reported gain |
|---|---|---|---|
| 1 | 16.63 tok/s | 20.70 tok/s | 1.24x |
| 4 | 51.08 tok/s | 69.24 tok/s | 1.36x |
| 8 | 80.79 tok/s | 103.64 tok/s | 1.28x |
| 16 | 103.03 tok/s | 121.86 tok/s | 1.18x |
| 40 | 105.08 tok/s | 125.86 tok/s | 1.20x |
Source: the llm.asm README, author's own measurements. We have not reproduced them.
Three things are worth knowing before you repeat that headline.
First, the comparison is decode only. The README itself notes that llama.cpp uses batched matrix multiplication for prompt prefill, while llm.asm processes the prompt token by token. For long prompts, llama.cpp would be expected to do better.
Second, the two runs are not doing identical arithmetic. The fast mode quantizes activations to int8 and uses the AVX2 vpmaddubsw and vpmaddwd instructions, with FP16 block scales. The README reports a cosine similarity of 0.99965 against a PyTorch FP32 reference and 64 of 64 matching greedy tokens. That is good evidence of accuracy on a short test. It is not a full quality evaluation, and it does not say how a 0.6B model behaves on your task.
Third, the model is tiny. Qwen3-0.6B decode is bound by memory bandwidth and by how well the code keeps the CPU fed. A hand-tuned path for one fixed shape can beat a general runtime there. The same trick does not automatically carry to a 7B or 70B model, to other architectures, or to ARM. llama.cpp's optimization work on other hardware is a different story: see our coverage of the llama.cpp RDNA patches claimed to reach 35 to 55 tokens per second and the AMD benchmark dashboard for llama.cpp.
Why does a 0.6B model make this possible?
Qwen3-0.6B is the smallest model in the Qwen3 family, published openly on Hugging Face. Its 28 layers, grouped-query attention, QK-norm, rotary embeddings and SwiGLU feed-forward blocks fit in a few thousand lines of code, which is what the repo's shared transformer file implements. A frontier-scale model needs mixture-of-experts routing, long-context tricks, many quantization formats and GPU kernels. That is why mainstream runtimes grow large, and why a single author can match one model end to end.
The takeaway for builders is about scale, not about assembly. When a model is small enough, the runtime is a small program, and the real cost is memory bandwidth. That fits a broader pattern we have covered: small models doing real work, such as distilling a larger model into Qwen3-4B, and aggressive CPU and consumer-hardware tricks such as running an 800B model on consumer hardware with llama.cpp.
The bare-metal LLM OS: what is real about it?
The second project is the one that drew attention. The README describes a kernel that is loaded by a Multiboot bootloader, builds four-level page tables, enters long mode, turns on AVX2 and FMA, brings up the other CPU cores through ACPI and the local APIC, and then runs the same transformer code as the Linux build. Input comes from a PS/2 keyboard, output goes to VGA text mode and a serial port, and a chat loop with commands such as /clear, /think and /bench runs the model.
The reported numbers are 74 to 94 ms boot time, 134.9 tokens per second under KVM on the EPYC machine, and 55.4 tokens per second on a Proxmox virtual machine with a Xeon E5-2670 v3 and no disk. The repo includes screenshots of both runs in its assets folder. As with the rest, these are the author's figures.
It is a clear demonstration that an LLM does not need an operating system, a filesystem or a Python stack. It also shows why nobody ships this way: with no drivers for network, storage or GPU, the machine can do exactly one thing.
Training a GPT in assembly
The third project is a from-scratch FP32 trainer. The README says its analytical backward pass matches PyTorch on all 21 gradient tensors with a cosine of 1.0000000000, that it reaches 27,662 training tokens per second, and that validation loss on the TinyShakespeare dataset falls from 4.19 to 1.51 in four minutes. It has a terminal chart drawn with Unicode Braille characters.
A 2.7 million parameter model trained on Shakespeare is a teaching exercise. The value is the gradient check: writing a backward pass by hand and matching a reference framework to ten decimal places is the best way to learn what a training framework does for you.
How to try it
You need a Linux x86-64 machine with AVX2, FMA and F16C. The README's quick start is short.
sudo apt install nasm binutils
git clone https://github.com/alesha-pro/llm.asm.git
cd llm.asm
make all
For inference, download Qwen3-0.6B, export it once to the repo's custom format, then run the binary.
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 --chat -t 16
To check the speed claim yourself, run the same Q8_0 model through llama.cpp with -ngl 0 on the same machine and compare decode speed, not prompt speed, at several thread counts. If your CPU has fewer cores or a different cache layout than an EPYC 7642 with 256 MiB of L3, expect different ratios. A fair test also reports prompt processing time separately.
What are the limits?
- One model, one path. It runs Qwen3-0.6B only. There is no GGUF loader, no other architecture and no GPU backend.
- x86-64 only. It needs AVX2, FMA and F16C, so it does not run on Apple Silicon or other ARM machines.
- Young project. The repository shows three commits at the time of writing. Star counts reflect curiosity, not production use.
- Self-reported benchmarks. One machine, one author, no independent reproduction that we found.
- Prefill is slower by design. The README says so itself.
- Maintenance. Hand-written assembly is hard to extend. Adding a new activation or attention variant means writing and verifying new kernels.
Why it matters
For most readers the practical advice is simple. Keep using a maintained runtime for real work: llama.cpp 1.0 now has stable library versioning, which matters more to a product team than a 20 percent decode gain on one model. Use llm.asm to learn. If you want to understand how int8 dot products, KV caches and thread pools produce tokens, a readable 17,000-line codebase with reference checks is a rare resource.
There is also a lesson for teams tuning inference. Much of the gain the author reports comes from known techniques: int8 activations, compact scales, prefetching the next weight row, and contiguous head-major KV layout. Teams working on their own CPU deployments can try the same ideas in a maintained stack, and the approach of hill-climbing on measured speed is covered in our post on an inference optimisation skill for local LLMs.
Related reading
- llama.cpp 1.0: stable libllama and libggml, what changes
- llama.cpp RDNA patches: 35 to 55 tokens per second, claimed vs verified
- llama.cpp AMD benchmark dashboard
- Running an 800B model on consumer hardware with llama.cpp
- Inference optimisation skill: hill-climbing local LLM speed
- Distilling a larger model into Qwen3-4B
- Official sources: the llm.asm repository, the Qwen3-0.6B model card and the llama.cpp repository
Figures, versions and repository details are accurate as of November 26, 2026 and may change as the project evolves.
