HuggingFace镜像/Qwen-AgentWorld-35B-A3B
模型介绍文件和版本分析
下载使用量0

Qwen-AgentWorld-35B-A3B

📑 技术报告 | 📖 博客 | 🤗 Hugging Face | 🤖 ModelScope | 💻 GitHub | 🖥️ 演示

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

这些模型文件兼容Hugging Face Transformers、vLLM、SGLang等框架。

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

主要亮点

  • 七大统一领域:单一模型覆盖 MCP(工具调用)、搜索、终端、SWE(软件工程)、Android、Web 和操作系统——跨越文本和 GUI 交互环境。
  • 原生世界模型:从 CPT 阶段开始进行环境建模,而非在通用大语言模型上进行事后适配。
  • 可泛化、可扩展且可控的模拟器:对分布外(OOD)环境(如 OpenClaw)的零样本泛化能力;可控的扰动和虚构世界构建能力超越真实环境训练。
  • 智能体基础模型:在单轮、非智能体轨迹上进行的 LWM RL 预热,可迁移到七个基准测试的多轮工具调用智能体任务,包括三个完全分布外的任务。

模型概述

  • 类型:因果语言模型(语言世界模型)
  • 基础模型:Qwen3.5-35B-A3B-Base
  • 训练阶段:持续预训练(CPT)→ 监督微调(SFT)→ 强化学习(RL,GSPO)
  • 参数数量:总计350亿,激活30亿
  • 隐藏维度:2048
  • 词嵌入:248320(含填充)
  • 层数:40
  • 隐藏层结构:10 × (3 × (门控DeltaNet → MoE) → 1 × (门控注意力 → MoE))
  • 门控DeltaNet:
    • 线性注意力头数量:V为32个,QK为16个
    • 头维度:128
  • 门控注意力:
    • 注意力头数量:Q为16个,KV为2个
    • 头维度:256
    • 旋转位置嵌入维度:64
  • 混合专家(Mixture Of Experts):
    • 专家数量:256
    • 激活专家数量:8个路由专家 + 1个共享专家
    • 专家中间维度:512
  • 上下文长度:262,144 tokens
  • 免责声明:训练流程中未包含任何外部API服务的输出。

性能表现

AgentWorldBench(开放式评估)

各领域五维评分均值,归一化至0-100分制。

模型MCP搜索终端SWE安卓网页操作系统总体
GPT-5.470.1037.2653.6966.2960.0051.8068.5858.25
Claude Opus 4.854.9335.1459.1864.1061.5054.6666.6256.59
Claude Opus 4.669.9029.3057.5164.5561.7451.4270.2057.80
Gemini 3.1 Pro59.0730.2152.4759.0761.4052.8366.9254.57
Claude Sonnet 4.670.0028.7956.9864.5258.0350.7863.1756.04
DeepSeek-V4-Pro63.2727.6151.2659.4455.1750.3263.7052.97
GLM-5.167.6022.4647.3252.0759.1051.5059.1351.31
Kimi K2.665.2327.4852.5458.7758.9350.2060.8053.42
MiniMax-M2.755.8227.3041.6237.4452.4050.5257.7346.12
Qwen3.5-35B-A3B57.8725.9846.1347.5853.1847.1056.2747.73
Qwen3.5-397B-A17B68.3130.8155.3064.4454.9048.5560.8554.74
Qwen3.6-Plus55.2821.9450.5859.0857.6550.7860.3350.81
Qwen-AgentWorld-35B-A3B64.7936.6953.9665.6358.1749.5565.9256.39
Qwen-AgentWorld-397B-A17B68.2437.8257.7368.4960.2050.9867.8958.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 是一个用于大语言模型(LLMs)的高吞吐量且内存高效的推理引擎。

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

--language-model-only 标志是必需的,因为模型架构包含视觉组件定义,但检查点仅包含语言模型权重。如果没有此标志,vLLM 将尝试初始化视觉模块并失败。

兼容 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)

通过聊天补全 API 使用

from openai import OpenAI

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

# Terminal domain example
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 个维度对每个预测的环境观测结果进行评分,来评估语言世界模型,这 5 个维度分别是:格式(Format)、事实性(Factuality)、一致性(Consistency)、真实性(Realism) 和 质量(Quality)。

设置

# Clone the evaluation repository
git clone https://github.com/QwenLM/Qwen-AgentWorld.git
cd Qwen-AgentWorld

# Download the benchmark
huggingface-cli download Qwen/AgentWorldBench --repo-type dataset --local-dir ./AgentWorldBench

# Install dependencies
pip install openai

运行评估

评估遵循三步流程:

cd eval

# Step 1: Run world model inference
python eval.py infer \
    --data-dir ../AgentWorldBench \
    --model-base-url http://localhost:8000/v1 \
    --model-name Qwen/Qwen-AgentWorld-35B-A3B \
    --output-dir ./results

# Step 2: Run LLM judge scoring
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

# Step 3: Aggregate and display scores
python eval.py score --predictions ./results/judged.jsonl

最佳实践

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

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

  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}
}