
What it is
Ember serves Qwen3-0.6B and Qwen3.5-0.8B on one GTX 1650 Ti laptop GPU with 4 GB of memory and no tensor cores. I wrote the model forward pass, the paged KV cache, the continuous-batching scheduler, the OpenAI-compatible streaming server and the Triton kernels myself.
On the same GPU, prompts and load generator, it gets 3.4 times the throughput of llama.cpp. Its greedy output matches Hugging Face token for token. Every number on this page links back to raw data, the exact command and the commit in an evidence log in the repo.
How it works
Per decode step the host does one copy and one graph launch. Prefill runs eagerly.
Qwen3.5 is a hybrid model: most layers are Gated DeltaNet, a linear-attention layer with a fixed-size state, and the rest are normal attention. So the cache holds two kinds of memory, KV blocks for the attention layers and a pool of state slots for the DeltaNet layers.
Some of the things I learned on the way:
- fp16 was 6 times slower than fp32 on this GPU. It has no tensor cores. I measured it, then stored the weights in fp16 and did the math in fp32, converting in registers inside a custom Triton GEMM. That left 5.8 times more memory for the KV cache.
- A latency tail that was the compiler. One Triton kernel took a per-step value as a compile-time constant, so it recompiled itself (about 1 second) in the middle of serving. A per-step trace found it. The p99 time to first token at light load went from 1,435 ms to 775 ms.
- Profiling killed the planned kernel. Flash attention for prefill was next on my list, but attention turned out to be 3 to 6% of prefill time. Re-tiling the prefill matmuls cut long-prompt time to first token by 10% instead.
- My first DeltaNet prefill kernel was 4 times slower than PyTorch because of register spills. A sweep over compiled kernel shapes found one without spills. The second version is 2.6 to 6.3 times faster per layer.
Results
Qwen3-0.6B, same GPU, same 32 prompts per point, same client. llama.cpp ran in fp16 with its best setting on this GPU (8 parallel slots).
| Ember | llama.cpp | |
|---|---|---|
| Chat, offline throughput | 466 tok/s | 135 tok/s |
| Long prompts (~520 tokens), offline throughput | 139 tok/s | 41 tok/s |
| Time per output token, chat at 0.25 req/s (p50) | 14.7 ms | 28.2 ms |
| Highest chat load meeting the SLO (p99 TTFT ≤ 2 s, p99 TPOT ≤ 100 ms) | ≥ 2 req/s | 1 req/s |
| First-token latency, long prompts at 0.5 req/s (p50) | 337 ms | 135 ms |
llama.cpp still wins first-token latency at light load. Its fp16 prefill is faster than my fp32-compute design allows on this GPU.
How each milestone moved the same chat workload:
| Milestone | What changed | Offline throughput | p99 TTFT at 0.25 req/s |
|---|---|---|---|
| M2 | Static batching, fp32 | 47 tok/s | 25.1 s |
| M3 | Paged KV cache and continuous batching | 90 tok/s | 0.52 s |
| M4 | Paged-attention kernel, CUDA graphs, K-major matmuls, fused DeltaNet | 466 tok/s | 0.66 s |
The M4 changes took the Qwen3.5 decode step from 69 to 96 ms down to 14 to 26 ms. CUDA graphs alone took a single-row step from 74 ms to 16 ms.
Correct before fast
- The Qwen3 and Qwen3.5 forward passes match Hugging Face transformers bit for bit in fp32. 50 of 50 golden prompts give identical greedy tokens through the full serving engine, including when requests are preempted.
- The fused DeltaNet prefill kernel adds in a different order, so its logits are within 1.4e-4 of Hugging Face. The greedy tokens are the same, and the PyTorch path stays bit-exact.
- 395 tests in four tiers: CPU unit, integration, GPU kernels and real-weight golden tests. A gate script runs them before every push, and the scheduler has property tests with Hypothesis.
- Benchmarks are interleaved A/B repeats with ranges. Baselines run from git worktrees at their own commits, and I report regressions next to wins.
Limits
- One early Qwen3.5 serving run failed and I couldn’t explain why. It hasn’t happened again in dozens of runs since, but I don’t claim Qwen3.5 serving is stable yet.
- Everything is measured on one GPU. Prefix caching, chunked prefill, speculative decoding and quantization are planned and not built.
Stack
Python 3.12, PyTorch, Triton, CUDA graphs, FastAPI, safetensors, Hypothesis, uv, WSL2.