Instructions to use m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16
- SGLang
How to use m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16 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 "m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16" \ --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": "m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16", "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 "m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16" \ --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": "m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16 with Docker Model Runner:
docker model run hf.co/m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16
LLaDA2.1-flash NVFP4 (W4A16, routed experts)
A 4-bit checkpoint of inclusionAI/LLaDA2.1-flash, the mixture-of-experts diffusion language model, that runs on a single 96 GB GPU and matches the BF16 model on GSM8K and ARC-Challenge.
| Quantized | routed-expert weights only, NVFP4 (group size 16), activations in BF16 (W4A16) |
| Kept in BF16 | attention, router, shared experts, the first (dense) layer, output head |
| Size on disk | 58 GiB, down from 192 GiB |
| Hardware tested | one NVIDIA RTX PRO 6000 Blackwell (96 GB) |
| Engine tested | SGLang 0.5.19 with --moe-runner-backend marlin |
| Accuracy | same as BF16 within noise (GSM8K 97.2 vs 95.6, ARC-Challenge 94.8 vs 95.0) |
What W4A16 means
A model stores two kinds of numbers: weights, the fixed parameters learned in training, and activations, the intermediate values computed from your input at every step. The shorthand WxAy gives the bits used for each, so W4A16 means 4-bit weights and 16-bit activations. Only the stored weights shrink, while all computation still happens in BF16. This saves most of the memory, since weights are what fills the GPU, and keeps the accuracy of full-precision arithmetic.
The 4-bit format here is NVFP4, introduced by NVIDIA with Blackwell GPUs. Each weight is a tiny 4-bit floating-point number, and every group of 16 weights shares an FP8 scale factor that sets their range. NVIDIA's post Introducing NVFP4 for Efficient and Accurate Low-Precision Inference explains the format with diagrams.
The WxAy notation comes from the post-training quantization literature, for example SmoothQuant (W8A8). Weight-only 4-bit quantization of LLMs was made practical by GPTQ, and Marlin is the GPU kernel for such weight-quantized models that this checkpoint uses at inference. A W4A4 checkpoint also cuts activations to 4 bits. That can run faster on Blackwell tensor cores, but it rounds every computation and usually costs more accuracy.
Serving
python -m sglang.launch_server \
--model-path m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16 \
--trust-remote-code \
--moe-runner-backend marlin \
--attention-backend flashinfer \
--mem-fraction-static 0.8 \
--tp-size 1 \
--dllm-algorithm JointThreshold \
--dllm-algorithm-config joint_threshold_quality.yaml
Use the marlin MoE backend. Marlin keeps the weights in 4 bits and computes in BF16, and its outputs match those of the same 4-bit weights dequantized to BF16. SGLang's default NVFP4 MoE path, flashinfer_cutlass, gave clearly worse outputs on this architecture in our tests. With marlin, temperature-0 decoding is not bitwise deterministic, so the same request can return slightly different text.
The decoding settings come from the original model card and ship with this repository.
| File | Mode | threshold | edit_threshold | max_post_edit_steps | block_size |
|---|---|---|---|---|---|
| joint_threshold_quality.yaml | Quality | 0.7 | 0.5 | 16 | 32 |
| joint_threshold_speed.yaml | Speed | 0.5 | 0.0 | 16 | 32 |
Sampling at temperature > 0
In SGLang 0.5.19 the JointThreshold algorithm always proposes the most likely token and ignores the request temperature, so a request at temperature 0.7 returns the same text as one at temperature 0. The official LLaDA2.1 code instead divides the logits by the temperature and samples.
joint_threshold_sampling.py restores that behaviour. It subclasses JointThreshold and changes only how each token is proposed, so at temperature 0 it behaves exactly like the original. To use it:
- Copy the file into
sglang/srt/dllm/algorithm/, next tojoint_threshold.py. - Start the server with
--dllm-algorithm JointThresholdSampling. - Optionally set
sampling_seedin the algorithm YAML (default 0). Give each server a different seed when you run several of them.
top_p and top_k are not supported, and a request that sets them fails with an error. If you only decode at temperature 0, you do not need this file.
Evaluation
| Weights | Mode | Temperature | GSM8K | ARC-Challenge |
|---|---|---|---|---|
| BF16 (original) | Quality | 0 | 95.6 | 95.0 |
| this checkpoint | Quality | 0 | 97.2 | 94.8 |
| this checkpoint | Quality | 0.7 | 95.4 | 93.8 |
| this checkpoint | Speed | 0 | 95.0 | 94.2 |
| this checkpoint | Speed | 0.7 | 87.2 | 94.6 |
| community NVFP4 (W4A4) | Quality | 0 | 82.8 | 91.0 |
| community NVFP4 (W4A4) | Quality | 0.7 | 74.2 | 91.0 |
| community NVFP4 (W4A4) | Speed | 0 | 69.8 | 90.8 |
Setup: first 500 test questions of GSM8K and ARC-Challenge, one chat request per question, up to 16,384 output tokens, SGLang 0.5.19 for every model.
- Against BF16. In Quality Mode at temperature 0 this checkpoint is within 1.6 points of the original on both benchmarks. With 500 questions, differences of one or two points are noise.
- Other settings. Quality Mode at temperature 0.7 and Speed Mode at temperature 0 stay close to BF16. Speed Mode at temperature 0.7 drops to 87.2 on GSM8K. We did not run BF16 in that setting, so we cannot say how much of the drop comes from quantization and how much from the setting itself.
- Against the community checkpoint. thnkinbtfly/llada2.1-flash-nvfp4 scores 12.8 points below BF16 on GSM8K and 4.0 below on ARC-Challenge in the same setting. It also quantizes activations (W4A4) and nearly every layer, which rules out marlin and forces the
flashinfer_cutlassMoE path, so we cannot separate the effect of its weights from that of the kernel.
How it was made
- Tool. NVIDIA ModelOpt 0.46.1, from the official BF16 weights at revision
2bf95e86. - Recipe. NVFP4 weight-only quantization of the routed experts, with no activation quantizers. Each 16-weight block's scale was chosen by minimizing mean squared error over a sweep of all FP8 scale values.
- Calibration. 8 samples of up to 2,048 tokens from cnn_dailymail and Nemotron-Post-Training-Dataset-v1. All 256 experts of every MoE layer received calibration tokens, and none was left unseen.
- Patch. ModelOpt does not know this architecture's expert block, so a small patch maps its expert projections (
gate_proj,up_proj,down_proj).
QUANTIZATION_REPORT.json records the full configuration, the patches and per-layer expert coverage.
Limitations
- Tested only with SGLang 0.5.19, the marlin backend and one Blackwell GPU. Other engines, backends and GPUs are untested.
- The comparison with BF16 covers two English benchmarks of 500 questions each. It does not cover long contexts, code or other languages.
- The 4-bit model is not identical to BF16. Individual answers can differ even where accuracy is the same.
License
Apache 2.0, as the base model.
- Downloads last month
- 23
Model tree for m1rkocasu/LLaDA2.1-flash-NVFP4-W4A16
Base model
inclusionAI/LLaDA2.1-flash