C++/CUDA single-GPU inference engine for Qwen3.8 (incl. Qwen3.8-Flash-Next with offloaded experts) on the RTX 5090; grew from NInfer
C++
98
1,194 commits
updated Oct 12, 2026
AI disclaimer: Everything added to this engine since it forked from NInfer, including most of this README, was written with AI (mostly Claude Opus 5.5, Qwen3.8-27B running on Infernix, plus a few other AI systems I’ve been testing). It is likely to be neither complete nor entirely accurate. This is hobby development.
Infernix is a C++/CUDA inference engine that serves Qwen models on a single NVIDIA
RTX 50-series GPU (tuned on the RTX 5090). It began as a fork of
NInfer by Neroued and has grown
into its own engine; it reads NInfer's .ninfer artifacts as well as its own .infernix files.
Qwen3.8-Flash-Next has 24,576 routed experts (63 GiB at NVFP4), far more than a 32 GB GPU holds. Infernix keeps the experts in pinned system RAM, caches the hot ones in VRAM, computes part of each layer's cache misses on the CPU while the rest cross PCIe, and reads the 52 GB n-gram embedding table from an NVMe drive.
Setup and tuning: the Qwen3.8-Flash-Next guide.
vq2 and k4v2 formats hold three to four times the context of INT8.--tolerant-tool-calls), calls stranded in unclosed thinking recovered, and calls an answer only
quotes in Markdown code kept as text.--reasoning-loop).--prefix-cache-save-mins), and on Qwen3.8-Flash-Next a failed expert read fails only the
requests running at the time, not the server./v1/decide: decisions read from token probabilities (yes/no, choice, score, number, point,
box).int8, bf16, fp8, nvfp4, k8v4, vq2 and k4v2.One machine: an RTX 5090 (32 GB) in a PCIe Gen5 x8 link, a Core i9-13900K, 96 GB of DDR5 and
Windows 11. At Gen5 x16 speeds are likely to be higher, most of all for Qwen3.8-Flash-Next, whose
expert-cache misses cross PCIe on every token. Each engine runs as its own OpenAI-compatible server
and is driven by the same client. The agentic replay
(bench/agentic_ab) interleaves three coding-agent sessions and
eleven subagents with tool calls, compactions, retries and aborts, up to eight requests in flight,
sampling at temperature 1.0; cells are means over seeds with the range in brackets.
Infernix runs the Dense8 conversion of NVIDIA's checkpoint; Strata runs Unsloth's
Qwen3.8-Flash-Next-UD-Q4_K_XL GGUF, its native format. Both use the model's MTP drafter and INT8
KV at 262,144 tokens, so this compares each engine as it is run in practice, each with its own
quantization and drafter.
Context length (one request at a time, greedy, 1,024 output tokens; Infernix 3b35ccf9,
Strata 0.1.40):
| Context | Time to first token, Infernix | Strata | Decode tok/s, Infernix | Strata |
|---|---|---|---|---|
| ~8K | 1.9 s | 12.3 s | 138.8 | 86.4 |
| ~128K | 17.9 s | 103.3 s | 136.2 | 77.2 |
| ~250K | 34.2 s | 158.1 s | 153.3 | 95.8 |
Agentic replay (three seeds, 68 requests each; Infernix 63c672e4, Strata 0.1.41):
| Metric | Strata | Infernix | Change |
|---|---|---|---|
| Average time to first token | 32.9 s (30.9-36.8) | 5.9 s (5.5-6.2) | −82 % |
| 90th-percentile time to first token | 67.8 s (62.0-75.1) | 13.3 s (12.9-13.7) | −80 % |
| Prompt tokens served from cache | 53.8 % (49.3-60.4) | 84.6 % (84.3-84.8) | +31 points |
| Prefill tok/s, requests with no cache hit | 1,423 | 5,879 | 4.1× |
| Output tok/s, one request decoding | 86 (83-88) | 125 (121-128) | +45 % |
| Output tok/s, at the run's own batching | 86 (83-88) | 143 (140-147) | +67 % |
| Tokens per round (draft acceptance) | 2.08 | 1.97 | −6 % |
| Workload wall time | 22.3 min (19.6-24.5) | 7.8 min (6.5-9.0) | −65 % |
Strata's drafts are accepted slightly more often; Infernix decodes faster because each round takes about a third less time. Both verify every draft, so drafting changes speed, not output.
Both serve NInfer's official
Qwen3.8-27B-nvfp4-NInfer artifact with
DFlash2 drafting and the same flags (NInfer master at 68c54356 with the Windows port; Infernix
a436fb5a, which also uses n-gram drafting).
Agentic replay (three seeds, 130 requests each):
| Metric | NInfer | Infernix | Change |
|---|---|---|---|
| Average time to first token | 5.7 s (4.9-7.0) | 2.7 s (2.3-3.0) | −52 % |
| Prompt tokens served from cache | 83.7 % | 90.4 % | +6.7 points |
| Prompt tokens prefilled | 982K | 569K | −42 % |
| Prefill tok/s, requests with no cache hit | 6,127 | 8,254 | +35 % |
| Output tok/s, one request decoding | 199 (193-202) | 235 (220-246) | +18 % |
| Output tok/s, at the run's own batching | 249 (239-257) | 282 (276-290) | +13 % |
| Workload wall time | 16.9 min (15.1-18.9) | 12.5 min (9.9-15.7) | −25 % |
Wall time also depends on how much each run wrote: on one seed Infernix wrote 31 % more output and finished 4 % later; on the other two it wrote 24-30 % less and finished 37-41 % sooner.
Single requests with long prompts prefill 1.34-1.51× faster from 128K tokens, and decode without
speculation is level. Quality is level: on the repository's 1.04M-token perplexity corpus (16K
context, INT8 KV cache) Infernix scores 4.468 against 4.479 for NInfer (master at 81c8ce09 with
the Windows port).
Prerequisites: Visual Studio 2026 (MSVC), the CUDA 13 toolkit, and FFmpeg + curl from vcpkg
(x64-windows, at C:\vcpkg); adjust the paths at the top of build_native.bat for your machine.
build_native.bat configure
build_native.bat build
The server is build-windows\apps\Release\infernix-serve.exe, with the FFmpeg, curl and zlib DLLs
next to it. Qwen3.8-Flash-Next (see the guide):
infernix-serve.exe Qwen3.8-Flash-Next-NVIDIA-NVFP4-Dense8-Infernix-00001-of-00003.infernix --ngram-volume Qwen3.8-Flash-Next-NVIDIA-NVFP4-Infernix.ngram --kv-dtype int8 --max-context 262144 --prefill-chunk 4096 --spec mtp --draft-tokens 4 --lm-head-draft --max-concurrency 2
Qwen3.8-27B on a 32 GB RTX 5090:
infernix-serve.exe qwen3_8_27b_nvfp4-nvidia.ninfer --max-context 240000 --max-concurrency 2 --spec dflash2 --draft-tokens 7 --lm-head-draft --ngram-draft-tokens 15 --ngram-min-match 12 --kv-dtype int8 --preserve-thinking --host-context-mib 52000 --prefill-chunk 4096 --kv-capacity auto --tolerant-tool-calls
Add --prefix-cache-file PATH to keep the prefix cache across restarts. Stop the server with
Ctrl+C twice; it saves the cache and exits. infernix-serve.exe --help lists every option by
category.
Running on another PC needs an RTX 50-series GPU and an NVIDIA driver of 580 or later (CUDA 13); no
CUDA toolkit is needed. Copy the DLLs next to infernix-serve.exe and install the Visual C++
redistributable if it is missing. packaging\windows\package_release.ps1 packs the server, its
DLLs and every licence they need into a release zip
(third-party notices).
Builds and runs on 64-bit Linux, including WSL2 (tested on Ubuntu 24.04 with CUDA 13.4 and GCC
13.3). Prerequisites: a CUDA 13 toolkit, CMake 3.28 or newer, a C++20 compiler, Ninja, pkg-config,
and the FFmpeg and curl development packages:
sudo apt-get install -y build-essential cmake ninja-build pkg-config libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libcurl4-openssl-dev
cmake --preset release
cmake --build build -j
The server is build/apps/infernix-serve and takes the same options. Under WSL2 use the Windows
NVIDIA driver (do not install a Linux one inside WSL) and copy models into the Linux filesystem
first; reads through /mnt/ are slow.
--lm-head-draft.Both Flash-Next conversions use the same 52 GB n-gram volume. python -m tools.convert converts
your own checkpoints (weight conversion).
CLI, serving, Qwen3.8-Flash-Next, perplexity, performance and the documentation map.
Issues and pull requests of any kind are very welcome: bug reports, questions, measurements on other GPUs and machines (PCIe x16 results especially), fixes, features and documentation.
Infernix is developed with Claude Code. If you would like to help pay for that subscription, you can sponsor me on GitHub.
Infernix exists because of Neroued, who created NInfer and built the engine, artifact format and kernels this project grew from — thank you. Please support the creator of the original NInfer on Ko-fi. A particular thank you also to the creator of Strata (Niko1221), whose engine set the bar for Qwen3.8-Flash-Next on a single GPU, whose transcription of the model's mathematics and published measurements guided this implementation, and whose community's ideas (including wangmeng's reasoning-loop recovery and eddoursul's work on host-thread placement) shaped several features here.
Thank you as well to everyone whose issues, pull requests, forks and research Infernix has drawn on: Michael Dementii, Minnnn, DuncanBetts, Valerio Dolci, Thireus, remesis, Valeriy Selitskiy (iamwavecut), Hector Ramon Jimenez (hecrj), giveen, bingchengcc, pkochubey, paq85, Macasacker, Sha1rholder, adubkov, Gideon Zenz (gzenz), cometkim (Hyeseong Kim), Woesch-Nich, Hundsbuah, lonelystarCX, gpillon (ignis), CaptainArni, David Oelfke, Fedor Suchkov, Yunado, IST-DASLab (llmq), the authors of HyperQuant and Four Over Six, the Qwen team for the models, and NVIDIA for the NVFP4 checkpoints.
48 followers · starred Oct 2026
C++/CUDA single-GPU inference engine for Qwen3.8 (incl. Qwen3.8-Flash-Next with offloaded experts) on the RTX 5090; grew from NInfer
C++
98
1,194 commits
updated Oct 12, 2026
AI disclaimer: Everything added to this engine since it forked from NInfer, including most of this README, was written with AI (mostly Claude Opus 5.5, Qwen3.8-27B running on Infernix, plus a few other AI systems I’ve been testing). It is likely to be neither complete nor entirely accurate. This is hobby development.
Infernix is a C++/CUDA inference engine that serves Qwen models on a single NVIDIA
RTX 50-series GPU (tuned on the RTX 5090). It began as a fork of
NInfer by Neroued and has grown
into its own engine; it reads NInfer's .ninfer artifacts as well as its own .infernix files.
Qwen3.8-Flash-Next has 24,576 routed experts (63 GiB at NVFP4), far more than a 32 GB GPU holds. Infernix keeps the experts in pinned system RAM, caches the hot ones in VRAM, computes part of each layer's cache misses on the CPU while the rest cross PCIe, and reads the 52 GB n-gram embedding table from an NVMe drive.
Setup and tuning: the Qwen3.8-Flash-Next guide.
vq2 and k4v2 formats hold three to four times the context of INT8.--tolerant-tool-calls), calls stranded in unclosed thinking recovered, and calls an answer only
quotes in Markdown code kept as text.--reasoning-loop).--prefix-cache-save-mins), and on Qwen3.8-Flash-Next a failed expert read fails only the
requests running at the time, not the server./v1/decide: decisions read from token probabilities (yes/no, choice, score, number, point,
box).int8, bf16, fp8, nvfp4, k8v4, vq2 and k4v2.One machine: an RTX 5090 (32 GB) in a PCIe Gen5 x8 link, a Core i9-13900K, 96 GB of DDR5 and
Windows 11. At Gen5 x16 speeds are likely to be higher, most of all for Qwen3.8-Flash-Next, whose
expert-cache misses cross PCIe on every token. Each engine runs as its own OpenAI-compatible server
and is driven by the same client. The agentic replay
(bench/agentic_ab) interleaves three coding-agent sessions and
eleven subagents with tool calls, compactions, retries and aborts, up to eight requests in flight,
sampling at temperature 1.0; cells are means over seeds with the range in brackets.
Infernix runs the Dense8 conversion of NVIDIA's checkpoint; Strata runs Unsloth's
Qwen3.8-Flash-Next-UD-Q4_K_XL GGUF, its native format. Both use the model's MTP drafter and INT8
KV at 262,144 tokens, so this compares each engine as it is run in practice, each with its own
quantization and drafter.
Context length (one request at a time, greedy, 1,024 output tokens; Infernix 3b35ccf9,
Strata 0.1.40):
| Context | Time to first token, Infernix | Strata | Decode tok/s, Infernix | Strata |
|---|---|---|---|---|
| ~8K | 1.9 s | 12.3 s | 138.8 | 86.4 |
| ~128K | 17.9 s | 103.3 s | 136.2 | 77.2 |
| ~250K | 34.2 s | 158.1 s | 153.3 | 95.8 |
Agentic replay (three seeds, 68 requests each; Infernix 63c672e4, Strata 0.1.41):
| Metric | Strata | Infernix | Change |
|---|---|---|---|
| Average time to first token | 32.9 s (30.9-36.8) | 5.9 s (5.5-6.2) | −82 % |
| 90th-percentile time to first token | 67.8 s (62.0-75.1) | 13.3 s (12.9-13.7) | −80 % |
| Prompt tokens served from cache | 53.8 % (49.3-60.4) | 84.6 % (84.3-84.8) | +31 points |
| Prefill tok/s, requests with no cache hit | 1,423 | 5,879 | 4.1× |
| Output tok/s, one request decoding | 86 (83-88) | 125 (121-128) | +45 % |
| Output tok/s, at the run's own batching | 86 (83-88) | 143 (140-147) | +67 % |
| Tokens per round (draft acceptance) | 2.08 | 1.97 | −6 % |
| Workload wall time | 22.3 min (19.6-24.5) | 7.8 min (6.5-9.0) | −65 % |
Strata's drafts are accepted slightly more often; Infernix decodes faster because each round takes about a third less time. Both verify every draft, so drafting changes speed, not output.
Both serve NInfer's official
Qwen3.8-27B-nvfp4-NInfer artifact with
DFlash2 drafting and the same flags (NInfer master at 68c54356 with the Windows port; Infernix
a436fb5a, which also uses n-gram drafting).
Agentic replay (three seeds, 130 requests each):
| Metric | NInfer | Infernix | Change |
|---|---|---|---|
| Average time to first token | 5.7 s (4.9-7.0) | 2.7 s (2.3-3.0) | −52 % |
| Prompt tokens served from cache | 83.7 % | 90.4 % | +6.7 points |
| Prompt tokens prefilled | 982K | 569K | −42 % |
| Prefill tok/s, requests with no cache hit | 6,127 | 8,254 | +35 % |
| Output tok/s, one request decoding | 199 (193-202) | 235 (220-246) | +18 % |
| Output tok/s, at the run's own batching | 249 (239-257) | 282 (276-290) | +13 % |
| Workload wall time | 16.9 min (15.1-18.9) | 12.5 min (9.9-15.7) | −25 % |
Wall time also depends on how much each run wrote: on one seed Infernix wrote 31 % more output and finished 4 % later; on the other two it wrote 24-30 % less and finished 37-41 % sooner.
Single requests with long prompts prefill 1.34-1.51× faster from 128K tokens, and decode without
speculation is level. Quality is level: on the repository's 1.04M-token perplexity corpus (16K
context, INT8 KV cache) Infernix scores 4.468 against 4.479 for NInfer (master at 81c8ce09 with
the Windows port).
Prerequisites: Visual Studio 2026 (MSVC), the CUDA 13 toolkit, and FFmpeg + curl from vcpkg
(x64-windows, at C:\vcpkg); adjust the paths at the top of build_native.bat for your machine.
build_native.bat configure
build_native.bat build
The server is build-windows\apps\Release\infernix-serve.exe, with the FFmpeg, curl and zlib DLLs
next to it. Qwen3.8-Flash-Next (see the guide):
infernix-serve.exe Qwen3.8-Flash-Next-NVIDIA-NVFP4-Dense8-Infernix-00001-of-00003.infernix --ngram-volume Qwen3.8-Flash-Next-NVIDIA-NVFP4-Infernix.ngram --kv-dtype int8 --max-context 262144 --prefill-chunk 4096 --spec mtp --draft-tokens 4 --lm-head-draft --max-concurrency 2
Qwen3.8-27B on a 32 GB RTX 5090:
infernix-serve.exe qwen3_8_27b_nvfp4-nvidia.ninfer --max-context 240000 --max-concurrency 2 --spec dflash2 --draft-tokens 7 --lm-head-draft --ngram-draft-tokens 15 --ngram-min-match 12 --kv-dtype int8 --preserve-thinking --host-context-mib 52000 --prefill-chunk 4096 --kv-capacity auto --tolerant-tool-calls
Add --prefix-cache-file PATH to keep the prefix cache across restarts. Stop the server with
Ctrl+C twice; it saves the cache and exits. infernix-serve.exe --help lists every option by
category.
Running on another PC needs an RTX 50-series GPU and an NVIDIA driver of 580 or later (CUDA 13); no
CUDA toolkit is needed. Copy the DLLs next to infernix-serve.exe and install the Visual C++
redistributable if it is missing. packaging\windows\package_release.ps1 packs the server, its
DLLs and every licence they need into a release zip
(third-party notices).
Builds and runs on 64-bit Linux, including WSL2 (tested on Ubuntu 24.04 with CUDA 13.4 and GCC
13.3). Prerequisites: a CUDA 13 toolkit, CMake 3.28 or newer, a C++20 compiler, Ninja, pkg-config,
and the FFmpeg and curl development packages:
sudo apt-get install -y build-essential cmake ninja-build pkg-config libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libcurl4-openssl-dev
cmake --preset release
cmake --build build -j
The server is build/apps/infernix-serve and takes the same options. Under WSL2 use the Windows
NVIDIA driver (do not install a Linux one inside WSL) and copy models into the Linux filesystem
first; reads through /mnt/ are slow.
--lm-head-draft.Both Flash-Next conversions use the same 52 GB n-gram volume. python -m tools.convert converts
your own checkpoints (weight conversion).
CLI, serving, Qwen3.8-Flash-Next, perplexity, performance and the documentation map.
Issues and pull requests of any kind are very welcome: bug reports, questions, measurements on other GPUs and machines (PCIe x16 results especially), fixes, features and documentation.
Infernix is developed with Claude Code. If you would like to help pay for that subscription, you can sponsor me on GitHub.
Infernix exists because of Neroued, who created NInfer and built the engine, artifact format and kernels this project grew from — thank you. Please support the creator of the original NInfer on Ko-fi. A particular thank you also to the creator of Strata (Niko1221), whose engine set the bar for Qwen3.8-Flash-Next on a single GPU, whose transcription of the model's mathematics and published measurements guided this implementation, and whose community's ideas (including wangmeng's reasoning-loop recovery and eddoursul's work on host-thread placement) shaped several features here.
Thank you as well to everyone whose issues, pull requests, forks and research Infernix has drawn on: Michael Dementii, Minnnn, DuncanBetts, Valerio Dolci, Thireus, remesis, Valeriy Selitskiy (iamwavecut), Hector Ramon Jimenez (hecrj), giveen, bingchengcc, pkochubey, paq85, Macasacker, Sha1rholder, adubkov, Gideon Zenz (gzenz), cometkim (Hyeseong Kim), Woesch-Nich, Hundsbuah, lonelystarCX, gpillon (ignis), CaptainArni, David Oelfke, Fedor Suchkov, Yunado, IST-DASLab (llmq), the authors of HyperQuant and Four Over Six, the Qwen team for the models, and NVIDIA for the NVFP4 checkpoints.
48 followers · starred Oct 2026