Field noteNov 8, 20266 min read1 source

qwen3_5-assembly: Qwen3.5-0.8B CPU inference written entirely in x86-64 assembly, 6.51 tok/s on one EPYC thread

In one minute

A public GitHub project implements CPU inference for Qwen3.5-0.8B in x86-64 assembly, covering tokenization through decoding and running without Python or an ML framework at runtime. Its author reports a 1.50× median decode-speed advantage over one Transformers/PyTorch setup on one CPU thread, but explicitly limits that result to two runs and one prompt.

What changed: A new Qwen3.5-0.8B CPU inference engine is implemented entirely in x86-64 assembly and reports 6.51 tokens per second on one EPYC thread.

What happened

The repository, suayptalha/qwen3_5-assembly, describes a CPU inference engine for the Qwen3.5-0.8B checkpoint on Linux x86-64. Its implementation covers Unicode normalization, the chat template, tokenizer operations, the model forward pass, sampling, and text decoding in assembly. The executable is statically linked and uses Linux syscalls directly; it does not require Python, libc, a GPU, or an ML framework at runtime. Python is used during build-time preparation of tokenizer tables and checkpoint offsets.

The project targets a specific checkpoint, rather than presenting itself as a general-purpose model loader. It reads BF16 weights and performs calculations in FP32. The model checkpoint and tokenizer tables are separate files mapped from disk, not bundled into the executable. The checkpoint download is about 1.75 GB, and the tokenizer table is about 19.4 MB. The program requires Linux x86-64 with AVX2 and FMA, plus GNU assembler/GCC and standard build and download utilities. Python 3.11 or newer is needed for build-time preparation. The code is licensed under Apache 2.0; the Qwen3.5-0.8B model has its own Apache 2.0 license.

For its benchmark, the README reports two runs on a Google Colab CPU runtime using an AMD EPYC 7B12. With one CPU thread, a 19-token prompt, greedy decoding, and 32 output tokens, the assembly implementation produced a median 6.51 tokens per second, against 4.34 for the tested Transformers/PyTorch configuration. The token IDs matched in both runs. The README defines decode speed as output tokens minus one divided by the time from the first output token to the last. It excludes first-token time because the measurement boundaries differed.

The comparison is not a like-for-like test in every implementation detail: the assembly runner reads BF16 weights and computes in FP32, while the reference loaded the BF16 checkpoint as FP32. The reference also used Transformers 5.22.2 and PyTorch 2.14.1+cpu, including PyTorch reference fallbacks for gated delta and causal convolution operations. The author cautions that this is a two-run measurement on one prompt, not a general speed claim, and notes that cache warmth and shared runtime load may affect results.

The repository includes kernel and model tests. These compare real-weight DeltaNet and full-attention layer outputs, greedy generation for three prompts, and both responses in a two-turn conversation, alongside checks for sampling, tokenization, Unicode normalization, and UTF-8 output. Exact token agreement is established only for the tested inputs. The implementation is text-only: it does not implement the checkpoint's vision encoder. Conversation state remains in memory and is lost when the process exits; old messages are not automatically dropped. The total conversation and requested output must fit within 262,144 tokens, including turn-ending tokens.

What the archive adds

New Runtime's earlier coverage of Qwenputer on 2026-11-02 described a 32-bit RISC-V CPU compiled into Qwen3.5-4B's weights. The new project is a different experiment: it writes the inference engine itself in x86-64 assembly for a small checkpoint. This is a new fact in the broader thread of unconventional ways to run Qwen models, not a restatement of the earlier implementation.

Trend signal

This supports, narrowly, the idea that the inference runtime can be a meaningful engineering boundary apart from model choice. It is not evidence that assembly is generally faster or that custom runtimes are the best production path. The relevant pattern is harness architecture outlives model choice: the project makes the execution stack itself the subject of experimentation, while keeping the model checkpoint fixed.

Why it matters

For teams building local inference, this repository is more useful as an inspectable implementation and a reminder to benchmark the whole execution path than as a ready-made optimization recommendation. It makes explicit which pieces a framework ordinarily hides: tokenization, Unicode handling, state for attention and DeltaNet layers, sampling, memory mapping, and the system-call boundary. That can help an engineer reason about what contributes to dependencies, startup and runtime behavior, and where a reference implementation may leave performance on the table.

The measured result is particularly instructive because its comparison baseline uses reference fallbacks for operations that may have more optimized implementations elsewhere. A faster result against that baseline does not establish a general CPU advantage over Transformers, much less over optimized inference engines, different processors, longer contexts, or concurrent workloads. Teams should treat the reported number as a hypothesis to reproduce under their own conditions, not a deployment forecast.

The project also clarifies the trade-off behind a minimal runtime. Removing Python and framework dependencies at runtime does not remove the model's substantial weight file, tokenizer data, memory needs, or hardware requirements. Its exact-checkpoint design and text-only scope further narrow where it can be used. For a team maintaining a fixed, small model on controlled Linux hardware, the source may offer a useful reference; for a general product runtime, flexibility, supported hardware, operational testing, and maintenance are likely more important than this single speed comparison.

Limits and uncertainty

The performance claim is not independently reproduced here and rests on two runs of one prompt on one Colab CPU. The repository itself warns that cache warmth and shared system load may affect the result; first-token latency is not compared. There is no evidence in this benchmark about longer prompts, varied contexts, throughput under concurrency, memory consumption, or performance on other CPUs. The tested reference uses PyTorch fallbacks for some operations, so the result does not establish superiority to optimized framework or inference-engine implementations. Functional agreement is likewise limited to the listed test cases. The project is tied to the exact checkpoint and does not implement vision inference.

Skill to build now

Re-run the repository's standalone timing procedure on the CPU and workload that matter to your team, recording the exact checkpoint, prompt, output length, thread count, context length, and system load. Compare against a framework configuration that uses optimized kernels where available, and measure first-token latency separately from decode throughput. Treat a two-run result as exploratory; repeat enough times to understand variance before changing a production runtime.

Reader takeaway

This is a valuable low-level reference, not a broad claim that assembly makes local inference faster. The most reusable lesson is methodological: hold the checkpoint and workload fixed, inspect what the baseline actually uses, and measure the runtime on your own hardware before treating a tokens-per-second figure as a product decision.

Evidence / sources

  1. 1github.com/suayptalha/qwen3_5-assembly
All Field Notes

Next reads

Read next

Open the graph
  1. 01topicGithubExplore the github topic hub.
  2. 02archiveField NotesOpen the latest editorial analysis.
  3. 03sourcesSourcesSee the original sources this archive cites.
Who read this page?Machine requests, hidden until opened

Loading the privacy-safe route aggregate...

Open the JSON contract