~/satyajit

Ling-3.1-flash: a 560B hybrid-attention MoE, counted from its safetensors headers

mdjsonmcp

2026-10-14 · 14 min · mixture-of-experts · linear-attention · hybrid-attention · quantization · long-context · kv-cache

Why read this

Solidtop 85%

Ling-3.1-flash recounted from all 54 safetensors headers: MXFP4 534→292 reproduced as GiB, expert bytes vs per-token reads, a GPU memory planner, 1M vs 262K.

  • Original analysis
  • Concrete numbers to act on
  • Explained from first principles

Inference & servingNeeds datacenter GPUsMITPractitioner model

How this was scored
Is it new?
1 of 3: An incremental tweak
Can I trust it?
2 of 3: Measures key facts from files, code or configs
Can I run it?
1 of 3: API-only, gated or restrictive licence
Will I understand it?
2 of 3: Mechanism from first principles with figures
Can I act on it?
2 of 3: A concrete recipe, numbers or comparison
Will it last?
1 of 3: Relevant for months
Does it affect many?
1 of 3: A specialist community
Only here?
2 of 3: A teardown or measurement few others did

Score 55 of 100, ranked 415 of 577 rated articles. Each question is answered 0–3 by hand, and a 3 is rare. How articles are scored

On 2026-10-14 inclusionAI (Ant Group's Ling team) put Ling-3.1-flash on Hugging Face under MIT. The launch thread leads with three numbers: ~560B total parameters, ~25B active per token, up to 1M context. The second post carries the claim I care about as someone who has to fit models onto GPUs: MXFP4 experts plus block-FP8 dense layers "cut weights from ~534GB to ~292GB", and a tested Hopper setup "moved from 8 GPUs to 4".

That claim is checkable without downloading a byte of weights. A safetensors file starts with an 8-byte length and a JSON header listing every tensor's dtype and shape. I pulled those headers from all 54 shards with HTTP range requests (16.9 MB of JSON for 214,025 tensors), summed them, and rebuilt the model's parameter budget group by group. Every number below is labelled: measured (I computed it from the files), reported (someone else's figure, not re-run), or reasoned (my arithmetic on the other two).

inclusionAI/Ling-3.1-flash@7b864da · snapshot 2026-10-14
parameters
572.12B
repo size
573.81 GB
architecture
BailingMoeV3ForCausalLM
task
text-generation
license
mit
safetensors
54 shards
largest file
10.72 GB
files
64
downloads
8
likes
43
parameters by dtype
BF161.49BF32555.5KF8_E4M3570.63B

repo last modified 2026-10-14

What is in the files

The headers sum to 573,753,281,152 bytes (measured), exactly the total_size in model.safetensors.index.json. The release is FP8: config.json declares quant_method: fp8, E4M3 weights in 128×128 blocks with one fp32 scale per block, and keeps the embeddings, lm_head, the routers and a few gates in BF16.

The architecture is BailingMoeV3ForCausalLM, model_type: bailing_hybrid. It is the same family as Ling-3.0-flash, scaled up roughly 4.5x. Read from config and code:

If any of this is new, the MoE explainer and the attention and KV-cache explainer cover the basics; the linear-attention roundup covers why a fixed-size state is attractive and lossy.

How KDA and MLA split the work

KDA is a gated delta-rule linear attention. Each head keeps a 128×128 state matrix and, per token, decays it channel by channel and writes the new key-value association into it:

St=Diag(αt) St−1+βt ktvt⊤,ot=St⊤qtS_t = \mathrm{Diag}(\alpha_t)\, S_{t-1} + \beta_t\, k_t v_t^{\top}, \qquad o_t = S_t^{\top} q_t

Here StS_t is the state, αt\alpha_t the per-channel decay (the f_proj and A_log tensors), βt\beta_t the write strength (b_proj, one scalar per head), and qt,kt,vtq_t, k_t, v_t come through a short causal convolution of width 4. The state does not grow with the sequence. Gated MLA is ordinary softmax attention over a compressed cache: each token stores a 512-dim latent plus a 64-dim RoPE key, and a sigmoid gate per head (g_proj, 64 outputs) scales the result.

One detail separates this from the published KDA: no_kda_lora: true. Kimi's version produces the decay and output gates through a low-rank bottleneck. Ling-3.1-flash uses full 4096→8192 projections for both. Each KDA layer therefore carries six 8192×4096 matrices (q, k, v, decay, gate, output), 201M parameters per layer and 12.68B across the 63 layers (measured). That choice matters later.

Counting the parameters

Grouping every tensor in the headers (measured):

GroupParametersRelease dtype
Routed experts, 68 MoE layers × 512547.61BFP8 block
KDA layers, 6312.71BFP8 block; convs, gates' small parts BF16/fp32
Shared experts1.07BFP8 block
Gated MLA, 9 layers0.63BFP8 block
Dense FFN, first 4 layers0.50BFP8 block
Embeddings + lm_head (untied)1.29BBF16
Routers and norms0.14BBF16
Main model563.95B
MTP layer8.17Bmixed
Everything in the files572.12B

So "~560B" holds: 563.9B for the main model, 572.1B if you count the MTP layer, which on its own is larger than many complete open models.

Active per token is the non-expert parameters plus 8/512 of the routed ones: 16.34B + 8.56B = 24.9B (measured; 24.25B if you do not count the input embedding, which is a row lookup, not a matmul). "~25B active" holds. The SGLang cookbook page says "about 17B active" (reported); I cannot find any grouping of these tensors that produces 17B, and the model card says 25B.

The surprise is where the active parameters sit. KDA's full-rank projections are 12.7B of the 24.9B, about half, while the eight routed experts contribute 8.56B (reasoned). On most fine-grained MoEs the experts dominate the per-token compute. On this one, the attention layers do.

Reproducing 534 GB to 292 GB

MXFP4 (OCP Microscaling) stores weights as 4-bit E2M1 values in blocks of 32 that share one 8-bit power-of-two (E8M0) scale. That costs 4+8/32=4.254 + 8/32 = 4.25 bits per weight. Block FP8 here is 8 bits plus one fp32 scale per 128×128 tile, 8+32/16384≈8.0028 + 32/16384 \approx 8.002 bits. Ling's earlier Ling-3.0-flash-fp4 release spells the recipe out in its config: routed_experts_quant_method: mxfp4, group size 32, e8m0 scales, re-quantized from fp8_block_128x128, everything else left in block FP8. I assume 3.1 follows it; no Ling-3.1-flash FP4 checkpoint is published yet (measured from the Hugging Face model listing on 2026-10-14).

Apply it to the measured groups:

ConfigurationBytesIn GiB
Release: FP8 block, BF16 kept573.75 GB534.35 GiB
MXFP4 routed experts (incl. MTP), rest unchanged313.15 GB291.64 GiB
Same, MTP layer dropped308.72 GB287.51 GiB
Everything BF161,144.24 GB1,065.66 GiB

The thread's ~534 and ~292 match the GiB column to the unit (reasoned from measured counts). They are gibibytes written as "GB". The decimal figures are 574 GB and 313 GB. That is not a gotcha, since GPU memory is also sold in binary units, but if you size a disk or a download from the thread you will be 7% short.

The cut is 45.4% of the bytes (reasoned), and almost all of it comes from one group: the routed experts are 95.4% of the release's bytes (measured). Dense parts stay in FP8 because they are small and every token touches them; experts go to 4 bits because they are huge and each one is touched rarely.

What the cut does not buy

Storage and decode traffic are different things. At batch size 1, a decode step reads every dense weight but only the 8 experts the router picked. In the FP8 release that is about 14.9 GB of dense weights, 1.6 GB of BF16 head, routers and norms, and 8.6 GB of experts: ~25.1 GB per token (reasoned from the measured groups). With MXFP4 experts the expert share falls to 4.5 GB and the total to ~21.1 GB. A 45% smaller checkpoint reads only about 16% fewer bytes per token at batch 1. The experts are 95% of the storage but about a third of a single token's reads, because KDA's full-rank projections are so large.

The saving grows with batch size, since a batch of tokens touches more distinct experts. And on Hopper there is no FP4 tensor-core path, so MXFP4 experts have to be unpacked to FP8 or BF16 inside the GEMM (reasoned). On H100 and H200 MXFP4 saves memory, not FLOPs. That is consistent with the thread pitching it as "8 GPUs to 4", a memory claim, rather than a speed one.

Does 292 GiB fit on four Hopper GPUs?

Weights are only part of the bill. The two attention types cost memory differently:

Add a reserve for activations, CUDA graphs and communication buffers. I use 6 GiB per GPU, an assumption, not a measurement. Then (reasoned):

So "8 GPUs to 4" is plainly true on H200 and only nominally true on H100. The thread does not say which Hopper part it tested. Try the combinations:

Everything in the planner is in the prose above: the measured parameter groups, the per-token MLA cost, the per-sequence KDA state, and the reserve. The verdict is for one GPU, because that is where an out-of-memory error happens.

The serving numbers are not one experiment

The thread's next sentence: "In separate tests, 8 GPUs averaged 604ms to first token and 4 GPUs reached ~1.36 QPS. Workloads differed." Taken literally, these are two different experiments that measure two different things. Time to first token is a latency at some prompt length and concurrency. Queries per second is a throughput at some request mix. Neither prompt lengths, output lengths, concurrency, GPU model nor checkpoint precision is given for either. They cannot be compared with each other or with anyone else's numbers (reasoned). The thread says as much, which is more candour than most launch posts manage.

The numbers that do come with a recipe are SGLang's (reported, not re-run): on 8×H200 with TP8, EP8 and MTP speculative decoding, batch-size-1 output is 251.2 tokens/s; on GB300, 180.0 tokens/s at 5.14 ms per output token. MTP acceptance length is 2.61 on random tokens and 2.13 on real-text prompts. The vLLM recipe in the card uses three speculative tokens from the same MTP layer.

Context: 1M in the claims, 262,144 in the config

The card, the thread and Artificial Analysis all say a 1M-token context. The open checkpoint's config.json says max_position_embeddings: 262144 with rope_scaling: null and rope_theta: 6000000 (measured), and the SGLang cookbook states "a context limit of 262,144 tokens" (reported).

Position only enters this model in the 9 MLA layers, through 64 of each head's 192 query-key dimensions; the KDA layers have no positional encoding and order tokens through their recurrence. So extending to 1M is a question about 9 layers' RoPE, the kind of change YaRN-style frequency scaling addresses. The model code supports YaRN scaling, but the release ships with none configured and documents no 1M recipe. The 1M figure is what inclusionAI's own API serves; with the open weights as shipped, plan for 256K.

Artificial Analysis and Design Arena

The thread cites two leaderboards. I could reach Artificial Analysis's model page (reported, read 2026-10-14):

Scatter plot of Artificial Analysis Intelligence Index against output tokens per second for 18 models. Ling 3.1 Flash sits at about 41 on the index and about 210 tokens per second, on the dotted Pareto line inside the shaded 'most attractive' quadrant, near DeepSeek V4.1 Flash and DeepSeek V4 Flash; Claude Opus 5.5 and GLM-5.3 score higher but are slower.
Intelligence Index vs output speed. Ling 3.1 Flash sits on the Pareto line at about 41 and 210 tokens/s; speed is measured on each vendor's API, not on self-hosted weights (Artificial Analysis chart, posted in the @AntLingAGI launch thread).
Scatter plot of output speed against blended price per million tokens. Ling 3.1 Flash sits near 0.19 dollars and 210 tokens per second, clustered with DeepSeek V4 Flash and V4.1 Flash, inside the shaded quadrant; Kimi K3 and Claude Opus 5.5 sit far to the right at higher prices and lower speeds.
Output speed vs blended price. The blend is Artificial Analysis's 7:2:1 cache-hit/input/output mix, which favours cache-heavy pricing (Artificial Analysis chart, posted in the @AntLingAGI launch thread).

Design Arena is a human-preference arena for generated front-end work. The thread's composite shows the Open Weights boards (reported): Ling-3.1-flash scores 1198 in React Native and 1341 in 3D Design (#3 in both), 1277 in SVG (#4), 1299 in Website (#5), plus 1295 in Data Visualization and 1335 in Game Dev, both #3. Kimi K3 is first on all six.

Six Design Arena Open Weights leaderboards as bar charts: Data Visualization, React Native, 3D Design, Game Dev, SVG and Website. Ling-3.1-flash is a highlighted, enlarged bar in each, scoring 1295, 1198, 1341, 1335, 1277 and 1299, ranked third, third, third, third, fourth and fifth; Kimi K3 is first on all six.
Design Arena Open Weights boards. The highlighted Ling bar is drawn taller than bars that outscore it (1341 stands above Kimi K3's 1388 on 3D Design), so read the numbers, not the heights (composite posted in the @AntLingAGI launch thread; Design Arena data).

One thing to read carefully in that composite: the highlighted bar is styled larger, and on every board it stands taller than the higher-scoring bars to its left. The printed numbers and the ranks in the thread agree with each other; the bar heights do not (read from the figure itself).

The card also names results on GDPVal-AA V2.1, HealthBench Professional, FrontierSWE, Terminal-Bench 4.0 and SWE-bench Pro. Its result images are hosted on an Ant-internal domain that redirects to a login, so I could not read or reproduce them. Treat those as claims.

Licence

The Hugging Face card's metadata says license: mit, and so does the ModelScope mirror. Neither repository contains a LICENSE file, and there is no tech report; the inclusionAI/Ling GitHub repository is MIT but has not been updated for this family (measured: its last commit is from May 2025). MIT with no added use restrictions is as permissive as open weights get. The card also links a training-content summary PDF, which it says does not replace the licence.

What I take from it

Compared with Kimi K3 and GLM-5.3-Flash, this is the same convergent recipe, linear attention for most layers, a few full-attention layers for exact recall, very sparse experts, at a size where a single 8-GPU node still serves it in FP8. For background on block-scaled 4-bit formats, the Nemotron NVFP4 article covers the sibling format, and how LLM inference works covers why decode is a memory-bandwidth problem in the first place.

Cite this article

For attribution, please use the following reference or BibTeX:

Satyajit Ghana, "Ling-3.1-flash: a 560B hybrid-attention MoE, counted from its safetensors headers", ai.thesatyajit.com, October 2026.

bibtex
@misc{ghana2026ling31flash,
  author = {Satyajit Ghana},
  title  = {Ling-3.1-flash: a 560B hybrid-attention MoE, counted from its safetensors headers},
  url    = {https://ai.thesatyajit.com/articles/ling-3-1-flash},
  year   = {2026}
}
share