StateAlign-8B / README.md
ZhexiLu's picture
Model card: add code link and citation authors
8bfb76e verified
|
Raw History Blame Contribute Delete
3.86 kB
---
license: apache-2.0
base_model: Qwen/Qwen3-8B
library_name: transformers
pipeline_tag: text-generation
language:
- en
tags:
- tool-use
- function-calling
- agent
- reinforcement-learning
- qwen3
---
# StateAlign-8B
StateAlign-8B is a multi-turn tool-use agent trained from [Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) with **StateAlign**, introduced in
*StateAlign: Internalizing State-Aware Decision-Making for Reliable Multi-Turn Tool Agents via Reinforcement Learning*.
**Code:** [github.com/ZhexiLu/StateAlign](https://github.com/ZhexiLu/StateAlign) (training code, example data and the BFCL evaluation script).
A tool agent should decide its next action from the current task state: what information is known or missing, whether the available tools can perform the request, and which parts of the task are already done. StateAlign constructs task states from tool-use trajectories (execute, ask the user, retrieve, decline, stop) and pairs states that differ in one condition. Training combines outcome rewards from interaction with a token-level state-contrastive signal that compares the same generated reasoning and actions under paired states.
## Results
| Benchmark | Qwen3-8B | StateAlign-8B |
|---|---|---|
| BFCL v4 multi-turn (overall) ↑ | 45.5 | **55.2** |
| ToolSandbox (similarity) ↑ | 73.4 | **79.3** |
| When2Call (accuracy) ↑ | 66.4 | **72.4** |
| SimpleToolHalluBench, no tool (NTA) ↓ | 59.8 | **56.1** |
| SimpleToolHalluBench, distractor tool (DT) ↓ | 28.2 | **25.0** |
BFCL is the mean of six evaluations (temperature 0.001, `Qwen/Qwen3-8B-FC` handler, YaRN factor 2 for a 65,536-token context). See the paper for all settings and baselines.
## Usage
The model keeps the Qwen3 architecture and chat template, so it can be used like Qwen3-8B.
**vLLM (OpenAI-compatible server with tool calling):**
```bash
vllm serve ZhexiLu/StateAlign-8B \
--enable-auto-tool-choice --tool-call-parser hermes \
--reasoning-parser qwen3
```
For contexts beyond 32,768 tokens, enable YaRN as for Qwen3:
```bash
vllm serve ZhexiLu/StateAlign-8B ... \
--rope-scaling '{"rope_type":"yarn","factor":2.0,"original_max_position_embeddings":32768}' \
--max-model-len 65536
```
**Transformers:**
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
name = "ZhexiLu/StateAlign-8B"
tokenizer = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name, torch_dtype="auto", device_map="auto")
tools = [{"type": "function", "function": {
"name": "cancel_order",
"description": "Cancel an order by its ID.",
"parameters": {"type": "object", "properties": {"order_id": {"type": "string"}}, "required": ["order_id"]}}}]
messages = [{"role": "user", "content": "Please cancel my order."}]
text = tokenizer.apply_chat_template(messages, tools=tools, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=1024)
print(tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
```
## Training
- Base model: Qwen3-8B.
- Method: StateAlign (GRPO with outcome rewards plus token-level state contrasts scored by the fixed base model).
- Fine-tuning: LoRA (rank 64, alpha 128, all attention and MLP projections), 400 steps, merged into the base weights for this release.
- Data: task states constructed from public tool-use trajectories; see the paper for details.
## License
Released under Apache 2.0, following the Qwen3-8B license.
## Citation
```bibtex
@misc{lu2026statealign,
title = {StateAlign: Internalizing State-Aware Decision-Making for Reliable Multi-Turn Tool Agents via Reinforcement Learning},
author = {Lu, Zhexi and Chaudhury, Subhajit and Pedapati, Tejaswini and Murugesan, Keerthiram and Yu, Lei},
year = {2026}
}
```