Improve model card: Add library, GitHub link, paper details, and usage example (#1)
Browse files- Improve model card: Add library, GitHub link, paper details, and usage example (5397964d05a26cde535a4f93a1b69f25d35ec954)
Co-authored-by: Niels Rogge <[email protected]>
README.md
CHANGED
|
@@ -1,20 +1,108 @@
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-1.5B
|
| 3 |
-
license: apache-2.0
|
| 4 |
datasets:
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
| 6 |
metrics:
|
| 7 |
-
|
| 8 |
pipeline_tag: text-generation
|
| 9 |
-
|
| 10 |
-
- en
|
| 11 |
---
|
| 12 |
|
| 13 |
# Qwen2.5-1.5B-GRPO-MATH-1EPOCH
|
| 14 |
|
| 15 |
-
**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
---
|
| 20 |
|
|
@@ -34,5 +122,4 @@ A GRPO-fine-tuned version of Qwen2.5-1.5B trained on the MATH dataset.
|
|
| 34 |
journal = {arXiv preprint arXiv:2402.03300},
|
| 35 |
year = {2024},
|
| 36 |
}
|
| 37 |
-
```
|
| 38 |
-
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2.5-1.5B
|
|
|
|
| 3 |
datasets:
|
| 4 |
+
- math
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
license: apache-2.0
|
| 8 |
metrics:
|
| 9 |
+
- accuracy
|
| 10 |
pipeline_tag: text-generation
|
| 11 |
+
library_name: transformers
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
# Qwen2.5-1.5B-GRPO-MATH-1EPOCH
|
| 15 |
|
| 16 |
+
This model is a GRPO-fine-tuned version of Qwen2.5-1.5B trained on the MATH dataset, as presented in the paper [**Learning to Reason without External Rewards**](https://huggingface.co/papers/2505.19590).
|
| 17 |
+
|
| 18 |
+
**Abstract from the paper:**
|
| 19 |
+
Training large language models (LLMs) for complex reasoning via Reinforcement Learning with Verifiable Rewards (RLVR) is effective but limited by reliance on costly, domain-specific supervision. We explore Reinforcement Learning from Internal Feedback (RLIF), a framework that enables LLMs to learn from intrinsic signals without external rewards or labeled data. We propose Intuitor, an RLIF method that uses a model's own confidence, termed self-certainty, as its sole reward signal. Intuitor replaces external rewards in Group Relative Policy Optimization (GRPO) with self-certainty scores, enabling fully unsupervised learning. Experiments demonstrate that Intuitor matches GRPO's performance on mathematical benchmarks while achieving superior generalization to out-of-domain tasks like code generation, without requiring gold solutions or test cases. Our findings show that intrinsic model signals can drive effective learning across domains, offering a scalable alternative to RLVR for autonomous AI systems where verifiable rewards are unavailable.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## Overview of Intuitor and RLIF
|
| 24 |
+
|
| 25 |
+
**Intuitor** is a reinforcement learning method that fine-tunes large language models (LLMs) using *self-certainty*—the model’s own internal confidence—as the sole reward. It is built on a novel paradigm called **Reinforcement Learning from Internal Feedback (RLIF)**.
|
| 26 |
|
| 27 |
+
<div align="center">
|
| 28 |
+
<img src="https://raw.githubusercontent.com/sunblaze-ucb/Intuitor/main/figs/rlif.png" alt="RLIF Overview" width="700">
|
| 29 |
+
<br>
|
| 30 |
+
<em>Overview of Reinforcement Learning from Internal Feedback (RLIF)</em>
|
| 31 |
+
</div>
|
| 32 |
+
|
| 33 |
+
### 🧭 What is RLIF?
|
| 34 |
+
|
| 35 |
+
**Reinforcement Learning from Internal Feedback (RLIF)** is a training framework where language models learn *without any external rewards, gold labels, or verifiers*. Instead, models improve by optimizing *intrinsic signals*—such as confidence in their own answers—generated entirely from within. RLIF enables scalable and domain-agnostic fine-tuning of LLMs in settings where human feedback or verifiable supervision is expensive or unavailable.
|
| 36 |
+
|
| 37 |
+
Intuitor instantiates RLIF by using **self-certainty**—a model's confidence measured via KL divergence to uniform—as an intrinsic reward in the GRPO policy optimization algorithm.
|
| 38 |
+
|
| 39 |
+
<div align="center">
|
| 40 |
+
<img src="https://raw.githubusercontent.com/sunblaze-ucb/Intuitor/main/figs/intuitor.png" alt="Intuitor Framework" width="700">
|
| 41 |
+
<br>
|
| 42 |
+
<em>The Intuitor Framework</em>
|
| 43 |
+
</div>
|
| 44 |
+
|
| 45 |
+
---
|
| 46 |
+
|
| 47 |
+
## Code and Usage
|
| 48 |
+
|
| 49 |
+
The official implementation and detailed usage instructions are available on the [**Intuitor GitHub repository**](https://github.com/sunblaze-ucb/Intuitor).
|
| 50 |
+
|
| 51 |
+
### Sample Usage
|
| 52 |
+
|
| 53 |
+
You can load and use this model directly with the Hugging Face `transformers` library:
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
import torch
|
| 57 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 58 |
+
|
| 59 |
+
model_id = "sunblaze-ucb/Qwen2.5-1.5B-GRPO-MATH-1EPOCH"
|
| 60 |
+
|
| 61 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 62 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 63 |
+
model_id,
|
| 64 |
+
torch_dtype=torch.bfloat16, # or torch.float16 depending on available hardware
|
| 65 |
+
device_map="auto"
|
| 66 |
+
)
|
| 67 |
+
|
| 68 |
+
# Example prompt for a mathematical reasoning task
|
| 69 |
+
# The Qwen2.5 model expects a specific chat template for instruction-tuned usage.
|
| 70 |
+
prompt = "Question: Simplify (x^2 + 2x + 1) / (x + 1)\
|
| 71 |
+
Answer:"
|
| 72 |
+
messages = [{"role": "user", "content": prompt}]
|
| 73 |
+
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 74 |
+
|
| 75 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 76 |
+
|
| 77 |
+
generated_ids = model.generate(
|
| 78 |
+
model_inputs.input_ids,
|
| 79 |
+
max_new_tokens=100,
|
| 80 |
+
do_sample=False, # Set to True for creative outputs
|
| 81 |
+
temperature=0.7,
|
| 82 |
+
top_p=0.9,
|
| 83 |
+
eos_token_id=tokenizer.eos_token_id
|
| 84 |
+
)
|
| 85 |
+
|
| 86 |
+
decoded_output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 87 |
+
print(decoded_output)
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Benchmarks
|
| 93 |
+
|
| 94 |
+
Intuitor achieves:
|
| 95 |
+
- Comparable performance to GRPO on in-domain math reasoning tasks (GSM8K, MATH500)
|
| 96 |
+
- Superior generalization to code generation (LiveCodeBench, CRUXEval)
|
| 97 |
+
- Improved instruction following, without needing any gold labels or verifiable test suites
|
| 98 |
+
|
| 99 |
+
For detailed results, see Table 1 in the paper.
|
| 100 |
+
|
| 101 |
+
<div align="center">
|
| 102 |
+
<img src="https://raw.githubusercontent.com/sunblaze-ucb/Intuitor/main/figs/results.png" alt="Benchmark Results" width="700">
|
| 103 |
+
<br>
|
| 104 |
+
<em>Detailed results are available in Table 1 of the paper.</em>
|
| 105 |
+
</div>
|
| 106 |
|
| 107 |
---
|
| 108 |
|
|
|
|
| 122 |
journal = {arXiv preprint arXiv:2402.03300},
|
| 123 |
year = {2024},
|
| 124 |
}
|
| 125 |
+
```
|
|
|