Text Generation
Transformers
Safetensors
llada2_moe
dllm
diffusion
llm
text_generation
conversational
custom_code
Instructions to use inclusionAI/LLaDA2.2-flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/LLaDA2.2-flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="inclusionAI/LLaDA2.2-flash", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("inclusionAI/LLaDA2.2-flash", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use inclusionAI/LLaDA2.2-flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inclusionAI/LLaDA2.2-flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inclusionAI/LLaDA2.2-flash", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/inclusionAI/LLaDA2.2-flash
- SGLang
How to use inclusionAI/LLaDA2.2-flash 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 "inclusionAI/LLaDA2.2-flash" \ --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": "inclusionAI/LLaDA2.2-flash", "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 "inclusionAI/LLaDA2.2-flash" \ --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": "inclusionAI/LLaDA2.2-flash", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use inclusionAI/LLaDA2.2-flash with Docker Model Runner:
docker model run hf.co/inclusionAI/LLaDA2.2-flash
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- dllm
|
| 6 |
+
- diffusion
|
| 7 |
+
- llm
|
| 8 |
+
- text_generation
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# LLaDA2.2-flash
|
| 12 |
+
|
| 13 |
+
**LLaDA2.2-flash** is an agent-oriented diffusion language model in the LLaDA2 series. By introducing **Levenshtein Editing** (with `DELETE` and `INSERT` control tokens) to diffusion language modeling, it represents the LLaDA2 series' first step in agentic applications, including long-context tool use, multi-turn interaction, and robust error correction.
|
| 14 |
+
|
| 15 |
+
<!-- TODO: Add final release image / performance image. -->
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## 📊 Benchmarks
|
| 20 |
+
The following tables compare **LLaDA2.2-flash** and **Ling-2.6-flash** in terms of agentic benchmark scores and throughput (TPS).
|
| 21 |
+
|
| 22 |
+
**Agentic benchmark scores**
|
| 23 |
+
|
| 24 |
+
| Benchmark | LLaDA2.2-flash | Ling-2.6-flash |
|
| 25 |
+
| --- | ---: | ---: |
|
| 26 |
+
| SWE-bench Verified | 49.28 | 61.20<sup>†</sup> |
|
| 27 |
+
| SWE-bench Pro | 30.10 | 31.88 |
|
| 28 |
+
| SWE-bench Multilingual | 25.00 | 33.73 |
|
| 29 |
+
| τ²-Bench | 80.33 | 76.36<sup>†</sup> |
|
| 30 |
+
| Claw-Eval | 64.22 | 64.56<sup>†</sup> |
|
| 31 |
+
| PinchBench | 81.66 | 81.30<sup>†</sup> |
|
| 32 |
+
| MCP-Atlas | 46.21 | 41.12 |
|
| 33 |
+
| BFCL-V4 | 60.78 | 66.81 |
|
| 34 |
+
|
| 35 |
+
> **LLaDA2.2-flash evaluation setup:** The SWE-bench series was evaluated using the Claude Code scaffold. Across all benchmarks, we used a 128K context window with `temperature=1.0`, `block_length=32`, `threshold=0.5`, and `editing_threshold=0.0`. Each score represents the average of five runs.
|
| 36 |
+
|
| 37 |
+
<sup>†</sup> The Ling-2.6-flash score on SWE-bench Verified is taken from the <a href="https://arxiv.org/abs/2606.15079">Ling and Ring 2.6 Technical Report</a>, where it was obtained using the OpenHands scaffold. The Ling-2.6-flash scores on τ²-Bench, Claw-Eval, and PinchBench are also sourced from the technical report, whereas its SWE-bench Pro and SWE-bench Multilingual scores were evaluated by us using the same Claude Code scaffold as LLaDA2.2-flash.
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
**Throughput (TPS)**
|
| 41 |
+
|
| 42 |
+
| Benchmark | LLaDA2.2-flash (TPS) | Ling-2.6-flash (TPS) |
|
| 43 |
+
| --- | ---: | ---: |
|
| 44 |
+
| SWE-bench Verified | 519.0 | 303.2 |
|
| 45 |
+
| SWE-bench Pro | 485.3 | 283.4 |
|
| 46 |
+
| SWE-bench Multilingual | 459.5 | 200.6 |
|
| 47 |
+
| $\tau^2$-Bench | 592.8 | 334.9 |
|
| 48 |
+
| BFCL-V4 | 703.82 | 331.5 |
|
| 49 |
+
|
| 50 |
+
> **Ling-2.6-flash evaluation setup:** MTP was enabled with 4 draft tokens.
|
| 51 |
+
|
| 52 |
+
More results will be released in the upcoming technical report.
|
| 53 |
+
|
| 54 |
+
---
|
| 55 |
+
|
| 56 |
+
## 🚀 Highlights
|
| 57 |
+
|
| 58 |
+
+ **Efficient 128K Diffusion Infrastructure**: LLaDA2.2-flash extends the context window to **128K** and introduces **Block Routing**, which bounds MoE expert activation at the diffusion-block level to enable efficient long-context agentic workloads.
|
| 59 |
+
|
| 60 |
+
+ **Levenshtein Editing**: We introduces **DELETE** and **INSERT** control tokens, allowing diffusion decoding to edit sequence structure, remove redundant content, and create insertion slots during parallel generation.
|
| 61 |
+
|
| 62 |
+
+ **Agentic Reinforcement Learning**: We propose **Levenshtein Editing ELBO-based Block-level Policy Optimization (L-EBPO)**, which leverages agentic environmental rewards to train levenshtein editing and error correction in multi-turn tool-use scenarios.
|
| 63 |
+
|
| 64 |
+
---
|
| 65 |
+
|
| 66 |
+
## 📦 Model Variants
|
| 67 |
+
|
| 68 |
+
| Model ID | Description | Hugging Face Link |
|
| 69 |
+
| --- | --- | --- |
|
| 70 |
+
| `inclusionAI/LLaDA2.2-flash` | Agent-oriented MoE diffusion language model with Levenshtein Editing. | [🤗 Model Card](https://huggingface.co/inclusionAI/LLaDA2.2-flash) |
|
| 71 |
+
|
| 72 |
+
<!-- TODO: Add other LLaDA2.2 variants if available. -->
|
| 73 |
+
|
| 74 |
+
---
|
| 75 |
+
|
| 76 |
+
## 🔍 Model Overview
|
| 77 |
+
|
| 78 |
+
**LLaDA2.2-flash** has the following specifications:
|
| 79 |
+
|
| 80 |
+
+ **Type**: Mixture-of-Experts (MoE) Diffusion Language Model with Levenshtein Editing
|
| 81 |
+
+ **Context Length**: 128K tokens
|
| 82 |
+
+ **Levenshtein Editing Control Tokens**: `DELETE`, `INSERT`
|
| 83 |
+
+ **Total Parameters (Non-Embedding)**: 100B
|
| 84 |
+
+ **Number of Layers**: 32
|
| 85 |
+
+ **Attention Heads**: 32
|
| 86 |
+
+ **Positional Encoding**: Rotary Position Embedding (RoPE)
|
| 87 |
+
+ **Vocabulary Size**: 157,184
|
| 88 |
+
|
| 89 |
+
---
|
| 90 |
+
|
| 91 |
+
## 🤗 Hugging Face Transformers
|
| 92 |
+
|
| 93 |
+
Make sure you have `transformers` and its dependencies installed.
|
| 94 |
+
|
| 95 |
+
<!-- TODO: Verify the final inference API, model path, and recommended generation parameters. -->
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
import torch
|
| 99 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 100 |
+
|
| 101 |
+
model_path = "inclusionAI/LLaDA2.2-flash"
|
| 102 |
+
device = "auto"
|
| 103 |
+
|
| 104 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 105 |
+
model_path,
|
| 106 |
+
trust_remote_code=True,
|
| 107 |
+
device_map=device,
|
| 108 |
+
)
|
| 109 |
+
model = model.to(torch.bfloat16)
|
| 110 |
+
model.eval()
|
| 111 |
+
|
| 112 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 113 |
+
|
| 114 |
+
prompt = """Calculate 1+5-28*0.5-200=?"""
|
| 115 |
+
input_ids = tokenizer.apply_chat_template(
|
| 116 |
+
[{"role": "user", "content": prompt}],
|
| 117 |
+
add_generation_prompt=True,
|
| 118 |
+
tokenize=True,
|
| 119 |
+
return_tensors="pt",
|
| 120 |
+
).input_ids
|
| 121 |
+
|
| 122 |
+
generated_tokens = model.generate(
|
| 123 |
+
inputs=input_ids,
|
| 124 |
+
eos_early_stop=True,
|
| 125 |
+
gen_length=512,
|
| 126 |
+
block_length=32,
|
| 127 |
+
threshold=0.5,
|
| 128 |
+
editing_threshold=0.0,
|
| 129 |
+
temperature=0.0,
|
| 130 |
+
)
|
| 131 |
+
|
| 132 |
+
generated_answer = tokenizer.decode(
|
| 133 |
+
generated_tokens[0],
|
| 134 |
+
skip_special_tokens=True,
|
| 135 |
+
)
|
| 136 |
+
print(generated_answer)
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
### Best Practices
|
| 140 |
+
|
| 141 |
+
<!-- TODO: Confirm final recommended values for Speed Mode and Quality Mode. -->
|
| 142 |
+
|
| 143 |
+
To achieve optimal performance, we recommend starting with the following settings:
|
| 144 |
+
|
| 145 |
+
1. **Sampling Parameters**: Use `block_length=32`, `temperature=0.0`, `top_p=None`, and `top_k=None` as stable default settings.
|
| 146 |
+
|
| 147 |
+
2. **Denoising Thresholds**: Tune `threshold`, `editing_threshold`, and `max_post_steps` according to the speed-quality trade-off required by the application. Lower thresholds may improve inference speed but can lead to increased repetition or unstable outputs.
|
| 148 |
+
|
| 149 |
+
3. **Long-Context Agentic Workloads**: For long-context tool-use and multi-turn agent applications, we recommend using **SGLang** as the serving backend. Please ensure that the serving stack is configured for the 128K context window and the model's MoE diffusion inference requirements.
|
| 150 |
+
|
| 151 |
+
---
|
| 152 |
+
|
| 153 |
+
## 🤖 ModelScope
|
| 154 |
+
|
| 155 |
+
If you are in mainland China, we strongly recommend accessing our model from 🤖 [ModelScope](https://modelscope.cn/models/inclusionAI/LLaDA2.2-flash)
|
| 156 |
+
|
| 157 |
+
---
|
| 158 |
+
|
| 159 |
+
## Deployment
|
| 160 |
+
|
| 161 |
+
### SGLang
|
| 162 |
+
|
| 163 |
+
SGLang deployment support is coming soon.
|
| 164 |
+
|
| 165 |
+
---
|
| 166 |
+
|
| 167 |
+
## 🌐 License
|
| 168 |
+
|
| 169 |
+
This project is licensed under the terms of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
| 170 |
+
|
| 171 |
+
---
|
| 172 |
+
|
| 173 |
+
## 🤝 Contact & Collaboration
|
| 174 |
+
|
| 175 |
+
For questions, collaboration opportunities, or feedback, please reach out via [Hugging Face](https://huggingface.co/inclusionAI/LLaDA2.2-flash) or open an issue in the [repository](https://github.com/inclusionAI).
|
| 176 |
+
|
| 177 |
+
Join us in advancing open, efficient, and intelligent diffusion language models for agentic applications.
|
| 178 |
+
|
| 179 |
+
---
|
| 180 |
+
|