Agent-R2-4B / README.md
teng-pan's picture
Remove max_new_tokens from usage example
0e709ec verified
|
Raw History Blame Contribute Delete
2.21 kB
---
language:
- en
license: apache-2.0
library_name: transformers
base_model: Qwen/Qwen3-4B-Thinking-2507
pipeline_tag: text-generation
tags:
- agent
- productivity
- long-horizon
- rubric-based-rl
- qwen3
---
# Agent-R²-4B
**Agent-R²-4B** is a 4B-parameter language model agent trained for realistic productivity work: long-horizon professional workflows that involve heterogeneous files (documents, spreadsheets, slides, PDFs) and require producing a usable deliverable, not just an answer string.
It is the model introduced in *Agent-R²: Scaling Agents for Realistic Productivity Work via Real-Source Data Synthesis*.
## Results
| Benchmark | Qwen3-4B-Thinking-2507 (base) | Agent-R²-4B | Qwen3-235B-A22B-Thinking-2507 |
|---|---|---|---|
| GDPval | 32.4 | **51.0** | 48.0 |
| OfficeQA | 2.2 | **14.8** | 13.8 |
Scores are as reported in the paper. All benchmarks evaluate end-to-end task completion on realistic occupational tasks.
## Model Details
- **Base model:** Qwen3-4B-Thinking-2507
- **Parameters:** 4B
- **Training stages:** SFT → rubric-based RL
## How to Use
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "teng-pan/Agent-R2-4B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype="bfloat16",
device_map="auto",
)
messages = [
{"role": "system", "content": "You are a careful productivity agent. Ground every claim in the provided files and verify your deliverable before finishing."},
{"role": "user", "content": "Using the files in ./workspace, produce quarterly_summary.xlsx ..."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
out = model.generate(**inputs)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```
For best results, expose the file tools used during training and give the model an explicit, verifiable deliverable specification. The model benefits from being told what the final artifact must contain and how it will be checked.
## Links
- Code: https://github.com/ZJU-REAL/Agent-R2