Improve model card: Add pipeline tag, library name, links, and usage example

#1
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +63 -4
README.md CHANGED
@@ -1,9 +1,68 @@
1
  ---
2
- license: mit
3
- datasets:
4
- - TIGER-Lab/AceCode-87K
5
  base_model:
6
  - GSAI-ML/LLaDA-8B-Instruct
 
 
 
 
 
7
  ---
8
 
9
- Post-Training Full models on code task based on LLaDA-8B-Instruct for the paper Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
 
 
2
  base_model:
3
  - GSAI-ML/LLaDA-8B-Instruct
4
+ datasets:
5
+ - TIGER-Lab/AceCode-87K
6
+ license: mit
7
+ pipeline_tag: text-generation
8
+ library_name: transformers
9
  ---
10
 
11
+ # ESPO: Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective
12
+
13
+ This repository contains Post-Training Full models on code tasks based on LLaDA-8B-Instruct for the paper [Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective](https://huggingface.co/papers/2512.03759).
14
+
15
+ ESPO (ELBO-based Sequence-level Policy Optimization) is a principled reinforcement learning framework for Diffusion Large Language Models (dLLMs). Unlike traditional autoregressive RL methods (e.g., GRPO) that rely on token-level likelihoods, ESPO views the **entire sequence generation as a single action** and leverages the **ELBO** as a tractable proxy for sequence-level likelihood. This design resolves the fundamental mismatch between RL and the non-autoregressive nature of dLLMs.
16
+
17
+ ESPO introduces:
18
+ - **Sequence-level optimization** for diffusion LLMs via the ELBO objective.
19
+ - **Per-token normalized ratio estimation** and **robust KL regularization** for stable large-scale training.
20
+ - **Consistent gains** across math, coding, and planning benchmarks.
21
+
22
+ **Project Page**: [https://jingyangou.github.io/ESPO-Demo/](https://jingyangou.github.io/ESPO-Demo/)
23
+ **Code**: [https://github.com/ML-GSAI/ESPO](https://github.com/ML-GSAI/ESPO)
24
+
25
+ <div style="display: flex; justify-content: center; flex-wrap: wrap;">
26
+ <img src="https://github.com/ML-GSAI/ESPO/raw/main/fig/sudoku_ablation_1_smoothed-page1.png" style="width: 49%" />
27
+ <img src="https://github.com/ML-GSAI/ESPO/raw/main/fig/sudoku_kl_ablation_smoothed.png" style="width: 49%" />
28
+ </div>
29
+
30
+ ## Quickstart
31
+
32
+ We release ESPO-fine-tuned checkpoints built on LLaDA-8B-Instruct. ESPO-Code is released as a full fine-tuned model (no LoRA). ESPO-GSM8K, ESPO-Math, ESPO-Countdown, and ESPO-Sudoku are provided as LoRA adapters, which can be loaded on top of the base LLaDA-8B-Instruct model for lightweight and efficient fine-tuning.
33
+
34
+ ```python
35
+ from transformers import AutoModelForCausalLM, AutoTokenizer
36
+ from peft import PeftModel
37
+ # Note: 'eval.generate_utils' is part of the original ESPO GitHub repository.
38
+ # You might need to clone the repository (https://github.com/ML-GSAI/ESPO)
39
+ # and add its root directory to your Python path to import `eval.generate_utils`.
40
+ from eval.generate_utils import generate
41
+
42
+ base_model_path = 'GSAI-ML/LLaDA-8B-Instruct'
43
+ peft_model_path = 'GSAI-ML/ESPO-Math' # Example: change to ESPO-Code for the full model
44
+ tokenizer = AutoTokenizer.from_pretrained(base_model_path)
45
+ model = AutoModelForCausalLM.from_pretrained(
46
+ base_model_path, trust_remote_code=True,torch_dtype="bfloat16", device_map="cuda")
47
+ peft_model = PeftModel.from_pretrained(model, peft_model_path, device_map="cuda")
48
+ 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?
49
+
50
+ Write your answer in the form $(x, y)$ where $x$ and $y$ are real numbers."
51
+ messages = [{"role": "user", "content": prompt}]
52
+ input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
53
+ output_ids = generate(peft_model, input_ids,tokenizer, steps=128, gen_length=256, temperature=0.9,remasking="low_confidence",)
54
+ output_text = tokenizer.batch_decode(output_ids[:, input_ids.shape[1]:], skip_special_tokens=True)[0]
55
+ print(output_text)
56
+ ```
57
+
58
+ ## Citation
59
+ If you find ESPO useful in your research, please consider citing our paper:
60
+
61
+ ```bibtex
62
+ @article{ou2025principledrldiffusionllms,
63
+ title={Principled RL for Diffusion LLMs Emerges from a Sequence-Level Perspective},
64
+ author={Jingyang Ou and Jiaqi Han and Minkai Xu and Shaoxuan Xu and Jianwen Xie and Stefano Ermon and Yi Wu and Chongxuan Li},
65
+ journal={arXiv preprint arXiv:2512.03759},
66
+ year={2025},
67
+ }
68
+ ```