Instructions to use Beling86/Ling3.2-Air-3.59BPW-MTP with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Beling86/Ling3.2-Air-3.59BPW-MTP with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Beling86/Ling3.2-Air-3.59BPW-MTP", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Beling86/Ling3.2-Air-3.59BPW-MTP", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("Beling86/Ling3.2-Air-3.59BPW-MTP", trust_remote_code=True, device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Beling86/Ling3.2-Air-3.59BPW-MTP with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Beling86/Ling3.2-Air-3.59BPW-MTP" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Beling86/Ling3.2-Air-3.59BPW-MTP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Beling86/Ling3.2-Air-3.59BPW-MTP
- SGLang
How to use Beling86/Ling3.2-Air-3.59BPW-MTP with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Beling86/Ling3.2-Air-3.59BPW-MTP" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Beling86/Ling3.2-Air-3.59BPW-MTP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Beling86/Ling3.2-Air-3.59BPW-MTP" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Beling86/Ling3.2-Air-3.59BPW-MTP", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Beling86/Ling3.2-Air-3.59BPW-MTP with Docker Model Runner:
docker model run hf.co/Beling86/Ling3.2-Air-3.59BPW-MTP
Ling3.2-Air-3.59BPW-MTP
Mixed-precision AutoRound quantization of inclusionAI/Ling-3.2-air
for vLLM (text-only: vision tower and projector removed; official 128×128 block-FP8 source dequantized on-the-fly to BF16 during calibration and KL evaluation).
- Backbone (GPU): 51.99 GiB (3.59 bits per weight average over all retained backbone text parameters: packed weights, scales, zero points, and BF16 parts) — zero W2 layers
- Embedded MTP speculative-decoding head (GPU): +1.51 GiB (layer 42:
W4 g128 symMarlin experts,W8 g128MLA/eh_proj/shared experts, BF16 router & head-wiseg_proj) → 53.47 GiB total safetensors
Precision layout
| Component | Format |
|---|---|
| Routed experts, 8 MoE layers (3, 5, 6, 9, 14, 17, 20, 24) | W4A16, group 128, symmetric |
| Routed experts, 5 MoE layers (2, 18, 27, 28, 40) | W3A16, group 64, symmetric |
| Routed experts, 27 MoE layers (4, 7, 8, 10, 11, 12, 13, 15, 16, 19, 21, 22, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41) | W3A16, group 128, symmetric |
MTP head (layer 42, +1.51 GiB) |
Experts W4A16 g128 sym; MLA/eh_proj/shared experts W8A16 g128 sym; router & head-wise g_proj BF16 |
KDA attention (q/k/v/b_proj, g_proj, o_proj) |
W8A16, group 128, symmetric (f_proj kept BF16) |
MLA attention (q_proj, kv_a_proj_with_mqa, kv_b_proj, dense) |
W8A16, group 128, symmetric (head-wise g_proj kept BF16) |
| Dense MLP (layers 0–1) & shared experts (layers 2–41) | W8A16, group 128, symmetric |
Routers (mlp.gate), embeddings, LM head, norms |
BF16 |
AutoRound 0.16.1 (SignRound), 400 iterations/block, 2,048 × 2,048-token calibration samples (4.19M tokens — 2× larger than our Ling-3.0 runs; balanced 5-domain chat / code / reasoning / long-context / prose with native Ling chat template; SwigluStepAndMul active on L34–L41; no_kda_lora & kda_safe_gate preserved; best-MSE=False). Format auto_round:auto_gptq.
Fidelity vs. Official Ling-3.2-air Reference
Teacher-forced full-vocabulary KL(P_ref ‖ Q_quant) on a held-out set (24 × 1,024 tokens; sources and splits disjoint from calibration; reference evaluated via native SDPA from official inclusionAI/Ling-3.2-air 128×128 block-FP8 weights dequantized to BF16):
| Domain | Positions | Mean KL | Median KL | P99 KL | Top-1 agreement | PPL ref → quant |
|---|---|---|---|---|---|---|
| all | 24,552 | 0.25294 | 0.00636 | 5.0707 | 89.71% | 3.924 → 3.843 |
| chat | 10,230 | 0.19842 | 0.01322 | 3.9120 | 89.72% | 4.927 → 4.696 |
| code | 5,115 | 0.28673 | 0.00012 | 6.0123 | 92.63% | 2.903 → 2.948 |
| math | 5,115 | 0.39134 | 0.00405 | 7.5442 | 87.92% | 5.316 → 5.053 |
| prose | 4,092 | 0.17401 | 0.02499 | 1.6772 | 88.29% | 2.213 → 2.304 |
P99.9 KL = 16.7116, max = 25.879. Strict reload verified across all 190,479 / 190,479 tensors (0 missing/mismatched keys, including L42 MTP attention.*/self_attn.* config entries). Static vLLM INC dry-check passed.
The Story of These Ling Quants (Ling-3.0-Flash → Ling-3.0-Flash-VL → Ling-3.2-Air-MTP)
All models in our Ling 3.x family were evaluated on the exact same held-out 24 × 1,024 evalset (sha256 = cbd9896131abe89c):
- Pure-Text Baseline —
Ling3.0-Flash-3.44BPW→Ling3.0-Flash-3.58BPW: Started at49.82 GiB(128×2048,200iters,2× W4,KL = 0.08767) and scaled to51.93 GiB(1024×2048,400iters,8× W4onL2–5, 38–41), reaching0.08165KL /93.39%top-1 (PPL 2.544 → 2.513) on pure-text BF16 weights. - Multimodal VL Text Extraction —
Ling3.0-Flash-VL-3.58BPW(51.94 GiB, no MTP): Strippedmodel.visual& projector for 64 GB text serving (1024×2048,400iters,8× W4+4× W3g64+28× W3g128). Because VL-trained Ling models have sharper multimodal MoE routing (higher text base PPL3.809vs pure-text2.544), overall KL landed at0.34248(88.71%top-1), withcode(0.60426) andmath(0.49119) carrying most of the tail. Ling3.2-Air-3.59BPW-MTP(this checkpoint —51.99 GiBbackbone +1.51 GiBL42MTP): Built directly from inclusionAI's official FP8 release using zero-disk-overhead on-the-fly128×128block-FP8 → BF16 dequantization, doubling calibration to2,048 × 2,048(4.19M tokens), addingL2atW3 g64(5×W3g64total), keeping exactSwigluStepAndMulclamping onL34–L41, and attaching the quantizedL42MTP head. Compared toLing3.0-Flash-VL-3.58BPW, this cuts overall KL by −26.1% (0.34248 → 0.25294), slashescodeKL by −52.5% (more than 2× better), cutsmathKL by −20.3%, and lifts overall top-1 agreement by+1.00 pp(88.71% → 89.71%).
Overall Ling 3.x Family Comparison
| Checkpoint | Source Format | Backbone + MTP | Layout (40 MoE L) & Calibration | Mean KL | P99 KL | Top-1 | PPL (ref → quant) |
|---|---|---|---|---|---|---|---|
Ling3.0-Flash-3.44BPW |
Pure-text BF16 | 49.82 GiB |
2× W4 + 38× W3g128 · 128×2048 |
0.08767 |
1.2216 |
92.88% |
— |
Ling3.0-Flash-3.58BPW |
Pure-text BF16 | 51.93 GiB |
8× W4 + 32× W3g128 · 1024×2048 |
0.08165 |
1.1531 |
93.39% |
2.544 → 2.513 |
Ling3.0-Flash-VL-3.58BPW |
VL BF16 (text-only) | 51.94 GiB |
8× W4 + 4× W3g64 + 28× W3g128 · 1024×2048 |
0.34248 |
6.5247 |
88.71% |
3.809 → 3.804 |
Ling3.2-Air-3.59BPW-MTP (this) |
VL FP8→BF16 (text-only) | 51.99 + 1.51 GiB |
8× W4 + 5× W3g64 (+L2) + 27× W3g128 + MTP · 2048×2048 |
0.25294 |
5.0707 |
89.71% |
3.924 → 3.843 |
Domain Comparison (Ling3.0-Flash-VL-3.58BPW vs. Ling3.2-Air-3.59BPW-MTP)
| Domain | Positions | Ling3.0-Flash-VL KL / P99 / Top-1 |
Ling3.2-Air-MTP KL / P99 / Top-1 |
Improvement (Air vs VL) |
|---|---|---|---|---|
| code | 5,115 | 0.60426 / 12.869 / 89.64% |
0.28673 / 6.012 / 92.63% |
−52.5% KL, +2.99 pp top-1 |
| math | 5,115 | 0.49119 / 8.254 / 87.45% |
0.39134 / 7.544 / 87.92% |
−20.3% KL, +0.47 pp top-1 |
| prose | 4,092 | 0.21231 / 2.778 / 90.54% |
0.17401 / 1.677 / 88.29% |
−18.0% KL, −39.6% P99 |
| chat | 10,230 | 0.18930 / 2.613 / 88.14% |
0.19842 / 3.912 / 89.72% |
Near-tie KL (+0.009), +1.58 pp top-1 |
Serving (vLLM)
Designed for vLLM 0.32+ (single 64+ GB GPU). Stock vLLM 0.32/0.33 needs two small patches provided in vllm-patch.py (idempotent, --check / --revert):
python vllm-patch.py # run with the python of your vLLM environment
vllm serve Beling86/Ling3.2-Air-3.59BPW-MTP --trust-remote-code --dtype bfloat16 --max-model-len 262144
| # | Where | Bug | Symptom without the patch |
|---|---|---|---|
| 1 | quantization/inc/config_parser.py |
Per-layer bit-width lookup checks fusedmoe instead of RoutedExperts, silently allocating 4-bit containers for W3 experts. |
CUDA OOM at model construction |
| 2 | models/bailing_moe_v3.py |
bailing_v3_kda_attention host-syncing state update runs inside CUDA-graph capture. |
cudaErrorStreamCaptureUnsupported (workaround without patch: --compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}' or --enforce-eager) |
Validation gates passed
Coverage (excluding FP8 weight_scale_inv), packed layout vs. config, zero points vs. sym, fused-group consistency (dense gate_up, shared gate_up, KDA qkvb_proj, routed experts), backbone size ≤ 52.0 GiB, plan conformance, strict reload across all 190,479 tensors (0 missing/mismatched keys), and static vLLM INC dry-check.
- Downloads last month
- 22
Model tree for Beling86/Ling3.2-Air-3.59BPW-MTP
Base model
inclusionAI/Ling-3.2-air