阿里Qwen团队今日正式发布QwQ-32B大语言模型。该模型参数量为320亿,通过强化学习技术优化,在多项评测中展现出与6710亿参数的DeepSeek-R1相近甚至更优的性能,简直太牛了!
传统的模型训练依赖海量数据和参数堆砌,而QwQ-32B通过RL训练,让模型像人类一样“思考-反馈-修正”,最终在数学推导、代码生成等任务中实现质的飞跃。
阿里公布的数据显示,QwQ-32B 模型在多个基准测试中展现了卓越的性能,涵盖了数学推理、编程技能以及通用能力等多个方面。
开源地址
魔搭开源链接:https://modelscope.cn/models/Qwen/QwQ-32Bhuggingface
开源链接:https://huggingface.co/Qwen/QwQ-32B
官方在线体验:https://chat.qwen.ai/?models=Qwen2.5-Plus
模型选择Qwen32-Preview,然后开启深度思考,即可体验QwQ-32B了,但是现在还是预发布版本,还得再等等。
技术方案
- 分阶段训练策略
- 第一阶段(专项突破):专注数学/代码任务,用客观结果验证替代传统奖励模型
✔ 数学:准确性验证器(答案正确性)
✔ 代码:执行服务器(测试用例通过率)
- 第二阶段(通用扩展):引入混合奖励机制(通用模型+规则验证器)
关键发现:
-
基于结果的验证比传统奖励建模更直接有效
-
少量通用阶段训练即可提升:
✔ 指令理解与执行
✔ 人类价值观对齐
✔ 智能体功能
- 多任务协同优化:通用能力提升不牺牲专项性能
API调用
from openai import OpenAI
import os
# Initialize OpenAI client
client = OpenAI(
# If the environment variable is not configured, replace with your API Key: api_key="sk-xxx"
# How to get an API Key:https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key
api_key=os.getenv("DASHSCOPE_API_KEY"),
base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"
)
reasoning_content = ""
content = ""
is_answering = False
completion = client.chat.completions.create(
model="qwq-32b",
messages=[
{"role": "user", "content": "Which is larger, 9.9 or 9.11?"}
],
stream=True,
# Uncomment the following line to return token usage in the last chunk
# stream_options={
# "include_usage": True
# }
)
print("\n" + "=" * 20 + "reasoning content" + "=" * 20 + "\n")
for chunk in completion:
# If chunk.choices is empty, print usage
if not chunk.choices:
print("\nUsage:")
print(chunk.usage)
else:
delta = chunk.choices[0].delta
# Print reasoning content
if hasattr(delta, 'reasoning_content') and delta.reasoning_content is not None:
print(delta.reasoning_content, end='', flush=True)
reasoning_content += delta.reasoning_content
else:
if delta.content != "" and is_answering is False:
print("\n" + "=" * 20 + "content" + "=" * 20 + "\n")
is_answering = True
# Print content
print(delta.content, end='', flush=True)
content += delta.content
总结
这标志着 Qwen 在扩展强化学习 (RL) 以增强推理能力方面迈出了第一步。我们不仅见证了缩放 RL 的巨大潜力,还认识到了预训练语言模型中尚未开发的可能性。未来,他们将继续深入探索 RL 的潜力,并将其与更强大的基础模型相结合,利用更大的计算资源,致力于打造 下一代 Qwen 模型,并最终迈向 通用人工智能 (AGI) 目标!