Instructions to use FSCCS/dMoE-16B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FSCCS/dMoE-16B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FSCCS/dMoE-16B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("FSCCS/dMoE-16B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use FSCCS/dMoE-16B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FSCCS/dMoE-16B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FSCCS/dMoE-16B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/FSCCS/dMoE-16B
- SGLang
How to use FSCCS/dMoE-16B 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 "FSCCS/dMoE-16B" \ --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": "FSCCS/dMoE-16B", "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 "FSCCS/dMoE-16B" \ --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": "FSCCS/dMoE-16B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use FSCCS/dMoE-16B with Docker Model Runner:
docker model run hf.co/FSCCS/dMoE-16B
Add model card and metadata (#1)
Browse files- Add model card and metadata (558b862f8634ceeae4a35dabb7c362ac3bfe7a56)
Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# dMoE-16B: dLLMs with Learnable Block Experts
|
| 8 |
+
|
| 9 |
+
[dMoE](https://fscdc.github.io/dMoE/) is a block-level Mixture-of-Experts (MoE) framework designed for Diffusion Large Language Models (dLLMs). By aggregating token-level expert distributions within each block into a unified block-level distribution, dMoE substantially reduces the number of uniquely activated experts during inference, mitigating memory-bound bottlenecks without sacrificing performance.
|
| 10 |
+
|
| 11 |
+
- **Paper:** [dMoE: dLLMs with Learnable Block Experts](https://huggingface.co/papers/2605.30876)
|
| 12 |
+
- **Project Page:** [https://fscdc.github.io/dMoE/](https://fscdc.github.io/dMoE/)
|
| 13 |
+
- **Repository:** [https://github.com/fscdc/dMoE](https://github.com/fscdc/dMoE)
|
| 14 |
+
|
| 15 |
+
## Highlights
|
| 16 |
+
|
| 17 |
+
- **Learnable Block Experts**: Introduces block-level MoE routing into dLLMs, drastically compressing the number of activated unique experts across diffusion steps.
|
| 18 |
+
- **Reduced MoE Bandwidth**: Significantly reduces memory bandwidth consumed by expert weight loading during the block diffusion process.
|
| 19 |
+
- **Improved Efficiency-Accuracy Trade-off**: Achieves 1.14x to 1.66x end-to-end latency speedup while maintaining competitive performance on benchmarks.
|
| 20 |
+
- **Plug-and-play on LLaDA-2.0**: Built directly on top of LLaDA-2.0-mini without architectural changes.
|
| 21 |
+
|
| 22 |
+
## Sample Usage
|
| 23 |
+
|
| 24 |
+
The model can be used with the Transformers library. Note that it requires `trust_remote_code=True` to load the custom architecture.
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
import torch
|
| 28 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 29 |
+
|
| 30 |
+
MODEL_NAME = "FSCCS/dMoE-16B"
|
| 31 |
+
device = "cuda:0"
|
| 32 |
+
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 34 |
+
MODEL_NAME, trust_remote_code=True, torch_dtype=torch.bfloat16
|
| 35 |
+
).to(device).eval()
|
| 36 |
+
|
| 37 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
| 38 |
+
|
| 39 |
+
prompt = "A robe takes 2 bolts of blue fiber and half that much white fiber. How many bolts in total does it take?" + "
|
| 40 |
+
Let's think step by step
|
| 41 |
+
"
|
| 42 |
+
|
| 43 |
+
messages = [[{"role": "user", "content": prompt}]]
|
| 44 |
+
input_text = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
|
| 45 |
+
|
| 46 |
+
inputs = tokenizer(input_text, return_tensors="pt", padding_side="left")
|
| 47 |
+
input_ids = inputs["input_ids"].to(device)
|
| 48 |
+
|
| 49 |
+
with torch.no_grad():
|
| 50 |
+
out, unique_experts_count = model.generate(
|
| 51 |
+
input_ids,
|
| 52 |
+
steps=32,
|
| 53 |
+
gen_length=2048,
|
| 54 |
+
block_length=32,
|
| 55 |
+
temperature=0.0,
|
| 56 |
+
eos_early_stop=True,
|
| 57 |
+
)
|
| 58 |
+
|
| 59 |
+
generated = out[:, input_ids.shape[1]:]
|
| 60 |
+
result = tokenizer.batch_decode(generated, skip_special_tokens=True)
|
| 61 |
+
|
| 62 |
+
print("Output:", result[0])
|
| 63 |
+
print("Unique experts count:", unique_experts_count)
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Citation
|
| 67 |
+
|
| 68 |
+
```bibtex
|
| 69 |
+
@article{feng2026dmoe,
|
| 70 |
+
title={dMoE: dLLMs with Learnable Block Experts},
|
| 71 |
+
author={Feng, Sicheng and Chen, Zigeng and Fang, Gongfan and Ma, Xinyin and Wang, Xinchao},
|
| 72 |
+
journal={arXiv preprint arXiv:2605.30876},
|
| 73 |
+
year={2026}
|
| 74 |
+
}
|
| 75 |
+
```
|