Improve model card: Add metadata, links, usage example, and citation
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,9 +1,57 @@
|
|
| 1 |
---
|
| 2 |
-
license: mit
|
| 3 |
-
datasets:
|
| 4 |
-
- Jiayi-Pan/Countdown-Tasks-3to4
|
| 5 |
base_model:
|
| 6 |
- GSAI-ML/LLaDA-8B-Instruct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
---
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
base_model:
|
| 3 |
- GSAI-ML/LLaDA-8B-Instruct
|
| 4 |
+
datasets:
|
| 5 |
+
- Jiayi-Pan/Countdown-Tasks-3to4
|
| 6 |
+
license: mit
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# ESPO-Countdown-LLaDA-8B-Instruct-LoRA
|
| 12 |
+
|
| 13 |
+
This repository contains a LoRA adapter for the `GSAI-ML/LLaDA-8B-Instruct` model, fine-tuned on the Countdown task using the **ELBO-based Sequence-level Policy Optimization (ESPO)** framework, as described in the paper [Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective](https://huggingface.co/papers/2512.03759).
|
| 14 |
+
|
| 15 |
+
**ESPO** is a principled reinforcement learning framework designed for diffusion large language models (dLLMs). It addresses the fundamental challenges of adapting RL methods to dLLMs by treating entire sequence generation as a single action and leveraging the ELBO (Evidence Lower Bound) as a tractable sequence-level likelihood proxy. This approach resolves the mismatch between RL and the non-autoregressive nature of dLLMs, leading to significant performance improvements on mathematical reasoning, coding, and planning tasks.
|
| 16 |
+
|
| 17 |
+
- 📚 Paper: [Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective](https://huggingface.co/papers/2512.03759)
|
| 18 |
+
- 🌐 Project Page: [ESPO Demo](https://jingyangou.github.io/ESPO-Demo/)
|
| 19 |
+
- 💻 Code: [ML-GSAI/ESPO](https://github.com/ML-GSAI/ESPO)
|
| 20 |
+
|
| 21 |
+
## Sample Usage
|
| 22 |
+
|
| 23 |
+
You can load and use this ESPO-fine-tuned LoRA adapter on top of the base LLaDA-8B-Instruct model. Below is a quick start example demonstrating how to perform inference.
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 27 |
+
from peft import PeftModel
|
| 28 |
+
from eval.generate_utils import generate # Note: `eval.generate_utils` is a custom module from the GitHub repository and needs to be accessible.
|
| 29 |
+
|
| 30 |
+
base_model_path = 'GSAI-ML/LLaDA-8B-Instruct'
|
| 31 |
+
peft_model_path = 'GSAI-ML/ESPO-Math' # Replace with 'GSAI-ML/ESPO-Countdown' for this specific model
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_path)
|
| 33 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 34 |
+
base_model_path, trust_remote_code=True,torch_dtype="bfloat16", device_map="cuda")
|
| 35 |
+
peft_model = PeftModel.from_pretrained(model, peft_model_path, device_map="cuda")
|
| 36 |
+
prompt = "The point $(0,0)$ is reflected over the vertical line $x=1$. When its image is then reflected over the line $y=2$, what is the resulting point?\
|
| 37 |
+
\
|
| 38 |
+
Write your answer in the form $(x, y)$ where $x$ and $y$ are real numbers."
|
| 39 |
+
messages = [{"role": "user", "content": prompt}]
|
| 40 |
+
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
|
| 41 |
+
output_ids = generate(peft_model, input_ids,tokenizer, steps=128, gen_length=256, temperature=0.9,remasking="low_confidence",)
|
| 42 |
+
output_text = tokenizer.batch_decode(output_ids[:, input_ids.shape[1]:], skip_special_tokens=True)[0]
|
| 43 |
+
print(output_text)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Citation
|
| 47 |
+
|
| 48 |
+
If you find ESPO useful in your research, please consider citing our paper:
|
| 49 |
+
|
| 50 |
+
```bibtex
|
| 51 |
+
@article{ou2025principledrldiffusionllms,
|
| 52 |
+
title={Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective},
|
| 53 |
+
author={Jingyang Ou and Jiaqi Han and Minkai Xu and Shaoxuan Xu and Jianwen Xie and Stefano Ermon and Yi Wu and Chongxuan Li},
|
| 54 |
+
journal={arXiv preprint arXiv:2512.03759},
|
| 55 |
+
year={2025},
|
| 56 |
+
}
|
| 57 |
+
```
|