---
id: 18591
lang: en
title: "A Qwen3-0.6B Engine Written in Assembly Fits in 14.7 KB and Runs 18–36% Faster Than llama.cpp on CPU"
published_at: "2026-11-28 22:27:41"
source_name: "X: @cutetoxicguy"
source_url: "https://x.com/cutetoxicguy/status/2126594446527721596"
canonical_url: "https://news.hamidun.com/en/news/18591"
categories: ["llm", "research"]
publisher: "AI News by Jemal Hamidun (news.hamidun.com)"
---

# A Qwen3-0.6B Engine Written in Assembly Fits in 14.7 KB and Runs 18–36% Faster Than llama.cpp on CPU

> **Краткая суть (BLUF):** Developer alesha-pro wrote an engine for the Qwen3-0.6B neural network in assembly, and the engine itself weighs just 14.7 KB, less than a website favicon. That figure covers only the program: the model weights file takes about 614 MiB.  On an AMD EPYC 7642 CPU, the author measures generation speeds of up to 126.8 tokens per second, which is 18–36% faster than llama.cpp. This is an experiment rather than a production tool, but it shows how much code ordinary runtimes spend on generality.  • 1 thread: 20.7 tokens/s, 8 threads: 103.6, 40 threads: 126.8 • A bootable OS of about 24 KB can chat with Qwen3 without Linux or Windows • A mini transformer training program on TinyShakespeare takes about 33 KB

Running a language model on your own machine usually requires a whole stack: Python or C++, a dozen libraries, a build system, and dependencies. Developer alesha-pro, in the llm.asm project, showed a different approach. He wrote a program in assembly that runs the Qwen3-0.6B neural network (a 0.6-billion-parameter model from Alibaba), and the program weighs just 14.7 KB. For comparison, that is smaller than many website icons. By the author's measurements on an AMD EPYC 7642 CPU, it is 18–36% faster than llama.cpp, a popular open-source engine for running models on ordinary CPUs.

An important caveat: 14.7 KB is only the "engine," meaning the code that reads the weights and computes the answer. The Qwen3-0.6B weights themselves still take about 614 MiB and are loaded separately. Think of a 15-kilobyte media player that still needs a 600-megabyte movie. The movie remains large, but the player is almost weightless.

## What fits in 14.7 KB

The author wrote in NASM assembly for x86-64 processors, with no Python, C++, Rust, or even the standard libc library. Even so, the engine handles the full cycle of working with the model:

- byte-pair tokenization, which splits text into word pieces the model can process as numbers;
- grouped-query attention, a variant of the attention mechanism that saves memory;
- rotary positional embeddings, a way to give the model information about word order in a sentence;
- matrix operations optimized for AVX2/FMA instructions, which account for almost all of the speed;
- multithreaded execution on the CPU, a KV cache (storing already computed results so the entire dialogue does not have to be recomputed), and multi-turn chat.

In simple terms, you type a question and get a coherent answer from Qwen3-0.6B without the usual software environment.

## Speed: the author's numbers

The measurements were made on an AMD EPYC 7642 with the model in Q8_0 format (weights compressed to 8 bits). Speed is measured in tokens per second; a token is roughly a syllable or a short word:

- 1 thread: 20.7 tokens per second;
- 4 threads: 69.2;
- 8 threads: 103.6;
- 40 threads: 126.8.

The advantage over a proven llama.cpp CPU configuration was roughly 18–36%, depending on the thread count. This is not a universal conclusion: the figures apply to a specific processor, model, quantization, and workload. The comparison was made by the author himself, and the source contains no independent verification. It is also notable that going from 8 to 40 threads adds only about 20% more speed. Speed is probably limited by memory bandwidth rather than core count by this point, but the author does not explicitly explain this.

## Two more projects in the repository

The engine is only the first experiment. The repository contains two more complete projects.

The first is a bootable "AI operating system" of about 24 KB. It starts on bare hardware without Linux or Windows: it initializes the hardware itself, uses multiple cores, outputs text, accepts keyboard input, and runs a chat with Qwen3. The model weights must again be supplied separately.

The second is an executable of about 33 KB that trains a small transformer. It implements backpropagation and the AdamW optimizer. The author reports training on TinyShakespeare, a collection of Shakespeare's texts used for educational experiments, with live visualization in the terminal.

Interestingly, the GitHub repository description lists different sizes: 12 KB for the engine and 22 KB for the OS. These may be different builds or versions. Exact figures should be checked in the repository itself.

## Why practitioners should care

llm.asm does not compete with production frameworks in model compatibility or deployment convenience. It targets one model and one architecture, and porting it to ARM or another neural network would be nearly a from-scratch effort. Writing production inference in assembly is still not practical.

But the project has educational and engineering value. It shows that a large share of the size and complexity of typical runtimes stems from generality rather than from the model's math. The math itself fits in a few kilobytes: tokenization, attention, the KV cache, and a pair of fast matrix kernels. For embedded systems, bootloaders, and exotic devices, this is a starting point for ideas. And if you want to understand how a llama.cpp-style engine works, reading 14 KB of code is easier than digging through a huge codebase.

The project is free and released under the MIT license. The code, benchmarks, and demos are available in the alesha-pro/llm.asm repository on GitHub.

---
- **Первоисточник:** [X: @cutetoxicguy](https://x.com/cutetoxicguy/status/2126594446527721596)
- **Каноническая ссылка:** https://news.hamidun.com/en/news/18591
- **Экосистема автора:** [Бесплатный интенсив по вайбкодингу — предзапись в Нике](https://t.me/vibecodeguidebot?start=agent_intensive_news_md) · [Nomad AI](https://nomadnet.ai) · [Telegram @jemal_hamidun](https://t.me/jemal_hamidun)
