A Qwen3-0.6B Engine Written in Assembly Fits in 14.7 KB and Runs 18–36% Faster Than llama.cpp on CPU
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.
AI-processed from X: @cutetoxicguy; edited by Hamidun News
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.
- Nov 28, 2026Five GGUF Models on Hugging Face Found Hiding Malware: 2,400+ Downloads
- Nov 28, 2026GPU server deliveries to Russia for AI fell from thousands to dozens, with a six-month wait
- Nov 28, 2026Five GGUF Models on Hugging Face Hid a Trojan, About 2,400 Downloads
- Nov 28, 2026Sakana AI to Start Training Its Own Sawara Model: A Small Version Arrives in Early 2027
Key Questions Answered
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…
What are the key details on 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.
What are the key details on 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.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
