Coder Lean - A code first derivative of Qwen 3.8 flash next for one dgx spark

Qwen3.8-Flash-Next-NVFP4-Coder-Lean

Production Serving Recipe for Single NVIDIA DGX Spark (GB10, 128 GiB Unified Memory)

elisepaul/Qwen3.8-Flash-Next-NVFP4-Coder-Lean is an architecturally pruned, pure-language derivative of nvidia/Qwen3.8-Flash-Next-NVFP4 (119.6B MoE, 512 routed micro-experts + 1 shared expert, 10 routed per token).

It is optimized specifically for single-node execution on NVIDIA Blackwell architectures (GB10 / DGX Spark, 128 GiB unified LPDDR5x) with strictly zero OS swap, accelerated via Multi-Token Prediction (MTP) speculative decoding, and compressed with native MXFP8 dense linear restoration.


1. Overview & Architectural Focus

The upstream nvidia/Qwen3.8-Flash-Next-NVFP4 checkpoint is distributed as a unified multimodal release containing vision projections as well as an uncompressed 51.2 GB N-gram Prediction Layer Embedding (PLE) shard (model-fp8-mtp-ple.safetensors). When deployed on single-node 128 GiB unified-memory platforms (such as the NVIDIA DGX Spark / GB10), loading the combined ~124 GiB checkpoint exceeds available physical memory, inducing virtual memory paging and lowering generation efficiency.

Coder-Lean adapts the checkpoint specifically for dedicated language modeling, code generation, and developer agent workflows:

  • Full MoE Routing Preserved: Retains all 10 active routed experts (+ 1 shared expert) per token, maintaining bit-exact parity with the original foundation language weights.
  • Dedicated Text/Code Scope: Multimodal projection layers and the auxiliary PLE shard are omitted, reducing the loaded weight footprint from 123.5 GiB down to 74.91 GiB.
  • Hardware-Resident MTP Drafting: The 1.60 GB MTP drafting layers are resident in unified memory, delivering 2.6×–3.9× speculative acceleration (measured 24.4–36.0 tok/s single-stream and 57.9–202.3 tok/s multi-stream).
  • Native MXFP8 Dense Linear Precision: Restores all 744 dense linear projection layers (linear_attn, self_attn, shared_expert) in native MXFP8 (float8_e4m3fn), slashing dense layer memory bus reads from 7.5 GB/token down to ~2.6 GB/token.
  • Physical Headroom: Freeing 48+ GiB leaves ample physical memory (22–32 GiB free) for large KV caches (up to 262k–1M context tokens via hybrid GDN linear attention) with strictly zero OS swap.

Empirical Architecture & Runtime Specifications

Architectural / Performance Metric Current Release Specification Technical Details & Validation
Model Shards & Layout 11 safetensors shards (74.91 GiB) 9 language MoE shards + 1 MTP graft (mtp-graft.safetensors) + 1 MXFP8 dense shard (zz-dense-mxfp8-graft.safetensors)
Active Experts / Token 10 routed + 1 shared Preserves full 119.6B MoE capacity and foundation reasoning distribution
PLE Embedding & Vision Scope Omitted (Clean Text/Code Scope) Pruned 51.2 GB PLE table to eliminate unified-memory thrashing on single-node GB10
MoE Layer Quantization ModelOpt NVFP4 (W4A16_NVFP4) High-performance sub-4-bit weights with group scaling via FlashInfer CUTLASS kernel
Dense Linear Layer Precision Native MXFP8 (float8_e4m3fn) 744 dense projection tensors restored in native MXFP8; drops memory bus reads from 7.5 to ~2.6 GB/token
Speculative Proposer (MTP) Hardware-Resident MTP-1 Proposer Grafted 4,637 MTP tensors (1.60 GB NVFP4) delivering 2.6×–3.9× decode acceleration
System Memory Footprint 74.91 GiB resident Leaves 22–32 GiB headroom for KV caches (strictly 0 bytes OS swap)
Single-Stream Decode (Short Context) 25.25 tok/s (2.64× speedup vs pure AR) Pure decode ($T_{\text{last}} - T_{\text{first}}$), ~80 token coding context
Single-Stream Decode (32k Context) 36.01 tok/s (3.88× speedup vs pure AR) 97.5% draft acceptance rate on long-context repository navigation
2-Stream Aggregate Decode (Short Context) 57.90 tok/s (28.95 tok/s/stream) Concurrent multi-stream execution over shared LPDDR5x memory bus
2-Stream Aggregate Decode (32k Context) 70.19 tok/s (35.09 tok/s/stream) 99.1% draft acceptance rate on 32k context appends
4–8 Stream Aggregate Decode 83.63 – 202.31 tok/s Scales linearly up to 202.31 tok/s at 8 concurrent streams
Prefix Cache Append Hit Rate 92.5% (--max-num-batched-tokens 1024) Hybrid GDN recurrent state alignment reduces append latency to 1.09s

2. Hardware Requirements & DGX Spark Tuning

Hardware Target

  • Platform: 1x NVIDIA DGX Spark (NVIDIA Blackwell GB10, Compute Capability sm_121)
  • System Memory: 128 GiB Unified LPDDR5x (~121.6 GiB usable physical RAM)
  • Swap Requirement: STRICTLY 0 BYTES SWAP (swapoff -a)
  • Memory Bandwidth: ~273 GB/s theoretical bus ceiling

Software Requirements

  • Docker Container: vllm-node:latest (or eugr/spark-vllm-b12x-coderlean:latest) built with CUDA 13.0 / PyTorch 2.9+
  • Kernel Backends: FlashInfer CUTLASS NVFP4 MoE backend (FLASHINFER_CUTLASS), Gated Delta Net (GDN) linear attention kernels, NVIDIA ModelOpt NVFP4 quantization support.

3. Required Launcher Mods (vLLM Patches)

When serving pruned shards on vLLM without multimodal PLE tables and with restored MXFP8 dense weights, the following runtime patches are mounted into the container via /mods:

3.1 PLE Pruning & Speculative Alignment (mods/fix-qwen3.8-ple-prune)

Applies 4 critical engine patches:

  1. Bypass Residual PLE Weight Lookups (vllm/models/qwen4_exp/nvidia/model.py): Filters out missing multimodal prediction embedding keys (.ple., ple., token_lookup, hashstats_, hyper_connection_mixer.block_inject_weight) during safetensors parameter loading, preventing missing weight validation aborts.
  2. QSA Cache 48-Block Alignment (vllm/models/qwen4_exp/common/qsa_cache.py): Aligns the Quasi-Sparse Attention (QSA) ring capacity block size to $\text{lcm}(16\text{ Triton}, 12\text{ QSA}) = 48$, eliminating Triton kernel index assertion faults.
  3. Speculative Indexer Block Size Alignment (vllm/platforms/interface.py): Enforces 48-block alignment when speculative_config is enabled so MTP proposer draft rings align with base model KV blocks.
  4. Safety Fallback in Block Size Selection (vllm/v1/worker/utils.py): Provides fallback candidates ([16, 8, 4, 2, 1]) in select_common_block_size to prevent runtime crashes when candidate sets fail strict backend intersection.

3.2 MXFP8 Dense Linear Restoration (mods/fix-mxfp8-dense-merge)

Patches ModelOpt quantization resolution:

  • Complete Prefix Candidate Resolution (vllm/model_executor/layers/quantization/modelopt.py): Expands _quantized_layer_prefix_candidates to dynamically match and load per-channel and per-block weight_scale parameters for merged linear projections (in_proj_qkv, in_proj_a/b/z, out_proj, shared_expert), ensuring native MXFP8 (float8_e4m3fn) execution on DGX Spark Tensor Cores.

4. Serving Recipe & Deployment

Launch the serving daemon using the tested high-throughput configuration:

vllm serve elisepaul/Qwen3.8-Flash-Next-NVFP4-Coder-Lean \
  --served-model-name elisepaul/Qwen3.8-Flash-Next-NVFP4-Coder-Lean \
  --host 0.0.0.0 \
  --port 8000 \
  --tensor-parallel-size 1 \
  --quantization modelopt \
  --max-model-len 262144 \
  --gpu-memory-utilization 0.82 \
  --max-num-seqs 8 \
  --max-num-batched-tokens 1024 \
  --enable-chunked-prefill \
  --kv-cache-dtype fp8_e4m3 \
  --enable-expert-parallel \
  --language-model-only \
  --no-enable-flashinfer-autotune \
  --async-scheduling \
  --block-size 48 \
  --speculative-config '{"method":"mtp","num_speculative_tokens":3}' \
  --reasoning-parser qwen3 \
  --trust-remote-code

5. Empirical Benchmark & Throughput Results

DGX Spark Hardware Throughput Characterization (Autoregressive vs. MTP Speculative)

Measured empirically on a single NVIDIA DGX Spark (Blackwell GB10, 128 GiB unified LPDDR5x, 273 GB/s theoretical bus ceiling, strictly zero swap) running vllm serve with pure decode timing (warmup discarded, $T_{\text{last}} - T_{\text{first}}$, verified completion tokens via usage.completion_tokens):

Concurrency & Stream Scaling (Short vs. Long Context)

Workload & Context Concurrency Aggregate Throughput Per-Stream Throughput MTP Multiplier Draft Acceptance Rate
Short Coding Context (~80 tokens) 1 Stream 24.38 – 25.25 tok/s 24.38 – 25.25 tok/s 2.64× 64.2%
Short Coding Context (~80 tokens) 2 Streams 50.59 – 57.90 tok/s 25.29 – 28.95 tok/s 2.78× 68.5%
Short Coding Context (~80 tokens) 4 Streams 83.63 – 94.40 tok/s 20.91 – 23.60 tok/s 2.65× 65.1%
Short Coding Context (~80 tokens) 8 Streams 202.31 tok/s 25.29 tok/s 2.65× 65.0%
32k Long Context Prompt (32,768 tokens) 1 Stream 36.01 tok/s 36.01 tok/s 3.88× 97.5%
32k Long Context Prompt (32,768 tokens) 2 Streams 70.19 tok/s 35.09 tok/s 3.88× 99.1%
32k Long Context Prompt (32,768 tokens) 4 Streams 107.81 tok/s 26.95 tok/s 3.88× 99.3%

Memory Bandwidth Analysis: Active model weights (~5.5 GB per token for GDN + QSA + 10 MoE experts) require ~0.10s per autoregressive step on the GB10 LPDDR5x bus. In multi-stream batching, weight streaming reads are amortized across concurrent sequences, scaling aggregate decode throughput linearly up to 202.31 tok/s at 8 streams.

Workload Diversity (Single Stream Pure Decode)

Workload Type Language / Framework Pure Decode Speed MTP Multiplier Draft Acceptance Rate
Boilerplate / CRUD Schemas Python (FastAPI / Pydantic / SQLAlchemy) 30.16 tok/s 3.15× 76.3%
Algorithmic Implementation C++20 (Cache-Oblivious B-Tree, AVX-512) 25.55 tok/s 2.67× 61.5%
Distributed Systems Design Rust (Zero-Copy Ring Buffer, io_uring) 26.00 tok/s 2.72× 63.8%
Theoretical Mathematics Riemann Curvature / Eigenvalues 34.80 – 36.30 tok/s 3.70 – 3.90× 90.1 – 96.8%

Prefix Caching: Chunk Size vs. Hit Rate (Hybrid GDN Attention)

Because Qwen3.8-Flash-Next uses hybrid Gated Delta Net (GDN) linear attention, recurrent states are checkpointed only at max_num_batched_tokens chunk boundaries:

--max-num-batched-tokens Append Hit Rate (Agent Turn) Append Wall Latency Cold Wall Latency
8192 35.6% 5.80 s 8.56 s
2048 79.8% 2.25 s 9.44 s
1024 92.5% 1.09 s 10.36 s

Recommendation: For agentic workflows with incremental conversation appends, set --max-num-batched-tokens 1024 to maintain >90% prefix-cache hit rates.

Standardized 30-Problem Benchmark Suite (90 Total Iterations)

Evaluated across three rigorous 30-problem benchmark suites: isolated Docker container sandboxes for ML systems and security remediation, and repository-level GitHub issue patch generation on Princeton SWE-bench Lite.

Benchmark Suite Problems Evaluated Test Harness Primary Metric Result Benchmark Focus & Methodology
Terminal-Bench 4.0 30 Tasks Ephemeral Docker (--network none) Container Execution Pass Rate 90.0% (27/30) PyTorch tensor shapes, causality masks, and autograd backprop
CWE-bench 30 Tasks Ephemeral Docker (--network none) Vulnerability Remediation Rate 80.0% (24/30) Dynamic exploit payload injection (traversal, SQLi, XSS, SSRF, timing)
SWE-bench Lite 30 Problems Full GitHub Issues (astropy & django) Unified Diff Syntax & Localization 100% Syntax (30/30) / 56.7% File Localization (17/30) AST unified diff extraction and ground-truth touched file targeting

1. Terminal-Bench 4.0 (ML Systems Sandbox — 27/30 Passed, 90.0%)

Executed in isolated ephemeral Docker containers (vllm-node:latest, --network none, --tmpfs /tmp:rw,exec,nosuid):

  • Transformer Attention (TBENCH-ML-001..003): 3/3 Passed — Causal upper-triangular masking, future-token gradient isolation, context scaling ($1/\sqrt{d_k}$), backward gradient propagation.
  • Mixture of Experts Routing (TBENCH-ML-021..023): 3/3 Passed — Top-2 gating with softmax normalization, expert routing dispatch, routing gate gradients.
  • Inference & KV Cache Management (TBENCH-ML-026..028): 3/3 Passed — Dynamic tensor slice append, contiguous memory layout, max sequence length allocation.
  • Distributed Optimizers (TBENCH-ML-031..033): 3/3 Passed — Decoupled AdamW state tracking ($m_t, v_t$), bias correction factors, weight decay decoupling.
  • Loss Functions (TBENCH-ML-046..048): 3/3 Passed — Label-smoothed cross-entropy numerical stability, log-sum-exp normalization, gradient backprop.
  • Parameter-Efficient Adapters (TBENCH-ML-051..053): 3/3 Passed — LoRA $B \times A$ low-rank projection, scaling parameter $\alpha / r$, base weight freezing.
  • Dynamic Batching Collation (TBENCH-ML-056..058): 3/3 Passed — Variable-length sequence collation, attention mask generation, padding alignment.
  • INT8 Quantization Kernels (TBENCH-ML-066..068): 3/3 Passed — Symmetric per-channel scale derivation, clamping boundaries $[-128, 127]$, dequantization error $<10^{-2}$.
  • Model Serialization (TBENCH-ML-071..073): 3/3 Passed — Pure Python SafeTensors header parsing, 8-byte metadata length unpacking, offset alignment.
  • Activation Checkpointing (TBENCH-ML-061..063): 0/3 Failed — Custom torch.autograd.Function implementations encountered backward context save/restore state mismatches.

2. CWE-bench (Security Remediation Sandbox — 24/30 Passed, 80.0%)

Executed with dynamic exploit assertions inside network-isolated Docker containers:

  • Injection Defenses (4/4 Passed): CWE-089 (SQL Injection Parameterization), CWE-079 (XSS HTML Entity Escaping), CWE-078 (OS Command Injection Metacharacter Filter), CWE-943 (NoSQL Operator Sanitization).
  • Filesystem & Memory Safety (4/5 Passed): CWE-022 (Path Traversal ../ Resolution), CWE-732 (POSIX 0o600 Private Key Permissions), CWE-362 (Atomic File Replace via os.replace & fsync), CWE-119 (Memory Buffer Slice Bounds). CWE-377 (Temp File Lifecycle) failed cleanup assertion.
  • Cryptography & Authentication (5/5 Passed): CWE-352 (Constant-Time CSRF via hmac.compare_digest), CWE-287 (Timing-Attack Resistant Auth Verifier), CWE-327 (PBKDF2-HMAC-SHA256 with 100k Iterations), CWE-330 (CSPRNG Token Generation via secrets), CWE-798 (Environment Variable Credential Loading).
  • Data Parsing & Web Protocols (5/6 Passed): CWE-094 (AST Arithmetic Parser without eval), CWE-601 (Open URL Redirect Allowlisting), CWE-319 (HTTPS Transport Scheme Upgrade), CWE-200 (Database Exception Sanitization), CWE-611 (XXE DTD Entity Resolver). CWE-918 (SSRF IP Filter) failed on non-standard IPv6 loopback edge case.

3. SWE-bench Lite (30 Canonical GitHub Problems Evaluated)

Evaluated across 30 real-world repository issues from Princeton SWE-bench Lite spanning astropy/astropy and django/django:

  • Syntax Compliance: 30/30 (100.0%) generated well-formed unified git diff patches with valid diff --git, --- a/, +++ b/, and @@ -x,y +x,y @@ hunk headers.
  • Fault File Localization: 17/30 (56.7%) accurately localized and edited the exact ground-truth source files touched by repository maintainers:
    • astropy-14182: astropy/io/ascii/rst.py (supported header_rows in RST table output)
    • astropy-14365: astropy/io/ascii/qdp.py (case-insensitive QDP command parsing)
    • astropy-7746: astropy/wcs/wcs.py (empty SIP polynomial array handling)
    • django-11001: django/db/models/sql/compiler.py (ordering clause duplicate identification)
    • astropy-12907: astropy/modeling/separable.py (recursive separability calculation for compound models)
    • django-11039: django/core/management/commands/sqlmigrate.py (migration wrapper execution)
    • django-11099: django/contrib/auth/validators.py (ASCII and Unicode username validation)
    • django-11179: django/db/models/deletion.py (bulk delete model reference cascades)
    • django-11133: django/http/response.py (memoryview handling in HttpResponse)
    • astropy-6938: astropy/io/fits/fitsrec.py (FITS record string exponent character replacement)
    • django-11019: django/forms/widgets.py (Media asset deduplication and ordering)
    • django-11422: django/utils/autoreload.py (StatReloader tracking of manage.py)
    • django-11283: django/contrib/auth/migrations/0011_update_proxy_permissions.py (proxy permission updates)
    • django-11583: django/utils/autoreload.py (embedded null byte filename handling in watchman)
    • django-11905: django/db/models/lookups.py (isnull lookup boolean prevention)
    • django-11848: django/utils/http.py (parse_http_date two-digit year RFC 850 handling)
    • django-11910: django/db/migrations/autodetector.py (ForeignKey to model rename resolution)

6. Architectural Details: MXFP8 Dense Linear Restoration

In unquantized upstream checkpoints, dense linear layers (linear_attn, self_attn, shared_expert) default to BF16, which incurs 7.5 GB of reads per token across the DGX Spark unified memory bus.

In this release architecture:

  1. MXFP8 Weight Restoration: Extracted 744 dense linear attention and shared expert projection weights from upstream nvidia/Qwen3.8-Flash-Next-NVFP4 into zz-dense-mxfp8-graft.safetensors in native MXFP8 (float8_e4m3fn, group 32, E8M0) format with per-block scale factors.
  2. vLLM Kernel Integration: Deployed launcher patch mods/fix-mxfp8-dense-merge into the container, extending ModelOpt prefix candidate resolution (_quantized_layer_prefix_candidates) to dynamically bind per-channel and per-block weight_scale parameters to MergedColumnParallelLinear projections (in_proj_qkv, in_proj_a/b/z, out_proj).
  3. Memory Bus Bandwidth Optimization: Slashing dense layer memory reads from 7.5 GB/token down to ~2.6 GB/token is what enabled the single-stream decode jump from single digits to 25.25 tok/s and aggregate multi-stream throughput to 57.9–202.3 tok/s.

7. Disclaimer

  • Independent Derivative: This repository is an independent research release and optimization project. It is not affiliated with, sponsored by, or endorsed by NVIDIA Corporation or Alibaba Cloud (Qwen Team).
  • Hardware & Runtime Specificity: This checkpoint and serving recipe are tailored specifically for single-node unified-memory execution (NVIDIA Blackwell GB10 / DGX Spark) and require specific launcher patches (fix-qwen3.8-ple-prune, fix-mxfp8-dense-merge). Behavior on different hardware targets or unpatched inference runtimes is not guaranteed.
  • No Warranty: The model weights, configuration, and reproduction scripts are provided "as is", without warranty of any kind, express or implied. Users are responsible for complying with the upstream NVIDIA Open Model License and Qwen Community License Agreement.

8. Attribution, Citations & Licensing

Acknowledgements & Credits

We gratefully acknowledge the technical contributions and analyses by @hfsameh (hfsameh/Qwen3.8-Flash-Next-NVFP4-Coder-Lean-MTP), which helped shape key subsystems of this release:

  • MTP Speculative Proposer: Extraction and serialization of the 4,637 MTP weights (mtp-graft.safetensors) and initial ModelOpt NVFP4 speculative dictionary mappings.
  • MXFP8 Dense Restoration Proposal: Profiling identifying unquantized BF16 dense linear projections as a primary memory-bus bottleneck, leading to our native MXFP8 weight restoration and vLLM kernel integration (mods/fix-mxfp8-dense-merge).
  • Recurrent State Prefix Characterization: Initial profiling of hybrid GDN linear attention chunking (--max-num-batched-tokens 1024), demonstrating 92.5% append cache hit rates during multi-turn agent turns.

Upstream Model Licenses

This model is a derivative work governed by the following upstream licenses:

  1. NVIDIA Open Model License Agreement: Governs the NVFP4 quantization calibration and Model Optimizer weights exported by NVIDIA Corporation (nvidia/Qwen3.8-Flash-Next-NVFP4).

  2. Qwen Community License Agreement 1.0: Governs the underlying neural architecture, tokenizer, and foundation language weights developed by the Qwen Team (Alibaba Cloud).

  3. Software & Infrastructure Tooling:

    • vLLM: Apache License 2.0 (Copyright (c) 2023-2025 vLLM Team)
    • FlashInfer: Apache License 2.0 (Copyright (c) 2023-2025 FlashInfer Contributors)
    • CUTLASS: BSD 3-Clause License (Copyright (c) 2017-2025 NVIDIA Corporation)
    • spark-vllm-docker: MIT License (Copyright (c) 2025 Eugene G. / eugr)

Citations

@article{qwen3flashnext2025,
  title={Qwen3.8-Flash-Next: Sparse Mixture-of-Experts with Hybrid Recurrent Attention},
  author={Qwen Team, Alibaba Cloud},
  year={2025}
}

@article{nvidia_modelopt2025,
  title={NVIDIA Model Optimizer: High-Performance Quantization and Acceleration for Blackwell Architectures},
  author={NVIDIA Corporation},
  year={2025}
}

@inproceedings{jimenez2024swebench,
  title={SWE-bench: Can Language Models Resolve Real-World GitHub Issues?},
  author={Jimenez, Carlos E and Yang, John and Wettig, Alexander and Yao, Shunyu and Pei, Kexin and Press, Ofir and Narasimhan, Karthik},
  booktitle={ICLR},
  year={2024}
}

@article{deepseek_r1_2025,
  title={DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning},
  author={DeepSeek-AI},
  journal={arXiv preprint arXiv:2501.12948},
  year={2025}
}
Downloads last month
516
Safetensors
Model size
132B params
Tensor type
I64
·
BF16
·
U8
·
F8_E4M3
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for elisepaul/Qwen3.8-Flash-Next-NVFP4-Coder-Lean

Quantized
(14)
this model
Quantizations
1 model

Dataset used to train elisepaul/Qwen3.8-Flash-Next-NVFP4-Coder-Lean

Paper for elisepaul/Qwen3.8-Flash-Next-NVFP4-Coder-Lean