Text Generation
Transformers
Safetensors
qwen2
reasoning
Zero-RL
conversational
text-generation-inference
Instructions to use Elliott/LUFFY-Qwen-Instruct-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Elliott/LUFFY-Qwen-Instruct-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Elliott/LUFFY-Qwen-Instruct-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Elliott/LUFFY-Qwen-Instruct-7B") model = AutoModelForCausalLM.from_pretrained("Elliott/LUFFY-Qwen-Instruct-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Elliott/LUFFY-Qwen-Instruct-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Elliott/LUFFY-Qwen-Instruct-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Elliott/LUFFY-Qwen-Instruct-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Elliott/LUFFY-Qwen-Instruct-7B
- SGLang
How to use Elliott/LUFFY-Qwen-Instruct-7B 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 "Elliott/LUFFY-Qwen-Instruct-7B" \ --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": "Elliott/LUFFY-Qwen-Instruct-7B", "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 "Elliott/LUFFY-Qwen-Instruct-7B" \ --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": "Elliott/LUFFY-Qwen-Instruct-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Elliott/LUFFY-Qwen-Instruct-7B with Docker Model Runner:
docker model run hf.co/Elliott/LUFFY-Qwen-Instruct-7B
Improve language tag
#1
by lbourdois - opened
README.md
CHANGED
|
@@ -1,77 +1,91 @@
|
|
| 1 |
-
---
|
| 2 |
-
base_model:
|
| 3 |
-
- Qwen/Qwen2.5-7B-Instruct
|
| 4 |
-
library_name: transformers
|
| 5 |
-
license: mit
|
| 6 |
-
pipeline_tag: text-generation
|
| 7 |
-
tags:
|
| 8 |
-
- reasoning
|
| 9 |
-
- Zero-RL
|
| 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 |
-
|
| 47 |
-
|
| 48 |
-
---
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- Qwen/Qwen2.5-7B-Instruct
|
| 4 |
+
library_name: transformers
|
| 5 |
+
license: mit
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- reasoning
|
| 9 |
+
- Zero-RL
|
| 10 |
+
language:
|
| 11 |
+
- zho
|
| 12 |
+
- eng
|
| 13 |
+
- fra
|
| 14 |
+
- spa
|
| 15 |
+
- por
|
| 16 |
+
- deu
|
| 17 |
+
- ita
|
| 18 |
+
- rus
|
| 19 |
+
- jpn
|
| 20 |
+
- kor
|
| 21 |
+
- vie
|
| 22 |
+
- tha
|
| 23 |
+
- ara
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
# 📖Introduction
|
| 27 |
+
|
| 28 |
+

|
| 29 |
+
|
| 30 |
+
LUFFY is a reinforcement learning framework that bridges the gap between zero-RL and imitation learning by incorporating off-policy reasoning traces into the training process. Built upon GRPO, LUFFY combines on-policy rollouts with off-policy demonstrations during advantage estimation and introduces **policy shaping** via regularized importance sampling to emphasize low-probability yet crucial actions.
|
| 31 |
+
|
| 32 |
+
### Key Highlights:
|
| 33 |
+
- **Off-Policy Guidance:** Seamlessly integrates external reasoning traces to bootstrap learning from stronger models.
|
| 34 |
+
- **Dynamic Balance:** Learns when to imitate and when to explore, adapting over the course of training.
|
| 35 |
+
- **Policy Shaping:** Emphasizes important actions often ignored in standard policy gradients, enabling better generalization.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## Inference
|
| 40 |
+
|
| 41 |
+
Here’s an example of using LUFFY for inference:
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from transformers import AutoTokenizer
|
| 46 |
+
from vllm import LLM, SamplingParams
|
| 47 |
+
|
| 48 |
+
model_path="Elliott/LUFFY-Qwen-Math-7B-Zero"
|
| 49 |
+
|
| 50 |
+
question = "which number is larger? 9.11 or 9.9?"
|
| 51 |
+
|
| 52 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 53 |
+
messages = [{"role": "user", "content": question}]
|
| 54 |
+
chat = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 55 |
+
|
| 56 |
+
llm = LLM(model=model_path)
|
| 57 |
+
params = SamplingParams(temperature=0.6, max_tokens=8192)
|
| 58 |
+
outputs = llm.generate([chat], params)
|
| 59 |
+
print(outputs[0].outputs[0].text)
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
# 📃Evaluation
|
| 65 |
+
|
| 66 |
+
| **Model** | **AIME 2024** | **AIME 2025** | **AMC** | **MATH-500** | **Minerva** | **Olympiad** | **Avg.** |
|
| 67 |
+
|-----------------------------------|-------------|-------------|---------|---------------|-------------|---------------|----------|
|
| 68 |
+
| Qwen2.5-7B-Instruct | 11.9 | 7.6 | 44.1 | 74.6 | 30.5 | 39.7 | 34.7 |
|
| 69 |
+
| **LUFFY-Qwen-Instruct-7B** | **16.6** | **15.7** | **52.2** | **81.4** | **36.8** | **48.7** | **41.9** |
|
| 70 |
+
|
| 71 |
+
---
|
| 72 |
+
|
| 73 |
+
# 🌻Acknowledgement
|
| 74 |
+
|
| 75 |
+
LUFFY builds upon [veRL](https://github.com/volcengine/verl) and [deepscaler](https://github.com/agentica-project/rllm), and utilizes [vLLM](https://github.com/vllm-project/vllm) for inference. We utilize [Math-Verify](https://github.com/huggingface/Math-Verify) for math reasoning evaluation. We thank the open-source community for datasets and backbones, including [NuminaMath](https://huggingface.co/datasets/AI-MO/NuminaMath-CoT), [OpenR1-Math-220k](https://huggingface.co/datasets/open-r1/OpenR1-Math-220k), [Qwen2.5-Math](https://github.com/QwenLM/Qwen2.5-Math), and [DeepSeek-R1](https://github.com/deepseek-ai/deepseek-r1) model.
|
| 76 |
+
|
| 77 |
+
Code: https://github.com/ElliottYan/LUFFY
|
| 78 |
+
|
| 79 |
+
# Citation
|
| 80 |
+
If you find our model, data, or evaluation code useful, please kindly cite our paper:
|
| 81 |
+
```bib
|
| 82 |
+
@misc{luffy,
|
| 83 |
+
title={Learning to Reason under Off-Policy Guidance},
|
| 84 |
+
author={Jianhao Yan and Yafu Li and Zican Hu and Zhi Wang and Ganqu Cui and Xiaoye Qu and Yu Cheng and Yue Zhang},
|
| 85 |
+
year={2025},
|
| 86 |
+
eprint={2504.14945},
|
| 87 |
+
archivePrefix={arXiv},
|
| 88 |
+
primaryClass={cs.LG},
|
| 89 |
+
url={https://arxiv.org/abs/2504.14945},
|
| 90 |
+
}
|
| 91 |
```
|