Instructions to use olka-fi/Ling-3.0-flash-MXFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use olka-fi/Ling-3.0-flash-MXFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="olka-fi/Ling-3.0-flash-MXFP4", 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("olka-fi/Ling-3.0-flash-MXFP4", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("olka-fi/Ling-3.0-flash-MXFP4", 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 olka-fi/Ling-3.0-flash-MXFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "olka-fi/Ling-3.0-flash-MXFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "olka-fi/Ling-3.0-flash-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/olka-fi/Ling-3.0-flash-MXFP4
- SGLang
How to use olka-fi/Ling-3.0-flash-MXFP4 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 "olka-fi/Ling-3.0-flash-MXFP4" \ --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": "olka-fi/Ling-3.0-flash-MXFP4", "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 "olka-fi/Ling-3.0-flash-MXFP4" \ --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": "olka-fi/Ling-3.0-flash-MXFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use olka-fi/Ling-3.0-flash-MXFP4 with Docker Model Runner:
docker model run hf.co/olka-fi/Ling-3.0-flash-MXFP4
Download vllm_patch/README.md from olka-fi/Ling-3.0-flash-MXFP4: direct link, hf CLI and curl.
- Browser
- Download file 3.34 kB
-
https://huggingface.co/olka-fi/Ling-3.0-flash-MXFP4/resolve/main/vllm_patch/README.md
- Command line
-
hf download hf://olka-fi/Ling-3.0-flash-MXFP4/vllm_patch/README.md
-
curl -L -o README.md https://huggingface.co/olka-fi/Ling-3.0-flash-MXFP4/resolve/main/vllm_patch/README.md
Local patch: keep the per-layer SwiGLU clamp on the compressed-tensors MXFP4 MoE path
Applied on top of inclusionAI/vllm@ling_3_0 (e0040c3 "[Model] Add Bailing V3 support").
The problem
Ling-3.0-flash declares a per-layer clamped SwiGLU:
"expert_swiglu_limit_list": [0]*35 + [4]*7, // layers 35-41
"share_expert_swiglu_limit_list": [0]*34 + [5]*6 + [7]*2
bailing_moe_v3.py reads it correctly (_get_layer_swiglu_limit) and passes
swiglu_limit= into FusedMoEFactory, which stores it on RoutedExperts.swiglu_limit.
The unquantized path then honours it — unquantized_fused_moe_method.py reads
getattr(layer, "swiglu_limit", None).
The compressed-tensors MXFP4 path did not. Three independent gaps, all of which had to be closed for the value to reach the kernel:
CompressedTensorsW4A4Mxfp4MoEMethod.get_fused_moe_quant_confignever readlayer.swiglu_limit.mxfp4_moe_quant_config(the W4A4 cutlass builder) had nogemm1_clamp_limitparameter at all, so even a caller that wanted to pass one could not.run_cutlass_moe_mxfp4took no clamp argument and calledapply_moe_activation(activation, c2, c1)bare. ForMoEActivation.SILUit also takes a fusedops.silu_and_mul_mxfp4_experts_quantfast path that has no clamp variant.
Net effect: on an MXFP4 checkpoint, layers 35-41 computed unclamped SwiGLU while
BF16 clamped them. The divergence is large, not marginal — for a gate activation of
10.0, silu(10)*2 = 20.0 against silu(4)*2 = 7.84.
This is not specific to our quantization: any MXFP4 compressed-tensors checkpoint of a
model with a SwiGLU limit hits it (gpt-oss-style limit=7.0 models included).
The change
| File | Change |
|---|---|
vllm/model_executor/layers/fused_moe/config.py |
mxfp4_moe_quant_config accepts gemm1_clamp_limit and forwards it to FusedMoEQuantConfig.make (which already supported it). |
.../compressed_tensors_moe/compressed_tensors_moe_w4a4_mxfp4.py |
get_fused_moe_quant_config reads getattr(layer, "swiglu_limit", None) and passes it down both the cutlass (gemm1_clamp_limit=) and Marlin (swiglu_limit=) branches. |
vllm/model_executor/layers/fused_moe/experts/cutlass_moe.py |
run_cutlass_moe_mxfp4 takes swiglu_limit; when set, SILU falls out of the fused fast path into apply_moe_activation(..., clamp_limit=...). CutlassExpertsMxfp4.apply passes self.quant_config.gemm1_clamp_limit. |
c2 and workspace2 are allocated unconditionally (workspace2 = (M * topk, N)), so
the generic path is safe to take for any activation.
Models that declare no limit are unaffected: swiglu_limit stays None, the quant
config field stays None, and SILU keeps the fused fast path.
Verification
mxfp4_moe_quant_config(..., gemm1_clamp_limit=4.0).gemm1_clamp_limit -> 4.0
mxfp4_moe_quant_config(...) .gemm1_clamp_limit -> None
get_fused_moe_quant_config(layer.swiglu_limit=4.0).gemm1_clamp_limit -> 4.0
get_fused_moe_quant_config(layer.swiglu_limit=None).gemm1_clamp_limit -> None
apply_moe_activation(SILU, x=[10,-10,2,1]) -> [20.0, -0.00045]
apply_moe_activation(SILU, x=[10,-10,2,1], clamp_limit=4) -> [ 7.844, -0.00045]
All four edits are pure Python, so an editable install picks them up with no rebuild.