dInfer is an efficient and extensible inference framework for dLLMs. As illustrated in the following architecture, it modularizes inference into four components: model, diffusion iteration manager, decoder and KV-cache manager. It provides well-designed APIs for flexible algorithms combinations in each component. Now supports batched inference for improved throughput.
Figure: Overall Architecture of dInfer
dInfer supports multiple dLLM variants, including LLaDA and LLaDA-MoE.
Algorithmic improvements:
System-level optimizations:
dInfer supports multiple diffusion language model variants with different architectures and sizes. Below are the HuggingFace model links and their corresponding implementation files:
Implementation: modeling_llada2_moe.py
| Model | Size | HuggingFace Link | Description |
|---|---|---|---|
| LLaDA2.0-mini-preview | 16B | inclusionAI/LLaDA2.0-mini-preview | MoE dLLM focused on efficient reasoning and tool use |
| LLaDA2.0-flash-preview | 100B | inclusionAI/LLaDA2.0-flash-preview | Large MoE dLLM targeting advanced code/math reasoning |
Features:
Implementation: modeling_fused_olmoe.py
| Model | Size | HuggingFace Link | Description |
|---|---|---|---|
| LLaDA-MoE-7B-A1B-Base | 7B | inclusionAI/LLaDA-MoE-7B-A1B-Base | Pretrained MoE dLLM |
| LLaDA-MoE-7B-A1B-Instruct | 7B | inclusionAI/LLaDA-MoE-7B-A1B-Instruct | Instruction-tuned MoE variant |
Features:
Implementation: modeling_llada.py
| Model | Size | HuggingFace Link | Description |
|---|---|---|---|
| LLaDA-8B-Base | 8B | GSAI-ML/LLaDA-8B-Base | Pretrained dense dLLM |
| LLaDA-8B-Instruct | 8B | GSAI-ML/LLaDA-8B-Instruct | SFT instruction-following variant |
| LLaDA-1.5 | 8B | GSAI-ML/LLaDA-1.5 | LLaDA-8B aligned with VRPO |
Features:
Figure: Benchmark results
Performance on HumanEval:
Speedup comparisons:
Please follow the instruction below to install dInfer.
git clone https://github.com/inclusionAI/dInfer.git
cd dInfer
pip install .
This project supports using LLaDA and LLaDA-MoE checkpoints from HuggingFace. After downloading a model, run the conversion script to fuse MoE experts into FusedMoE format for local loading.
pip install -U huggingface_hub hf_transfer
export HF_HUB_ENABLE_HF_TRANSFER=1
# Example: Instruct checkpoint
hf download inclusionAI/LLaDA-MoE-7B-A1B-Instruct \
--repo-type model \
--local-dir /path/to/LLaDA-MoE-7B-A1B-Instruct
(For LLada2.0-mini/flash, this step should be skipped.)
Use the conversion tool to fuse MoE experts.
# From repo root
python -m tools.transfer.py \
--input /path/to/LLaDA-MoE-7B-A1B-Instruct \
--output /path/to/LLaDA-MoE-7B-A1B-Instruct-fused
After conversion, the output directory contains:
modeling_fused_olmoe.pyconfig.json with:
architectures: [FusedOlmoeForCausalLM]auto_map.AutoModelForCausalLM: modeling_fused_olmoe.FusedOlmoeForCausalLMfrom dinfer.model import AutoModelForCausalLM
from transformers import AutoTokenizer
m = "/path/to/LLaDA-MoE-7B-A1B-Instruct-fused"
tok = AutoTokenizer.from_pretrained(m, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(m, trust_remote_code=True, torch_dtype="bfloat16")
Benchmark-only (speed) — scripts in benchmarks/
--output_dir; no automatic scoring.python benchmarks/benchmark_dataset.py \
--model_name inclusionAI/LLaDA-MoE-7B-A1B-Instruct \
--model_type llada_moe \
--dataset dataset_path \
--gen_len 1024 \
--block_length 64 \
--gpu 0,1,2,3 \
--output_dir runs/llada_moe_threshold \
--use_tp \
--parallel_decoding threshold \
--threshold 0.8 \
--cache dual \
--prefix_look 16 \
--after_look 16 \
--warmup_times 4 \
--cont_weight 0.3
python benchmarks/benchmark_dataset.py \
--model_name inclusionAI/LLaDA2.0-mini-preview \
--model_type llada2 \
--dataset dataset_path \
--gen_len 2048 \
--block_length 32 \
--gpu 0,1,2,3 \
--output_dir runs/llada2_mini \
--use_tp \
--parallel_decoding threshold \
--threshold 0.9 \
--cache prefix \
--use_bd
python benchmarks/benchmark_dataset.py \
--model_name inclusionAI/LLaDA2.0-flash-preview \
--model_type llada2 \
--dataset dataset_path \
--gen_len 2048 \
--block_length 32 \
--gpu 0,1,2,3 \
--output_dir runs/llada2_flash \
--use_tp \
--parallel_decoding threshold \
--threshold 0.9 \
--cache prefix \
--use_bd
benchmark.py — Single-sample profiling.python benchmarks/benchmark.py \
--model_name inclusionAI/LLaDA2.0-mini-preview \
--model_type llada2 \
--gen_len 2048 \
--block_length 32 \
--gpu 0,1,2,3 \
--use_tp \
--parallel_decoding threshold \
--threshold 0.9 \
--cache prefix \
--use_bd
End-to-end evaluation (speed + accuracy) — scripts in evaluations/
lm-eval-harness; computes both TPS and benchmark scores.gsm8k_llada: math reasoning.mbpp_sanitized_llada: sanitized Python code generation.
@article{dinfer,
title={dInfer: An Efficient Inference Framework for Diffusion Language Models},
author={Yuxin Ma, Lun Du, Lanning Wei, Kun Chen, Qian Xu, Kangyu Wang, Guofeng Feng, Guoshan Lu, Lin Liu, Xiaojing Qi, Xinyuan Zhang, Zhen Tao, Haibo Feng, Ziyun Jiang, Ying Xu, Zenan Huang, Yihong Zhuang, Haokai Xu, Jiaqi Hu, Zhenzhong Lan, Junbo Zhao, Jianguo Li, Da Zheng},
year={2025},
journal={arXiv preprint arXiv:2510.08666}
}
Python
99.8%
dInfer is an efficient and extensible inference framework for dLLMs. As illustrated in the following architecture, it modularizes inference into four components: model, diffusion iteration manager, decoder and KV-cache manager. It provides well-designed APIs for flexible algorithms combinations in each component. Now supports batched inference for improved throughput.
Figure: Overall Architecture of dInfer
dInfer supports multiple dLLM variants, including LLaDA and LLaDA-MoE.
Algorithmic improvements:
System-level optimizations:
dInfer supports multiple diffusion language model variants with different architectures and sizes. Below are the HuggingFace model links and their corresponding implementation files:
Implementation: modeling_llada2_moe.py
| Model | Size | HuggingFace Link | Description |
|---|---|---|---|
| LLaDA2.0-mini-preview | 16B | inclusionAI/LLaDA2.0-mini-preview | MoE dLLM focused on efficient reasoning and tool use |
| LLaDA2.0-flash-preview | 100B | inclusionAI/LLaDA2.0-flash-preview | Large MoE dLLM targeting advanced code/math reasoning |
Features:
Implementation: modeling_fused_olmoe.py
| Model | Size | HuggingFace Link | Description |
|---|---|---|---|
| LLaDA-MoE-7B-A1B-Base | 7B | inclusionAI/LLaDA-MoE-7B-A1B-Base | Pretrained MoE dLLM |
| LLaDA-MoE-7B-A1B-Instruct | 7B | inclusionAI/LLaDA-MoE-7B-A1B-Instruct | Instruction-tuned MoE variant |
Features:
Implementation: modeling_llada.py
| Model | Size | HuggingFace Link | Description |
|---|---|---|---|
| LLaDA-8B-Base | 8B | GSAI-ML/LLaDA-8B-Base | Pretrained dense dLLM |
| LLaDA-8B-Instruct | 8B | GSAI-ML/LLaDA-8B-Instruct | SFT instruction-following variant |
| LLaDA-1.5 | 8B | GSAI-ML/LLaDA-1.5 | LLaDA-8B aligned with VRPO |
Features:
Figure: Benchmark results
Performance on HumanEval:
Speedup comparisons:
Please follow the instruction below to install dInfer.
git clone https://github.com/inclusionAI/dInfer.git
cd dInfer
pip install .
This project supports using LLaDA and LLaDA-MoE checkpoints from HuggingFace. After downloading a model, run the conversion script to fuse MoE experts into FusedMoE format for local loading.
pip install -U huggingface_hub hf_transfer
export HF_HUB_ENABLE_HF_TRANSFER=1
# Example: Instruct checkpoint
hf download inclusionAI/LLaDA-MoE-7B-A1B-Instruct \
--repo-type model \
--local-dir /path/to/LLaDA-MoE-7B-A1B-Instruct
(For LLada2.0-mini/flash, this step should be skipped.)
Use the conversion tool to fuse MoE experts.
# From repo root
python -m tools.transfer.py \
--input /path/to/LLaDA-MoE-7B-A1B-Instruct \
--output /path/to/LLaDA-MoE-7B-A1B-Instruct-fused
After conversion, the output directory contains:
modeling_fused_olmoe.pyconfig.json with:
architectures: [FusedOlmoeForCausalLM]auto_map.AutoModelForCausalLM: modeling_fused_olmoe.FusedOlmoeForCausalLMfrom dinfer.model import AutoModelForCausalLM
from transformers import AutoTokenizer
m = "/path/to/LLaDA-MoE-7B-A1B-Instruct-fused"
tok = AutoTokenizer.from_pretrained(m, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(m, trust_remote_code=True, torch_dtype="bfloat16")
Benchmark-only (speed) — scripts in benchmarks/
--output_dir; no automatic scoring.python benchmarks/benchmark_dataset.py \
--model_name inclusionAI/LLaDA-MoE-7B-A1B-Instruct \
--model_type llada_moe \
--dataset dataset_path \
--gen_len 1024 \
--block_length 64 \
--gpu 0,1,2,3 \
--output_dir runs/llada_moe_threshold \
--use_tp \
--parallel_decoding threshold \
--threshold 0.8 \
--cache dual \
--prefix_look 16 \
--after_look 16 \
--warmup_times 4 \
--cont_weight 0.3
python benchmarks/benchmark_dataset.py \
--model_name inclusionAI/LLaDA2.0-mini-preview \
--model_type llada2 \
--dataset dataset_path \
--gen_len 2048 \
--block_length 32 \
--gpu 0,1,2,3 \
--output_dir runs/llada2_mini \
--use_tp \
--parallel_decoding threshold \
--threshold 0.9 \
--cache prefix \
--use_bd
python benchmarks/benchmark_dataset.py \
--model_name inclusionAI/LLaDA2.0-flash-preview \
--model_type llada2 \
--dataset dataset_path \
--gen_len 2048 \
--block_length 32 \
--gpu 0,1,2,3 \
--output_dir runs/llada2_flash \
--use_tp \
--parallel_decoding threshold \
--threshold 0.9 \
--cache prefix \
--use_bd
benchmark.py — Single-sample profiling.python benchmarks/benchmark.py \
--model_name inclusionAI/LLaDA2.0-mini-preview \
--model_type llada2 \
--gen_len 2048 \
--block_length 32 \
--gpu 0,1,2,3 \
--use_tp \
--parallel_decoding threshold \
--threshold 0.9 \
--cache prefix \
--use_bd
End-to-end evaluation (speed + accuracy) — scripts in evaluations/
lm-eval-harness; computes both TPS and benchmark scores.gsm8k_llada: math reasoning.mbpp_sanitized_llada: sanitized Python code generation.
@article{dinfer,
title={dInfer: An Efficient Inference Framework for Diffusion Language Models},
author={Yuxin Ma, Lun Du, Lanning Wei, Kun Chen, Qian Xu, Kangyu Wang, Guofeng Feng, Guoshan Lu, Lin Liu, Xiaojing Qi, Xinyuan Zhang, Zhen Tao, Haibo Feng, Ziyun Jiang, Ying Xu, Zenan Huang, Yihong Zhuang, Haokai Xu, Jiaqi Hu, Zhenzhong Lan, Junbo Zhao, Jianguo Li, Da Zheng},
year={2025},
journal={arXiv preprint arXiv:2510.08666}
}
Python
99.8%