llm.asm: LLM Inference and Training in Pure x86-64 Assembly
GitHub Open Source
Run Qwen3-0.6B inference, boot a bare-metal OS, and train Mini-GPT in pure x86-64 NASM assembly.
Repository snapshot
- Repository: alesha-pro/llm.asm
- Language: Assembly
- License: MIT
- Stars: 2 225
- Forks: 338
Daily open-source picks: GitHub Open Source on Telegram
What it is
llm.asm is a collection of complete machine learning projects written entirely in pure x86-64 NASM assembly. It contains zero C, zero C++, zero Rust, and zero library dependencies, relying instead on hand-written assembly for every math kernel, AVX2 optimization, tokenizer, and thread pool.
Why it matters
Modern machine learning overwhelmingly relies on massive software stacks and heavy runtimes. By implementing transformer operations directly at the metal level, this project demonstrates extreme performance optimization and minimal footprint execution, achieving fast decode speeds and tiny binary sizes.
Key features
- Assemble a Qwen3-0.6B inference engine in a 14 KB static Linux ELF binary
- Boot a 24 KB bare-metal OS running Qwen3-0.6B with zero disk requirements
- Train a Mini-GPT model from scratch with a live 80x24 Braille TUI in a 32 KB binary
- Execute AVX2, FMA, and F16C accelerated GEMM/GEMV math kernels without external libraries
- Run multi-turn chat sessions utilizing a custom contiguous head-major KV cache
Quick start
Clone the repository and build the projects using make:
git clone https://github.com/alesha-pro/llm.asm.git
cd llm.asm
make allWho should try it
Systems programmers, operating system developers, and assembly enthusiasts who want to explore the absolute limits of low-level machine learning execution.
Verdict
A brilliant engineering artifact that proves machine learning models can run on raw hardware without traditional runtime bloat.
Continue exploring
Get the next pick in Telegram: Follow GitHub Open Source
Curated from the repository README and metadata. No hands-on test is claimed; evaluate it in a sandbox before production use.