How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="ZhexiLu/StateAlign-8B")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("ZhexiLu/StateAlign-8B")
model = AutoModelForCausalLM.from_pretrained("ZhexiLu/StateAlign-8B", device_map="auto")
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=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

StateAlign-8B

StateAlign-8B is a multi-turn tool-use agent trained from 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 (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):

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:

vllm serve ZhexiLu/StateAlign-8B ... \
  --rope-scaling '{"rope_type":"yarn","factor":2.0,"original_max_position_embeddings":32768}' \
  --max-model-len 65536

Transformers:

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

@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}
}
Downloads last month
26
Safetensors
Model size
8B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for ZhexiLu/StateAlign-8B

Finetuned
Qwen/Qwen3-8B
Finetuned
(2,339)
this model