Instructions to use JetLM/SDAR-8B-Chat with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JetLM/SDAR-8B-Chat with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="JetLM/SDAR-8B-Chat", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("JetLM/SDAR-8B-Chat", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use JetLM/SDAR-8B-Chat with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JetLM/SDAR-8B-Chat" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JetLM/SDAR-8B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/JetLM/SDAR-8B-Chat
- SGLang
How to use JetLM/SDAR-8B-Chat 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 "JetLM/SDAR-8B-Chat" \ --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": "JetLM/SDAR-8B-Chat", "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 "JetLM/SDAR-8B-Chat" \ --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": "JetLM/SDAR-8B-Chat", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use JetLM/SDAR-8B-Chat with Docker Model Runner:
docker model run hf.co/JetLM/SDAR-8B-Chat
Update README.md
Browse files
README.md
CHANGED
|
@@ -2,88 +2,56 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: transformers
|
| 4 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
# Introduction
|
| 6 |
|
| 7 |
-
**SDAR**(**S**ynergy of **D**iffusion and **A**uto**R**egression)
|
| 8 |
-
|
| 9 |
-
>
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
The following example shows how to quickly load a model with JetEngine and run a prompt end-to-end.
|
| 47 |
-
|
| 48 |
-
```python
|
| 49 |
-
import os
|
| 50 |
-
from jetengine import LLM, SamplingParams
|
| 51 |
-
from transformers import AutoTokenizer
|
| 52 |
-
|
| 53 |
-
model_path = os.path.expanduser("/path/to/your/sdar-model")
|
| 54 |
-
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 55 |
-
# Initialize the LLM
|
| 56 |
-
llm = LLM(
|
| 57 |
-
model_path,
|
| 58 |
-
enforce_eager=True,
|
| 59 |
-
tensor_parallel_size=1,
|
| 60 |
-
mask_token_id=151669, # Optional: only needed for masked/diffusion models
|
| 61 |
-
block_length=4
|
| 62 |
-
)
|
| 63 |
-
|
| 64 |
-
# Set sampling/generation parameters
|
| 65 |
-
sampling_params = SamplingParams(
|
| 66 |
-
temperature=1.0,
|
| 67 |
-
topk=0,
|
| 68 |
-
topp=1.0,
|
| 69 |
-
max_tokens=256,
|
| 70 |
-
remasking_strategy="low_confidence_dynamic",
|
| 71 |
-
block_length=4,
|
| 72 |
-
denoising_steps=4,
|
| 73 |
-
dynamic_threshold=0.9
|
| 74 |
-
)
|
| 75 |
-
|
| 76 |
-
# Prepare a simple chat-style prompt
|
| 77 |
-
prompt = tokenizer.apply_chat_template(
|
| 78 |
-
[{"role": "user", "content": "Explain what reinforcement learning is in simple terms."}],
|
| 79 |
-
tokenize=False,
|
| 80 |
-
add_generation_prompt=True
|
| 81 |
-
)
|
| 82 |
-
|
| 83 |
-
# Generate text
|
| 84 |
-
outputs = llm.generate_streaming([prompt], sampling_params)
|
| 85 |
-
```
|
| 86 |
-
|
| 87 |
-
## Hightlights
|
| 88 |
-
- **Performance**: SDAR-1.7B-Chat achieves state-of-the-art.
|
| 89 |
-
- **Efficiency**: SDAR provides over 2× faster inference speed compared to the same-size AR models, while maintaining comparable performance.
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
library_name: transformers
|
| 4 |
---
|
| 5 |
+
|
| 6 |
+
# SDAR
|
| 7 |
+
|
| 8 |
+
<div align="center">
|
| 9 |
+
<img src="https://raw.githubusercontent.com/JetAstra/SDAR/main/assets/SDAR_doc_head.png">
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
<div> </div>
|
| 13 |
+
|
| 14 |
+
[💻Github Repo](https://github.com/JetAstra/SDAR) • [🤗Model Collections](https://huggingface.co/collections/JetLM/sdar-689b1b6d392a4eeb2664f8ff)
|
| 15 |
+
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
# Introduction
|
| 19 |
|
| 20 |
+
**SDAR** (**S**ynergy of **D**iffusion and **A**uto**R**egression) model is a new large language model that integrates autoregressive (AR) and discrete diffusion modeling strategies. It combines the efficient training paradigm of AR models with the highly parallel inference capability of diffusion models, while delivering performance fully on par with SOTA open-source AR models. At the same time, SDAR sets a new benchmark as the most powerful diffusion language model to date. We highlight three major conclusions from our study:
|
| 21 |
+
|
| 22 |
+
> [!IMPORTANT]
|
| 23 |
+
> Take-home message
|
| 24 |
+
>
|
| 25 |
+
> - **Balanced Efficiency:** SDAR unifies the **efficient training** of AR models with the **parallel inference** of diffusion, achieving both fast training and inference.
|
| 26 |
+
> - **Fair Comparisons:** In rigorously controlled experiments, SDAR achieves **on-par general task performance** with strong AR baselines, ensuring credibility and reproducibility.
|
| 27 |
+
> - **Superior Learning Efficiency:** On complex scientific reasoning tasks (e.g., GPQA, ChemBench, Physics), SDAR shows **clear gains over AR models** of the same scale, approaching or even exceeding leading closed-source systems.
|
| 28 |
+
|
| 29 |
+
# Performance
|
| 30 |
+
|
| 31 |
+
### SDAR v.s. Qwen
|
| 32 |
+
|
| 33 |
+
For **SDAR** models, inference hyperparameters are set to: `block_length = 4`, `denoising_steps = 4`, greedy decoding.
|
| 34 |
+
|
| 35 |
+
For **Qwen3-1.7B-AR-SFT** and **Qwen3-30B-AR-SFT**, we use *greedy decoding*, and the base models **Qwen3-1.7B-Base** and **Qwen3-30B-Base** are derived from the [Qwen3 Technical Report](https://arxiv.org/abs/2505.09388).
|
| 36 |
+
|
| 37 |
+
<p align="center">
|
| 38 |
+
<img src="https://raw.githubusercontent.com/JetAstra/SDAR/main/assets/table1.png" style="max-width:100%; height:auto;">
|
| 39 |
+
<p align="center">
|
| 40 |
+
|
| 41 |
+
### SDAR-Sci v.s. AR Baseline
|
| 42 |
+
|
| 43 |
+
This table presents a **controlled comparison** between AR and SDAR under the same backbone and dataset settings.
|
| 44 |
+
The results are averaged over 8 runs for GPQA, and over 32 runs each for AIME 2024, AIME 2025, and LiveMathBench.
|
| 45 |
+
|
| 46 |
+
<p align="center">
|
| 47 |
+
<img src="https://raw.githubusercontent.com/JetAstra/SDAR/main/assets/table2.png" style="max-width:100%; height:auto;">
|
| 48 |
+
<p align="center">
|
| 49 |
+
|
| 50 |
+
#### SDAR-Sci v.s. Other Models
|
| 51 |
+
|
| 52 |
+
This table positions **SDAR-30B-A3B-Sci(sample)** against leading open-source and closed-source LLMs.
|
| 53 |
+
Scores for external models are sourced from the [InternLM/Intern-S1](https://github.com/InternLM/Intern-S1) repository.
|
| 54 |
+
|
| 55 |
+
<p align="center">
|
| 56 |
+
<img src="https://raw.githubusercontent.com/JetAstra/SDAR/main/assets/table3.png" style="max-width:100%; height:auto;">
|
| 57 |
+
<p align="center">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|