Qwen · HF · 通义

Qwen-AgentWorld-35B-A3B

Qwen-AgentWorld-35B-A3B

二〇二六年八月二十六日 · 英文原文

Qwen-AgentWorld-35B-A3B是阿里通义千问团队发布的语言世界模型,总参数量35B、激活3B,基座为Qwen3.5-35B-A3B-Base。该模型通过CPT、SFT和RL三阶段训练,在单一模型中覆盖MCP、搜索、终端、SWE、Android、Web和OS七个智能体交互领域。在AgentWorldBench上,35B版本总体得分56.39,397B版本达58.71,超越GPT-5.4(58.25)和Claude Opus 4.8(56.59)。模型支持262K上下文长度,兼容Hugging Face Transformers、vLLM、SGLang等框架。

Qwen-AgentWorld-35B-A3B

[!Note] 本仓库包含 Qwen-AgentWorld-35B-A3B 的模型权重和配置文件,这是一个为智能体环境模拟训练的原生语言世界模型。

这些产物兼容 Hugging Face Transformers、vLLM、SGLang 等框架。

Qwen-AgentWorld 是首个在单一模型中覆盖七个智能体交互领域的语言世界模型。它通过长链式思维推理模拟智能体环境,根据智能体的动作和交互历史预测下一个环境状态。模型经过三阶段训练流程——CPT 注入环境知识,SFT 激活下一状态预测推理,RL 提升模拟保真度——Qwen-AgentWorld 是一个原生世界模型:从 CPT 阶段起,环境建模就是训练目标,而非事后添加的模块。

亮点

模型概览

性能

AgentWorldBench(开放式评估)

每个领域的五维评分均值,归一化到 0-100 分。

模型 MCP 搜索 终端 SWE Android Web OS 总体
GPT-5.4 70.10 37.26 53.69 66.29 60.00 51.80 68.58 58.25
Claude Opus 4.8 54.93 35.14 59.18 64.10 61.50 54.66 66.62 56.59
Claude Opus 4.6 69.90 29.30 57.51 64.55 61.74 51.42 70.20 57.80
Gemini 3.1 Pro 59.07 30.21 52.47 59.07 61.40 52.83 66.92 54.57
Claude Sonnet 4.6 70.00 28.79 56.98 64.52 58.03 50.78 63.17 56.04
DeepSeek-V4-Pro 63.27 27.61 51.26 59.44 55.17 50.32 63.70 52.97
GLM-5.1 67.60 22.46 47.32 52.07 59.10 51.50 59.13 51.31
Kimi K2.6 65.23 27.48 52.54 58.77 58.93 50.20 60.80 53.42
MiniMax-M2.7 55.82 27.30 41.62 37.44 52.40 50.52 57.73 46.12
Qwen3.5-35B-A3B 57.87 25.98 46.13 47.58 53.18 47.10 56.27 47.73
Qwen3.5-397B-A17B 68.31 30.81 55.30 64.44 54.90 48.55 60.85 54.74
Qwen3.6-Plus 55.28 21.94 50.58 59.08 57.65 50.78 60.33 50.81
Qwen-AgentWorld-35B-A3B 64.79 36.69 53.96 65.63 58.17 49.55 65.92 56.39
Qwen-AgentWorld-397B-A17B 68.24 37.82 57.73 68.49 60.20 50.98 67.89 58.71

快速开始

部署

Qwen-AgentWorld-35B-A3B 可通过流行的推理框架以 API 形式提供服务。下面展示启动 OpenAI 兼容 API 服务器的示例命令。

[!Important] 模型的默认上下文长度为 262,144 tokens。 如果遇到内存不足(OOM)错误,请考虑减小上下文窗口。 但由于 Qwen-AgentWorld 利用扩展上下文进行多轮环境模拟,我们建议至少保持 128K tokens 的上下文长度。

SGLang

SGLang 是一个快速的大语言模型服务框架。

python -m sglang.launch_server \
    --model-path Qwen/Qwen-AgentWorld-35B-A3B \
    --port 8000 \
    --tp-size 4 \
    --context-length 262144 \
    --reasoning-parser qwen3

OpenAI 兼容 API 将在 http://localhost:8000/v1 可用。

vLLM

vLLM 是一个高吞吐量、内存高效的 LLM 推理引擎。

vllm serve Qwen/Qwen-AgentWorld-35B-A3B \
    --port 8000 \
    --tensor-parallel-size 4 \
    --max-model-len 262144 \
    --reasoning-parser qwen3 \
    --trust-remote-code

OpenAI 兼容 API 将在 http://localhost:8000/v1 可用。

使用 Transformers 推理

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Qwen/Qwen-AgentWorld-35B-A3B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto",
)

messages = [
    {
        "role": "system",
        "content": "You are a language world model simulating a Linux terminal environment. "
                   "Given the user's command, predict the terminal output."
    },
    {
        "role": "user",
        "content": "Action: execute_bash\nCommand: ls -la /home/user/project/"
    }
]

text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=2048, temperature=0.6)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[-1]:], skip_special_tokens=True)
print(response)

通过 Chat Completions API 使用

from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="EMPTY",
)

# 终端领域示例
messages = [
    {
        "role": "system",
        "content": "You are a language world model simulating a Linux terminal environment. "
                   "Given the user's command, predict the terminal output."
    },
    {
        "role": "user",
        "content": "Action: execute_bash\nCommand: ls -la /home/user/project/"
    }
]

response = client.chat.completions.create(
    model="Qwen/Qwen-AgentWorld-35B-A3B",
    messages=messages,
    max_tokens=32768,
    temperature=0.6,
)
print(response.choices[0].message.content)

[!Note] 我们在 GitHub 仓库的 prompts/ 目录中提供了所有 7 个领域的领域特定世界模型系统提示模板。当使用 Qwen-AgentWorld 作为环境模拟器时,这些可作为通用系统提示。每个领域文件夹包含一个 system_prompt.txt(世界模型系统提示)和一个 judge_system_prompt.txt(评估提示)。

在 AgentWorldBench 上评估

AgentWorldBench 通过从 5 个维度对每个预测的环境观测进行评分来评估语言世界模型:格式事实性一致性真实性质量

设置

# 克隆评估仓库
git clone https://github.com/QwenLM/Qwen-AgentWorld.git
cd Qwen-AgentWorld

# 下载 benchmark
huggingface-cli download Qwen/AgentWorldBench --repo-type dataset --local-dir ./AgentWorldBench

# 安装依赖
pip install openai

运行评估

评估遵循三步流程:

cd eval

# 步骤 1:运行世界模型推理
python eval.py infer \
    --data-dir ../AgentWorldBench \
    --model-base-url http://localhost:8000/v1 \
    --model-name Qwen/Qwen-AgentWorld-35B-A3B \
    --output-dir ./results

# 步骤 2:运行 LLM 评判评分
export OPENAI_API_KEY="your-api-key"
python eval.py judge \
    --predictions ./results/predictions.jsonl \
    --judge-base-url https://api.openai.com/v1 \
    --judge-model gpt-5.2-2025-12-11 \
    --output-dir ./results

# 步骤 3:汇总并显示分数
python eval.py score --predictions ./results/judged.jsonl

最佳实践

  1. 采样参数:我们建议世界模型推理使用 temperature=0.6top_p=0.95top_k=20。模型默认使用思考模式(<think>...</think>)在生成预测观测之前推理环境状态转换。

  2. 足够的输出长度:对于大多数查询,我们建议输出长度为 32,768 tokens。对于长、多步轨迹,可以增加最大输出长度以容纳详细的环境观测。

  3. 领域特定系统提示:为获得最佳模拟保真度,请使用 GitHub 仓库 prompts/ 目录中提供的领域特定系统提示。

引用

如果您觉得我们的工作有帮助,欢迎引用我们。

@article{zuo2026qwen,
  title={Qwen-agentworld: language world models for general agents},
  author={Zuo, Yuxin and Xiao, Zikai and Sheng, Li and Huang, Fei and Tu, Jianhong and Liu, Yuxuan and Tang, Tianyi and Hu, Xiaomeng and Su, Yang and Lan, Qingfeng and others},
  journal={arXiv preprint arXiv:2606.24597},
  year={2026}
}
译自 Qwen · HF · 通义 · 录于 二〇二六年八月二十六日