QEngine

Built and tested on one home machine. If QEngine helps you, a coffee keeps it going.
QEngine is an open-source (MIT) inference engine for five models on NVIDIA RTX 3000, 4000 and 5000 series cards, with
nothing extra to install or set for any of them (tuned on the RTX 3090):
- Qwen3.8-Flash-Next, run from my checkpoint bpx03/Qwen3.8-Flash-Next-QEngine
(routed experts INT4 from Intel's AutoRound quantization, repacked bit-exact; the parts every token passes through in
INT8 or calibrated INT4): a sparse mixture-of-experts model with 512 routed experts, 262K
context (up to 1M opt-in) and image input. Runs on 2 or more cards (tuned for 3 and 2).
- Qwen3.8-27B (INT4, the RedHatAI W4A16 checkpoint RedHatAI/Qwen3.8-27B-INT4
plus its MTP head; INT8 opt-in: bpx03/Qwen3.8-27B-INT8-QEngine): a dense model with 262K context (up to 1M
opt-in, with optional sparse attention for long prompts) and image input. Tuned for 3 cards, also runs on 2, and on 1 as an experiment.
- DeepSeek-V4.1-Flash (preview), run from the third-party Maya-S GGUF files as they are
(peasantsmith/DeepSeek-V4.1-Flash-1017-Maya-GGUF): a large sparse
mixture-of-experts model (384 routed experts per layer, Engram n-gram memory, compressed sparse attention) on three
24 GB cards plus about 170 GB of host RAM, with a DSpark draft model, 262K context. RTX 3000 / 4000 series only.
- GLM-5.3-Flash (preview), run from my INT4 quant bpx03/GLM-5.3-Flash-INT4-QEngine
(routed experts and KDA layers): a sparse mixture-of-experts
model (288 routed experts per layer, 8 active) on three 24 GB cards plus about 192 GB of host RAM, with the experts in
host RAM and a CPU expert lane next to the cards, MTP drafts, 262K context.
- gpt-oss-120B (preview), run from OpenAI's official checkpoint as it is,
openai/gpt-oss-120b (MXFP4 experts): a sparse
mixture-of-experts model (128 experts per layer, 4 active) on three 24 GB cards, all in VRAM, 128K context, up to 8
conversations decoded together. RTX 3090-class cards (compute capability 8.6) only.
One server serves any of them through an OpenAI-compatible and an Anthropic-compatible API (it works with
agent clients such as Claude Code). The C++/CUDA engines are built as shared libraries; the Python server loads them
and handles the API, tool calls, structured output, scheduling and caching.
Measured on my machine (3× RTX 3090, 24 GB, PCIe 4.0 x16, GPU P2P on), QEngine 1.5.0 with its default settings
and the club-3090 benchmark tools (November 19, 2026):
| output tok/s unless noted |
Qwen3.8-27B |
Qwen3.8-Flash-Next |
DeepSeek-V4.1-Flash |
GLM-5.3-Flash |
gpt-oss-120B |
| single-stream decode, narrative / code |
275 / 524 |
310 / 452 |
88 / 120 |
110 / 92 |
301 / 301 |
| prefill, 10K-token prompt: tok/s, time to first token |
6,188, 1.60 s |
8,254, 1.23 s |
4,217, 2.35 s |
2,920, 3.42 s |
13,280, 0.74 s |
| prefill, 90K-token prompt: tok/s, time to first token |
4,994, 18.0 s |
8,390, 10.5 s |
4,895, 17.8 s |
3,572, 25.4 s |
5,055, 17.6 s |
| total output, 1 / 4 / 8 / 16 streams at once |
312 / 575 / 848 / 999 |
300 / 642 / 880 / 1,061 |
70 / 73 / 78 / 78 |
72 / 55 / 50 / 44 |
306 / 594 / 731 / 835 |
| model |
weights |
quality against a reference |
| Qwen3.8-27B |
INT4 W4A16, group 128 (RedHatAI) plus its MTP head |
next-token KL 0.0154 against BF16, top-1 agreement 95.3 % |
| Qwen3.8-Flash-Next |
routed experts INT4 (Intel's AutoRound, repacked bit-exact); shared expert and dense parts INT8 or calibrated INT4; DeltaNet projections INT8 |
next-token KL 0.114 against BF16, top-1 agreement 89.6 % |
| DeepSeek-V4.1-Flash |
the Maya-S GGUF files as they are: experts IQ2_XXS / IQ2_S / IQ3_XXS / IQ3_S, dense Q8_0, Engram Q6_K |
negative log-likelihood 1.635 on my test texts (no full-precision reference fits on this machine) |
| GLM-5.3-Flash |
my INT4 quant: routed experts and KDA layers INT4 (details) |
next-token KL 0.59 against the official FP8 model (three prompts: 0.45-0.77) |
| gpt-oss-120B |
OpenAI's checkpoint as it is: MXFP4 experts, bf16 dense weights |
next-token KL 0.118 against an fp32 reference of the model, top-1 agreement 86.9 % |
(Single-stream decode: club-3090 bench.sh with each model's own sampling; streams: its concurrency-probe.sh,
greedy, 256-token prompts and replies, total output of all streams; each number is the mean of 2 to 6 runs. The two
Qwen servers ran with thinking on at effort low and vision on. For 16 streams the servers that hold 8 conversations
by default were started with 16: GLM_CONVS=16, DeepSeek-V4.1-Flash --max-active 16, GPTOSS_SLOTS=16.
DeepSeek-V4.1-Flash and GLM-5.3-Flash decode one conversation at a time and give the streams turns, so their total
output stays at about one stream's. gpt-oss-120B at 90K: prompts of 86,786 and 89,998 tokens. Quality: the same
builds; the 8-pack results are below.)
Flash-Next quality, in more detail: next-token KL divergence against the official BF16 model on the public set
jyohukuchan/qwen38-flash-next-bf16-logits,
scored with its own compare.py: mean KL 0.114, top-1 agreement 89.6 %, WikiText-2 KL 0.125 (0.126 when
the context went through batched prefill). 1.5.0 build, November 19, 2026, the same as 1.3.6 to every digit; details
and the command under Quality.
What is new in 1.5.1 (stable, latest; it also holds everything from 1.5.0 below): two Flash-Next fixes.
FLASH_CKPT=0 no longer crashes the server (SIGFPE) when a checkpoint is planned at the point where two prompts
diverge (#41), and after a pinned prefix is dropped (pin budget or
host-memory pressure) the archive goes back under its budget at once (#40).
The other models are unchanged. Checked with the same greedy output and speed as 1.5.0; the release checks and the
numbers on this page are from 1.5.0 (release notes).
What is new in 1.5.0:
Three new models, as previews, in the same server, API and Docker image as the two Qwen models (what each one
supports: Feature matrix):
- DeepSeek-V4.1-Flash, run from the Maya-S GGUF files as they are, on three 24 GB
cards plus about 170 GB of host RAM: 262K context, DSpark drafts, thinking, tool calls and structured output, a
host-RAM archive and shared system prompts for agent teams. 88 / 120 tok/s single-stream (narrative / code), a
90K-token prompt in 17.8 s, 8-pack 122 / 133 of 150 (thinking off / on).
- GLM-5.3-Flash, run from my INT4 quant, on three 24 GB cards plus about 192 GB of host
RAM, with the experts in host RAM and a CPU expert lane next to the cards: 262K context, MTP drafts, logprobs, up
to 8 conversations at once by exact time slicing. 110 / 92 tok/s single-stream, a 90K-token prompt in 25.4 s,
8-pack 121 / 133 of 150.
- gpt-oss-120B, run from OpenAI's checkpoint as it is, all in VRAM on three 24 GB cards,
with or without GPU P2P: 128K context, up to 8 conversations decoded together, lookup drafts, presence /
frequency penalties. 301 tok/s single-stream, 835 tok/s total with 16 streams, a 10K-token prompt in 0.74 s and a
90K-token prompt in 17.6 s, 8-pack 110 / 116 of 150 (reasoning effort low / medium).
27B: the first token comes much sooner with many agents at once. The 27B used to keep half of the GPU time for
running replies however many requests waited for their prompt. Now the time split follows the queue: short prompts
are prefilled back to back with one decode step between passes, long ones share the time by head count, and running
replies keep at least 10 % of it (--prefill-share-min, --prefill-short; --prefill-share-min 0.5 gives the old
split). It counts a running reply at admission by its max_tokens, and no longer copies a whole conversation to the
host archive when the next turn only replaces the last reply. On my 2 cards, in an agent replay with short tool
results, the median time to the first token at 16 agents in flight went from 4.5 s to 0.86 s, with 7 % more total
output; single-stream speed is unchanged (numbers). Beyond its 16 decode seats a request is
prefilled on one of two seats kept for prompts, gets its first token, and its reply waits parked in host memory (KV
and state, resumed exactly where it stopped) until a decode seat frees (--park, --park-reserve; --park 0
waits for a seat first, as before). Archived conversations keep two recurrent-state checkpoints instead of four
(QE_ARCH_SUBS), so the host archive holds about 1.5 times as many agents. At 32 and 64 agents in flight with the
defaults on 2 cards (release build): median first token 1.0 / 0.48 / 1.0 s at 16 / 32 / 64 agents in flight, with
243 / 359 / 285 tok/s total output and no agent's prompt computed again. QE_MAX_SEQS=32 (opt-in) seats 32 conversations on 2 and 3 cards: at 32 agents in flight
on 2 cards the median first token went from 25 s to 0.48 s with 106 % more total output, at the cost of a smaller
KV pool (2 cards: 417,792 tokens instead of 623,616, so two very long conversations no longer fit at once).
Flash-Next: the first token comes much sooner with several agents at once. Every prompt now keeps the state at
its own end, so an agent's next turn resumes there even when the client sends back another text for the reply or
drops its reasoning; before, a turn shorter than 4,096 tokens was recomputed on the next turn (about a third of
all prefill work in an agent replay). A conversation keeps three recurrent states instead of six (its system end,
its latest prompt end and the newest other one; FLASH_CKPT_KEEP=6 as before), so the host archive holds 64
agents. On 3 cards the time split follows the queue as on the 27B: while short prompts are next, running replies
get 10 % of the time after every prefill pass instead of half (--prefill-share-min; 2 cards and mode B keep the
fixed split). In an agent replay with short tool results the median time to the first token went from 0.16 / 0.44
/ 1.91 / 3.93 s to 0.13 / 0.25 / 0.37 / 2.83 s at 1 / 4 / 16 / 32 agents in flight, with 15 / 14 / 16 / 10 % more
total output (numbers). Beyond the 16 decode seats Flash-Next now parks as the 27B does
(--park, on 3 cards in tp mode): a reply gets its first token from one of 4 seats kept for prompts, waits in
host memory and resumes exactly where it stopped when a seat frees. At 32 / 64 agents the median time to the
first token went from 2.83 / 8.0 s to 0.26 / 0.75 s, with 5 / 9 % more total output.
Flash-Next: no more stops at a slot hand-off when the host is short of memory
(#32, #25). The
engine's log lines go through a writer thread, so a slow log reader can no longer hold up a GPU step
(QE_LOG_ASYNC); the archive's memory is pinned in the background only while the engine is idle, 1 GB at a time,
and pinning pauses (and backs off) when a registration is slow, which is a sign of host memory pressure. Thanks to
cristianflorett, dgaglioni and gbinka for the reports and measurements behind the Flash-Next hand-off fix (#32, #25).
Both Qwen models give memory back when other programs squeeze the host while they serve. A background thread
watches the kernel's memory-pressure and swap-in counters next to MemAvailable; under pressure the engine stops
growing, frees archive memory, shrinks the archive, drops pinned prompts and, last (Flash-Next), moves the n-gram
table to the page cache, one logged stage at a time, and it returns slowly once the host stays calm (QE_MEMP=0
turns it off; details). With 179 GB taken by another program on my machine,
Flash-Next went down to the last stage and served every request, with the same greedy text.