Ling-3.0-flash — NVFP4 (weight-only, mixed precision)

A 4-bit NVFP4 quantization of Ling-3.0-flash, produced with qstream. The routed MoE experts (~95% of the weights) are quantized to NVFP4; everything quality-sensitive stays BF16.

The original model card follows in full below.

Speculative decoding (MTP) needs specific flags and a vLLM patch

It works well — 56.5% acceptance, 2.70 tokens per decode step (94.3% at draft position 0) — but NVFP4 needs more setup than the MXFP4 build does:

--kernel-config '{"moe_backend":"marlin"}'   --max-num-seqs 256

plus the unquantized.py patch in vllm_patch/. Why each is needed:

  • marlin is the only MoE backend supporting weight-only NVFP4A16. triton is rejected outright; cutlass and flashinfer_cutlass reject the scheme (QuantKey(u8,scale(f8e4m3fn,...))).
  • The patch exists because moe_backend is a single global setting, while this checkpoint has two MoE kinds: NVFP4 routed experts (need marlin) and the BF16 MTP layer (marlin has no unquantized kernel → moe_backend='marlin' is not supported for unquantized MoE). The patch routes unquantized MoE to Triton, mirroring the existing humming precedent. Triton also avoids FlashInfer TRT-LLM's grouped-routing kernel, which is warp-limited to 32 experts per group — Ling-3.0 has 64 (512 experts / 8 groups) and either crashes there or silently mis-routes.
  • --max-num-seqs 256 — the BF16 MTP head takes ~6 GB, shrinking the KDA state cache below the default 1024 sequences, so CUDA graph capture aborts with max_num_seqs (1024) exceeds available Mamba cache blocks (684).

Acceptance by draft position (conditional): 94.3% / 57.2% / 39.7%. The falloff is expected — Ling-3.0 has a single MTP layer re-run per speculative token — so num_speculative_tokens: 2 may beat 3 on net throughput. MTP also roughly doubles cold start: the draft loader re-reads the whole checkpoint to extract one layer.

With all of the above, graph capture succeeds and --enforce-eager is not needed. If you served this checkpoint before 2026-08-05, re-pull config.json — the earlier one let the layer-agnostic targets regex claim the MTP layer's BF16 experts as NVFP4, giving a silently broken drafter (0% acceptance, no error).

Size 81.4 GB (down from 255.0 GB BF16 source, ~32%)
Format compressed-tensors nvfp4-pack-quantized (E2M1 4-bit + FP8-E4M3 group-16 scales + per-tensor global scale)
Base Ling-3.0-flash — 124B total / 5.1B active hybrid-linear MoE; 42 layers stacked 5:1 as 35 Kimi-Delta-Attention (KDA) + 7 gated-MLA; 512 routed experts top-8 + 1 shared; 2 dense layers; 1 MTP layer; 256K context

Which build should you use?

Most people should take the MXFP4 build instead. NVFP4 reconstructs the weights substantially more faithfully, and that advantage does not show up downstream:

MXFP4 NVFP4 (this repo)
Size 77.6 GB 81.4 GB
Median weight rel. error 0.111618 0.086498 (−22.5%)
GSM8K 5-shot, full 1319, flexible-extract 84.38% ±1.00 83.17% ±1.03
GSM8K 5-shot, full 1319, strict-match 78.85% ±1.12 78.39% ±1.13

Both GSM8K gaps are under 1.2σ — the two builds are statistically indistinguishable on this benchmark despite NVFP4's much lower weight error. At this magnitude, 4-bit reconstruction error is already below what GSM8K can resolve. NVFP4 is published for comparison and for anyone wanting the more faithful weights (e.g. for longer-generation or harder tasks where the difference may still surface); MXFP4 is the smaller, better- tested release.

What is quantized to what

Component Precision Why
Routed experts, layers 2–41 (model.layers.N.mlp.experts.E.{gate,up,down}_proj) NVFP4 (4-bit) 120.8B of 127.4B params — the only place worth the size win
Shared expert (mlp.shared_experts.*) BF16 active on every token; quantizing it costs ~half the quality loss for <1% of the size
Attention — KDA (q/k/v/f/g/b_proj, conv1d, A_log, dt_bias) and gated MLA (kv_a/kv_b, dense) BF16 the KDA gating projections feed a softplus/sigmoid decay gate and are the most precision-sensitive tensors in the model
Router gate + expert_bias, dense MLP (layers 0–1) BF16 routing decisions are discrete; a perturbed router changes which experts fire
MTP layer 42 (incl. its own 512 experts) BF16 speculative-decoding draft path — see the MTP warning above
Embeddings, lm_head, all norms BF16 unchanged

61,440 tensors quantized (40 layers × 512 experts × 3 projections), each with a packed weight, an FP8-E4M3 group scale and a per-tensor global scale.

Fidelity

Weight-reconstruction relative error, 960-tensor stratified sample (24 per layer, expert ids strided across the full 512 range, all 40 layers):

min p25 median p75 p95 max std
0.086332 0.086459 0.086498 0.086556 0.086652 0.086742 0.000073

NVFP4's worst sampled tensor (0.0867) is better than MXFP4's best (0.1099) — the two distributions are disjoint. Two effects compound: group 16 rather than 32 halves how many weights share a scale, and FP8-E4M3 scales are continuous where MXFP4's E8M0 scales are powers of two, so an MXFP4 block whose ideal scale falls between 2^k and 2^(k+1) must round and waste up to 2× of range.

Known issues

  1. MTP / speculative decoding: 0% acceptance — see the warning above. Serve without --speculative-config.
  2. MTP also breaks CUDA graph capture (gdn_attn.py:382CUDA error: invalid argument). Without a draft model, capture succeeds and --enforce-eager is not needed.
  3. The MTP draft loader re-reads the entire checkpoint to extract one layer — two full weight-loading passes of near-identical duration at startup. Costs I/O, not VRAM.
  4. NVFP4 needs qstream ≥ the _prune_ignore fix. Earlier qstream generalised ignore entries by layer index, so excluding the MTP layer emitted re:.*layers\.\d+\.mlp\.experts\.\d+\.gate_proj$ — which also ignored the quantized experts in all 40 other layers. vLLM checks should_ignore_layer before target matching, so every expert silently resolved to unquantized and the loader tried to allocate BF16 buffers for ~242 GB of weights (OOM with no useful error). The config.json in this repo is already correct.

Serving with vLLM

Ling-3.0 (BailingMoeV3ForCausalLM, model_type: bailing_hybrid) needs the vendor fork inclusionAI/vllm, branch ling_3_0. (The base model card points at inclusionAI/vllm-ling-v3, which does not exist.) Upstream vLLM has only BailingMoe / V2 / V2.5.

Required: the MoE clamp patch

Ling-3.0 declares a per-layer clamped SwiGLU (expert_swiglu_limit_list = [0]*35 + [4]*7, so layers 35–41 clamp at 4). vLLM's compressed-tensors MXFP4/NVFP4 MoE path drops that clamp: the quant method never reads layer.swiglu_limit, the quant-config builder has no parameter to receive it, and run_cutlass_moe_mxfp4 calls apply_moe_activation() with no clamp argument. The result is unclamped SwiGLU on layers 35–41 — the divergence is large, not marginal (gate=10 gives silu(10)*2 = 20.0 versus silu(4)*2 = 7.84).

Apply the three files in vllm_patch/ over the fork before serving; they are pure Python, so an editable install needs no rebuild. See vllm_patch/README.md.

Launch (Docker)

A prebuilt runtime image carrying the fork, both patches and flashinfer-jit-cache. NVFP4 + MTP requires the nvfp4 tag or newer latest — earlier images lack the unquantized MoE oracle patch and will fail to start with moe_backend='marlin' is not supported for unquantized MoE. (The image itself is model-agnostic and serves both builds; the tag just marks the build that added this.)

Weights are pulled from the Hub, so mount a cache directory on a volume with ≥85 GB free (without it the download lands in the container's writable layer and will fill your root filesystem):

docker run --gpus all -d --name ling3 --ipc=host -p 8000:8000 \
  -e HF_HOME=/hf -v /path/with/85GB/free:/hf \
  olkafi/vllm-bailing-v3:nvfp4 \
  olka-fi/Ling-3.0-flash-NVFP4 \
  --served-model-name ling3 --trust-remote-code \
  --host 0.0.0.0 --port 8000 \
  --gpu-memory-utilization 0.85 --max-model-len 16384 --max-num-seqs 256 \
  --enable-prefix-caching --mamba-cache-mode align \
  --kernel-config '{"moe_backend":"marlin"}' \
  --enable-auto-tool-choice --tool-call-parser ling3 --reasoning-parser ling3 \
  --speculative-config '{"method":"mtp","num_speculative_tokens":3}'

Drop --speculative-config to serve without MTP; --kernel-config and --max-num-seqs 256 are then optional, and --max-model-len can go much higher (32K+). Add --load-format fastsafetensors for faster weight loading.

--enable-prefix-caching is required for --mamba-cache-mode align to take effect — without it vLLM silently downgrades the KDA linear-attention state cache to none and only logs a warning.

Recommended sampling (from the base card): temperature=0.6, top_p=0.95, top_k=20, with enable_thinking.

Provenance

Built with qstream from the BF16 inclusionAI/Ling-3.0-flash release:

qstream-quantize \
  --model_dir  Ling-3.0-flash \
  --output_dir Ling-3.0-flash-NVFP4 \
  --quant_format nvfp4 --nvfp4_mse --format ct \
  --include_layers '*.mlp.experts.*' \
  --exclude_layers '*.layers.42.*' \
  --workers 8 --device cuda

--nvfp4_mse searches neighbouring E4M3 group scales and keeps the minimum-reconstruction- error one, with γ-weighted activation awareness from post_attention_layernorm.

Evaluation notes

GSM8K figures above are 5-shot over the full 1319-problem test set via /v1/completions with plain few-shot prompting — a non-thinking protocol. They are not comparable to the base model's published scores, which are generated with thinking mode + CoT. They exist to bound quantization damage, not as leaderboard claims.

License

Inherits the MIT license from the base model. This is a derivative (quantized) work of inclusionAI/Ling-3.0-flash.


Original model card

🤗 Hugging Face   |   🤖 ModelScope    |   🐙 OpenRouter   

Introduction

We're introducing Ling-3.0-flash, our next-generation native hybrid reasoning model. Operating with 124B total and 5.1B active parameters (~12.4% and ~8.1% of our previous 1T-class flagship Ring-2.6-1T), Ling-3.0-flash matches or outperforms its predecessor across key benchmarks.

Key highlights of the model are summarized below:

  • Native Hybrid-Linear Architecture: Ling-3.0 adopts a native hybrid linear attention architecture from the very start of pretraining (5:1 alternating stacking of Kimi Delta Attention (KDA) and MLA), upgraded with KDA fine-grained diagonal gating and 1/64 sparse MoE. With 124B total parameters and 5.1B activated parameters, it achieves a synergistic leap in long-context efficiency and computational cost.
  • Remarkable Efficiency & Performance: Engineered for speed, compute efficiency, and production deployment, Ling-3.0-flash delivers class-defying performance against both larger SOTA competitors and previous-generation flagships. Activating only 5.1B parameters per token, it provides impressive reasoning, instruction following, and long-context capabilities to empower complex agentic workflows in production environments.
  • Comprehensive Agentic Evolution: Tailored for real-world productivity workflows, the model incorporates 10,000+ interactive training environments to achieve end-to-end closed-loop execution across Coding, General, and Deep Research Agent tasks. It natively integrates the SGLang HiCache + Mooncake hierarchical caching architecture (featuring physical dual-pools and a cluster-shared L3 cache), eliminating redundant recomputation during long-horizon interactions and reducing Time to First Token (TTFT) by 60% to over 80% in long-input scenarios.s the SGLang HiCache + Mooncake hierarchical caching architecture (featuring physical dual-pools and a cluster-shared L3 cache), eliminating redundant recomputation during long-horizon interactions and reducing Time to First Token (TTFT) by 60% to over 80% in long-input scenarios.

Model Overview

The model summary information and architecture diagram are as follows:

Architecture Hybrid-linear MoE
Parameter Scale Totoal 124B, Activated 5.1B
Transformer Layers 35 KDA + 7 Gated MLA (5:1)
Number of Dense Layers 2
Number of Routed Experts 512
Number of Shared Experts 1
Number of Activated Experts 8
Attention Heads 32
Hidden Size 2560
Expert Intermediate Size 768
Dense Intermediate Size 6144
Vocabulary Size 157184
Context Training Schedule 8K -> 32K -> 256K

Evaluation

We have conducted a comprehensive evaluation of Ling-3.0-flash across multiple authoritative benchmarks. Ling-3.0-flash performs strongly on representative code/agent benchmarks such as SWE-Bench Pro, SWE-Bench Multilingual, Tau3-banking-AA, MCP-Atlas and SkillsBench, etc. In practice, Ling-3.0-flash delivers a strong user experience across frameworks including Claude Code,Kilo Code,Qwen Code,Hermes Agent,and OpenClaw, etc. Beyond agentic tasks, Ling-3.0-flash also delivers strong performance across general knowledge,mathematical reasoning,instruction following,and long-context understanding.

  • Thinking mode is enabled by default. Unless otherwise specified, the default parameters for Ling-3.0-flash are as follows: temperature=0.6, top_p=0.95, top_k=20.
  • SWE-Bench Series:Evaluated using OpenHands as the agent harness with tailored prompts. Decoding uses temperature=0.6, top_p=0.95, max_new_tokens=32K, with a 256K context window.
  • Terminal-Bench 2.1: Evaluated under the Artificial Analysis (AA) protocol using the default Terminus 2 harness, a unified 2-hour timeout, the provided JSON parser in preserve-thinking mode, and 3 runs per task (mean). Decoding uses temperature=0.6, top_p=1.0, max_new_tokens=32K, with a 256K context window.
  • MiniAppBench: A 500-task coding benchmark evaluating whether models can turn a single user request into complete, usable interactive HTML apps in real-world application-generation scenarios. Evaluated with temperature=1.0, top_p=1.0, max_tokens=128K.
  • AntSWEBench: AntSWEBench is an internally used software engineering benchmark that covers mainstream programming languages such as Java, JavaScript, and Python, including various development scenarios like new feature, bug fix, and code refactoring.
  • Tau3-banking-AA: Aligned with the AA leaderboard, utilizing GPT-5.4-mini (medium reasoning) for both the user simulator and the natural-language assertion judge.
  • MCP-Atlas: Evaluated on the 500-task public set using the official v1 harness with a 20-turn limit and Gemini-2.5-Pro as the claim-coverage judger.
  • SkillsBench: Evaluated via kilo-code on 87 tasks (excluding external API-dependent tasks), averaged over 3 runs.
  • GDPval v2-AA : Evaluated on the public 220-task benchmark using the official Stirrup harness, with a 250-turn limit and a 5-hour timeout.
  • Search‑agent:For all search‑agent tasks, evaluations are performed using an internal harness. The basic ReAct paradigm is adopted for single-agent evaluation, while a multi-agent setup is employed for BrowseComp. The reported metric is the average pass@1.
    • WideSearch: Evaluated using the official prompt and the official judge model GPT-4.1 on the corrected version of the dataset.
    • Draco: Scored based on official rubrics per question, with the final score calculated as the average across all questions using Claude Opus 4.6 as the scoring model.
    • BrowseComp (Single-Agent): Evaluated using a resume strategy for context management: once the context reaches a 64K-token threshold, the trajectory is summarized, the original history is discarded, and execution is resumed from the summary.
    • BrowseComp (Multi-Agent): Evaluated on English and ZH Revised datasets using an internal multi-agent search harness based on SearchSwarm/Tongyi DeepResearch, configured with temperature=0.85, top_p=0.95, max_tokens=8K, and main/sub-agent context windows of 128K and 64K, respectively.

Quickstart

SGlang

Install our SGLang

pip install uv

uv venv ~/my_ling_env

source ~/my_ling_env/bin/activate

git clone -b ling_v3_support https://github.com/inclusionAI/sglang_ling_v3.git

cd sglang_ling_v3

pip install --upgrade pip

pip install -e "python"

Run Inference

Here is an example to run Ling-3.0-flash with 4 GPUs, where the master node IP is ${MASTER_IP} and server port is ${PORT}:

Server

Since the model is trained with MTP, we recommend enabling MTP during inference (i.e., --speculative-algorithm NEXTN) for lower latency.

export SGLANG_ALLOW_OVERWRITE_LONGER_CONTEXT_LEN=1
export SGLANG_JIT_DEEPGEMM_PRECOMPILE=1
export SGLANG_ENABLE_SPEC_V2=1
python -m sglang.launch_server \
    --model-path $MODEL_PATH \
    --dist-init-addr $MASTER_IP:2345 \
    --port $PORT \
    --nnodes 1 \
    --mem-fraction-static 0.8 \
    --max-running-requests 64 \
    --tp-size 4 \
    --chunked-prefill-size 8192 \
    --tool-call-parser ling3 \
    --reasoning-parser ling3 \
    --context-length 262144 \
    --speculative-algorithm NEXTN \
    --max-mamba-cache-size 320 \
    --enable-fp32-lm-head \
    --disable-shared-experts-fusion

Client

We recommend using the sampling parameters temperature=0.6, top_p=0.95, and top_k=20, and enabling enable_thinking for better performance.

curl -s http://${MASTER_IP}:${PORT}/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "auto",
       "messages": [{"role": "user", "content": "hello!"}],
       "chat_template_kwargs": {"enable_thinking": true},
       "stream": true,
       "temperature": 0.6, 
       "top_k": 20,
       "top_p": 0.95
     }'

vLLM

Install our vLLM

pip install uv

uv venv ~/my_ling_env

source ~/my_ling_env/bin/activate

git clone -b ling_3_0 https://github.com/inclusionAI/vllm-ling-v3.git

cd vllm-ling-v3

VLLM_USE_PRECOMPILED=1 uv pip install --editable . --torch-backend=auto

Run Inference

Here is the example to run Ling-3.0-flash with 4 GPUs, where the server port is ${PORT}:

Server

Since the model is trained with MTP, we recommend enabling MTP during inference (i.e., --speculative-config) for lower latency.

vllm serve "$MODEL_PATH" \
    --port "$PORT" \
    --trust-remote-code \
    --served-model-name auto \
    --tensor-parallel-size 4 \
    --gpu-memory-utilization 0.85 \
    --enable-prefix-caching \
    --mamba-cache-mode align \
    --enable-auto-tool-choice \
    --tool-call-parser ling3 \
    --reasoning-parser ling3 \
    --speculative-config '{"method":"mtp","num_speculative_tokens":3}'

Client

We recommend using the sampling parameters temperature=0.6, top_p=0.95, and top_k=20, and enabling enable_thinking for better performance.

curl -s http://${MASTER_IP}:${PORT}/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "auto",
       "messages": [{"role": "user", "content": "hello!"}],
       "chat_template_kwargs": {"enable_thinking": true},
       "stream": true,
       "temperature": 0.6, 
       "top_k": 20,
       "top_p": 0.95
     }'
Downloads last month
-
Safetensors
Model size
127B params
Tensor type
U8
·
F32
·
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for olka-fi/Ling-3.0-flash-NVFP4

Quantized
(9)
this model