网易首页 > 网易号 > 正文 申请入驻

Qwen3 开源发布!

0
分享至

性能卓越

灵活适配多场景需求

作为Qwen系列全新一代的混合推理模型,Qwen3 在 GPQA、AIME24/25、LiveCodeBench 等多个权威评测中表现出极具竞争力的结果。

在相同计算资源下,Qwen3 模型以更小的规模实现了对更大体量上一代模型的超越,真正做到了“小而强大”。通过引入创新的MOE(混合专家)架构,Qwen3 在效果上媲美上一代超大规模 Dense 模型的同时,效率显著提升,使复杂任务处理更加轻松高效。

此外,Qwe n3 融合了推理与非推理能力,在逻辑分析和创意生成等任务中表现卓越。预训练数据量达到月 36万亿 tokens, 并通 过多轮大规模强化学习与精细优化,在工具调用指令遵循多语言能力等方面显著提升。

其中,Qwen3-235B-A22B 表现尤为突出,刷新了开源模型的智能水平新高,显存占用仅为性能相近模型的三分之一。无论是数学推理、代码生成还是综合逻辑分析, Qwen3 均展现出卓越能力,稳居全球开源模型前列。在工具调用方面表现优异,大幅降低了复杂任务的实现门槛,同时还支持119种语言,覆盖全球主要语种,满足多样化需求。

思考与非思考模式

灵活应对不同场景

Qwen3 引入了“思考模式”和“非思考模式”,使模型能够在不同场景下表现出最佳性能。在思考模式模式下,模型会进行多步推理和深度分析,类似于人类在解决复杂问题时的“深思熟虑”。(eg:在回答数学题或编写复杂代码时,模型会反复验证逻辑并优化输出结果。)

在非思考模式模式下,模型优先追求响应速度和效率,适用于简单任务或实时交互。(eg:在日常对话或快速问答中,模型会跳过复杂的推理步骤,直接给出答案。)

你可以通过简单的指令或配置文件在两种模式之间切换。

启用思考模式:默认情况下,Qwen3 启用了思考能力enable_thinking=True。在此模式下,模型会在生成响应前进行深度分析,并输出包裹在...块中的思考过程。

关闭思考模式:如果需要禁用思考行为,可以设置 enable_thinking=False ,使模型功能与 Qwen2.5-Instruct 保持一致。此模式适合对响应速度要求较高的场景。

软开关机制:Qwen3 支持动态切换思考模式,你可通过/think启用深度推理或/no_think快速关闭。模型会根据最新指令调整行为,灵活适应不同需求。以下是一个多轮对话示例:

from transformers import AutoModelForCausalLM, AutoTokenizer
classQwenChatbot:
    def __init__(self, model_name="Qwen3-30B-A3B/Qwen3-30B-A3B"):
        self.tokenizer = AutoTokenizer.from_pretrained(model_name)
        self.model = AutoModelForCausalLM.from_pretrained(model_name)
        self.history = []
    def generate_response(self, user_input):
        messages = self.history + [{"role": "user", "content": user_input}]
        text = self.tokenizer.apply_chat_template(
            messages,
            tokenize=False,
            add_generation_prompt=True
        )
        inputs = self.tokenizer(text, return_tensors="pt")
        response_ids = self.model.generate(**inputs, max_new_tokens=32768)[0][len(inputs.input_ids[0]):].tolist()
        response = self.tokenizer.decode(response_ids, skip_special_tokens=True)
        # Update history
        self.history.append({"role": "user", "content": user_input})
        self.history.append({"role": "assistant", "content": response})
        return response
# Example Usage
if __name__ == "__main__":
    chatbot = QwenChatbot()
    # First input (without /think or /no_think tags, thinking mode is enabled by default)
    user_input_1 = "How many r's in strawberries?"
    print(f"User: {user_input_1}")
    response_1 = chatbot.generate_response(user_input_1)
    print(f"Bot: {response_1}")
    print("----------------------")
    # Second input with /no_think
    user_input_2 = "Then, how many r's in blueberries? /no_think"
    print(f"User: {user_input_2}")
    response_2 = chatbot.generate_response(user_input_2)
    print(f"Bot: {response_2}") 
    print("----------------------")
    # Third input with /think
    user_input_3 = "Really? /think"
    print(f"User: {user_input_3}")
    response_3 = chatbot.generate_response(user_input_3)
    print(f"Bot: {response_3}")

如何在不同框架中使用 Qwen3 ?我们提供了一个在 Hugging Face transformers 中使用 Qwen3-30B-A3B 的标准示例:

from modelscope import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen3-30B-A3B"
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True # Switch between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() 
# parsing thinking content
try:
    # rindex finding 151668 ()
    index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
    index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("thinking content:", thinking_content)
print("content:", content)

要禁用思考模式,只需对参数 enable_thinking 进行如下修改:

text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=False  # True is the default value for enable_thinking.
)

对于部署,您可以使用 sglang>=0.4.6.post1 或 vllm>=0.8.4来创建一个与 OpenAI API 兼容的 API endpoint:

SGLang:

    python -m sglang.launch_server --model-path Qwen/Qwen3-30B-A3B --reasoning-parser qwen3

vLLM:

    vllm serve Qwen/Qwen3-30B-A3B --enable-reasoning --reasoning-parser deepseek_r1

要禁用思考模式,您可以移除参数 --reasoning-parser(以及 --enable-reasoning)。

如果用于本地开发,您可以通过运行简单的命令 ollama run qwen3:30b-a3b 来使用 ollama 与模型进行交互。您也可以使用 LMStudio 或者 llama.cpp 以及 ktransformers 等代码库进行本地开发。

Agent示例

你还可以使用Qwen-Agent 来充分发挥 Qwen3 的 Agent 能力。Qwen-Agent 内部封装了工具调用模板和工具调用解析器,大大降低了代码复杂性。

要定义可用的工具,您可以使用 MCP 配置文件,使用 Qwen-Agent 内置的工具,或者自行集成其他工具。

from qwen_agent.agents import Assistant
# Define LLM
llm_cfg = {
    'model': 'Qwen3-30B-A3B',
    # Use the endpoint provided by Alibaba Model Studio:
    # 'model_type': 'qwen_dashscope',
    # 'api_key': os.getenv('DASHSCOPE_API_KEY'),
    # Use a custom endpoint compatible with OpenAI API:
    'model_server': 'http://localhost:8000/v1',  # api_base
    'api_key': 'EMPTY',
    # Other parameters:
    # 'generate_cfg': {
    #         # Add: When the response content is ` this is the thought this is the answer;
    #         # Do not add: When the response has been separated by reasoning_content and content.
    #         'thought_in_content': True,
    #     },
}
# Define Tools
tools = [
    {'mcpServers': {  # You can specify the MCP configuration file
            'time': {
                'command': 'uvx',
                'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
            },
            "fetch": {
                "command": "uvx",
                "args": ["mcp-server-fetch"]
            }
        }
    },
  'code_interpreter',  # Built-in tools
]
# Define Agent
bot = Assistant(llm=llm_cfg, function_list=tools)
# Streaming generation
messages = [{'role': 'user', 'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'}]
for responses in bot.run(messages=messages):
    pass
print(responses)

✅ huggingface

https://huggingface.co/Qwen/Qwen3-235B-A22B

✅ 魔搭社区

https://modelscope.cn/models/Qwen/Qwen3-235B-A22B

✅ Qwen Chat

https://chat.qwen.ai

✅ 阿里云百炼(即将上线,并提供 100万tokens免费体验)

https://www.aliyun.com/product/tongyi

特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。

Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.

相关推荐
热点推荐
发现了吗?手里人民币变“金贵”了!现30万,抵得上几年前几十万

发现了吗?手里人民币变“金贵”了!现30万,抵得上几年前几十万

花小猫的美食日常
2026-10-08 17:32:36
63岁何赛飞豪宅种菜,穿粉色大棉袄踩老布鞋,戴翡翠镯子难掩贵气

63岁何赛飞豪宅种菜,穿粉色大棉袄踩老布鞋,戴翡翠镯子难掩贵气

小疯子耶
2026-10-08 10:26:34
尊界官方回应“刹车门”:高于国标,实际场景正常,将优化部件,免费升级!网友:这不就是变相承认有缺陷?

尊界官方回应“刹车门”:高于国标,实际场景正常,将优化部件,免费升级!网友:这不就是变相承认有缺陷?

大白聊IT
2026-10-09 00:28:25
尹聪耀救主+比分定格2-2,河南逼平10人深圳新鹏城,连续5轮不败

尹聪耀救主+比分定格2-2,河南逼平10人深圳新鹏城,连续5轮不败

侧身凌空斩
2026-10-09 21:36:08
当众拒唱国歌不认中国籍,把两个孩子全送出国,如今报应终于来了

当众拒唱国歌不认中国籍,把两个孩子全送出国,如今报应终于来了

鹤羽说个事
2026-09-02 16:51:59
你敢信吗?从中国最北的漠河坐火车到哈尔滨,1194公里要走一整夜

你敢信吗?从中国最北的漠河坐火车到哈尔滨,1194公里要走一整夜

岁月有情1314
2026-10-07 20:03:49
不查不知道,一查吓一跳!住北京大豪宅的岳云鹏,私下到底有多壕

不查不知道,一查吓一跳!住北京大豪宅的岳云鹏,私下到底有多壕

期望带来失望
2026-10-09 09:14:59
安东尼奥从U23国足主教练位置下来之后,足协就可能安排他去新球队执教

安东尼奥从U23国足主教练位置下来之后,足协就可能安排他去新球队执教

振刚说足球
2026-10-09 07:43:20
网传李玮锋被停职,记者:宁波队欠的是钱,不是战术

网传李玮锋被停职,记者:宁波队欠的是钱,不是战术

懂球帝
2026-10-09 16:25:18
环境真的能改变人的外貌吗?网友:广东是真不养人

环境真的能改变人的外貌吗?网友:广东是真不养人

带你感受人间冷暖
2026-10-08 00:05:18
装都不装了!孙颖莎1-3不敌泰国选手仅过5小时,三件荒唐事发生了

装都不装了!孙颖莎1-3不敌泰国选手仅过5小时,三件荒唐事发生了

十点街球体育
2026-10-08 22:40:04
懂车帝这次危险了,因为它揭开了一个真相

懂车帝这次危险了,因为它揭开了一个真相

清书先生
2026-10-09 15:19:19
表哥打30多年光棍,姑姑实在看不下去了,直接让他如愿以偿

表哥打30多年光棍,姑姑实在看不下去了,直接让他如愿以偿

千秋文化
2026-08-03 20:59:30
原来他是彭玉的二婚丈夫,工资卡交给亲儿子后,生活靠妻子养活

原来他是彭玉的二婚丈夫,工资卡交给亲儿子后,生活靠妻子养活

娱说瑜悦
2026-10-09 13:22:22
烂柯杯八强中国棋手以哀兵之势再战 金禹丞VS申真谞廖元赫VS卞相壹

烂柯杯八强中国棋手以哀兵之势再战 金禹丞VS申真谞廖元赫VS卞相壹

劲爆体坛
2026-10-09 19:23:23
16+7+2!打爆唐斯,4号位浓眉好像真的很不错!

16+7+2!打爆唐斯,4号位浓眉好像真的很不错!

体育新角度
2026-10-09 20:38:40
湖人114-110击败国王!此战看到4个事实:4年5200万引入马穆是对的

湖人114-110击败国王!此战看到4个事实:4年5200万引入马穆是对的

篮球大视野
2026-10-09 13:43:42
诺贝尔文学奖今天揭晓,中国作家残雪,为何突然登顶诺奖赔率榜?

诺贝尔文学奖今天揭晓,中国作家残雪,为何突然登顶诺奖赔率榜?

兴趣知识
2026-10-09 00:45:47
1985年,孔令华辞职,北京卫戍区领导叮嘱:走可以,遵守2条命令

1985年,孔令华辞职,北京卫戍区领导叮嘱:走可以,遵守2条命令

起喜电影
2026-10-09 15:34:03
尊界“断了”,华为怎么办?

尊界“断了”,华为怎么办?

圆方你怎么看啊
2026-10-08 14:26:10
2026-10-09 22:11:00
阿里研究院 incentive-icons
阿里研究院
推动商业互联网化
1971文章数 2182关注度
往期回顾 全部

科技要闻

华为小米手机同日涨价,最高涨1000元

头条要闻

新人结婚主持人发现礼炮塞满纸钱和骂人纸条 新郎发声

头条要闻

新人结婚主持人发现礼炮塞满纸钱和骂人纸条 新郎发声

体育要闻

与C罗硬碰硬,一个72岁老人的倔强

娱乐要闻

吴奇隆宣布重要决定,走上谢霆锋老路

财经要闻

时隔12年,公募基金运作办法修订

汽车要闻

舒适体验全面升级/四驱版续航超700km 理想i6将于10月28日上市

态度原创

本地
健康
游戏
房产
公开课

本地新闻

转型再出发 奋勇打头阵

痘坑留下后,还能填平吗?

猛鬼追魂新作玩家与媒体评价差异巨大!Steam好评如潮

房产要闻

475万人,猛增13.1%!国庆海南,又爆了?

公开课

李玫瑾:为什么性格比能力更重要?

无障碍浏览 进入关怀版