360团队开源360智脑模型,让任何人都可以搭建360AI知识库

🎉🎉🎉 近日,奇虎 360 对其自主研发的 7B 参数模型 360Zhinao3-7B 进行了开源升级。目前,该模型已在 Github 开源社区 360zhinao3 上发布,并可免费用于商业用途。该模型的功能得到了全面提升。与小于 10B 的小参数模型相比,360Zhinao3-7B 在多个基准测试中取得了第一名的优异成绩。

  • 360Zhinao3-7B
  • 360Zhinao3-7B-Instruct
  • 360Zhinao3-7B-O1.5

我们的 360Zhinao3 型号的显著特点是:

360Zhinao3-7B 是在 360Zhinao2-7B 的基础上使用 700B 高质量词块进行持续预训练的。两个模型的结构完全相同。模型性能的提高主要源于训练数据质量的提高。

在这里插入图片描述

模型评估

基本型号

我们使用开源工具 opencompass 对模型进行了多维度评估。该模型的基准平均得分在参数小于 10B 的模型中排名第一。在同等规模的模型中,它具有很强的竞争力。

TypeDatasetslanguageglm4-9bQwen2.5-7Binternlm2.5-7bYi1.5-9Bgemma2-9bLlama3.1-8B360Zhinao2-7B360Zhinao3-7B
Examcevalzh75.8381.4177.7173.5156.3651.6783.0484.7
mmluen75.575.571.5571.4372.2266.7567.8475.42
cmmluzh74.2481.7978.7774.258.8952.4973.882.17
ARC-cen94.928085.0887.4677.6380.6887.1288.14
ARC-een98.4184.8395.2494.5378.8489.7792.7794
LanguageWiCen51.5752.8250.7850.6350.475049.8450.31
WSCen68.2768.2769.2366.3568.2767.3165.3871.15
KnowledgeBoolQen81.883.8889.5184.4685.682.288.2988.38
commonsense_qaen71.1773.2268.5571.5868.4771.2569.7871.33
UnderstandingC3zh91.519293.0485.8681.6483.5193.2692.77
race-middleen91.9991.0292.0691.1688.0981.6990.4690.04
race-highen90.7187.9190.0888.3482.0878.7386.7485.96
lcstszh18.2915.8215.9616.4910.6217.2918.6118.85
eprstmt-devzh91.8886.8891.2591.8848.1283.129092.50
lambadaen71.6771.1469.9870.6475.4374.2372.5668.17
Reasoninghellaswagen70.2572.7670.3871.5566.8374.6571.4973.61
siqaen81.7372.5278.9776.258.9664.1877.1279.02
bbhen73.6854.6359.4367.8668.4559.946.5473.74
Codehumanevalen69.517560.3726.225.4927.4460.9864.63
mbppen606043.656.851.242.65467.80
Mathmathen26.863827.1427.0628.5215.3238.3437.60
gsm8ken78.5479.7652.5471.1173.0956.2575.5178.77
Overallavg_zh70.3571.5871.3568.3951.1357.6271.7474.20
avg_all73.1171.7869.6068.8861.6062.3270.6174.83

Instruct Model

We have evaluated and compared the 360Zhinao3-7B-Instruct model on three popular evaluations: IFEval, MT-bench, and CF-Bench. MT-bench and CFBench both rank first among open-source models of the same level and have strong competitiveness. In IFEval (prompt strict), it is second only to glm4-9b and has the highest score in the 7B size.

ModelMT-benchIFEval(strict prompt)CFBench(CSR,ISR,PSR)
Qwen2.5-7B-Instruct8.070.5560.810.460.57
Yi-9B-16k-Chat7.440.4550.750.40.52
GLM4-9B-Chat8.080.6340.820.480.61
InternLM2.5-7B-Chat7.390.5400.780.40.54
360Zhinao2-7B-Chat-4k7.860.5770.80.440.57
360Zhinao3-7B-Instruct8.170.6260.830.520.64

Long COT Model

我们利用之前开源的知网Light-R1方法,继续微调了360知网3-7B-Instruct的长COT,以及RFT和GRPO。与最新的OpenThinker2-7B相比仍有一定差距,但已经超越了以往所有基于通用Qwen2.5-7B-Instruct的模型。

ModelDateBase ModelAIME24AIME25GPQA Diamond
OpenThinker2-7B25.4.3Qwen2.5-7B-Instruct5033.349.3
OpenThinker-7B25.1.28Qwen2.5-7B-Instruct31.323.342.4
360Zhinao3-7B-O1.525.4.14360Zhinao3-7B-Instruct54.236.340.0
OpenR1-Qwen-7B25.2.11Qwen2.5-Math-7B-Instruct48.734.721.2
DeepSeek-R1-Distill-Qwen-7B25.1.20Qwen2.5-Math-7B-Instruct57.333.347.3
Light-R1-7B-DS25.3.12DeepSeek-R1-Distill-Qwen-7B59.144.349.4
Areal-boba-RL-7B25.3.31DeepSeek-R1-Distill-Qwen-7B61.948.347.6

快速入门

一个简单的例子来说明如何快速使用 360Zhinao3-7B、360Zhinao3-7B-Instruct 和 360Zhinao3-7B-O1.5,以及 🤗 Transformers

基础模型推理演示

from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers.generation import GenerationConfig

MODEL_NAME_OR_PATH = "qihoo360/360Zhinao3-7B"

tokenizer = AutoTokenizer.from_pretrained(
    MODEL_NAME_OR_PATH, 
    trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True).cuda()

generation_config = GenerationConfig.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True)
generation_config.max_new_tokens = 1024

inputs = tokenizer('中国二十四节气\n1. 立春\n2. 雨水\n3. 惊蛰\n4. 春分\n5. 清明\n', return_tensors='pt')
inputs = inputs.to(model.device)

pred = model.generate(input_ids=inputs["input_ids"], generation_config=generation_config)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))

指令模型推理演示

from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers.generation import GenerationConfig

MODEL_NAME_OR_PATH = "qihoo360/360Zhinao3-7B-Instruct"

tokenizer = AutoTokenizer.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True).cuda()

generation_config = GenerationConfig.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True)
generation_config.max_new_tokens = 2048

messages = []

#round-1
print(f"user: 简单介绍一下刘德华")
messages.append({"role": "user", "content": "简单介绍一下刘德华"})
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
pred = model.generate(input_ids=input_ids, generation_config=generation_config)
response = tokenizer.decode(pred.cpu()[0][len(input_ids[0]):], skip_special_tokens=True)
messages.append({"role": "assistant", "content": response})
print(f"gpt: {response}")


#round-1
print(f"user: 他有什么代表作?")
messages.append({"role": "user", "content": "他有什么代表作?"})
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
pred = model.generate(input_ids=input_ids, generation_config=generation_config)
response = tokenizer.decode(pred.cpu()[0][len(input_ids[0]):], skip_special_tokens=True)
messages.append({"role": "assistant", "content": response})
print(f"gpt: {response}")

长 COT 模型推理演示

import re
import json
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers.generation import GenerationConfig

MODEL_NAME_OR_PATH = "qihoo360/360Zhinao3-7B-O1.5"

tokenizer = AutoTokenizer.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True).cuda()

generation_config = GenerationConfig.from_pretrained(
    MODEL_NAME_OR_PATH,
    trust_remote_code=True)
generation_config.max_new_tokens = 2048


def extract_thinking_and_answer(input_string):
    thinking, answer = "", ""
    # 提取答案
    pattern_answer = r'.*</think>(.*)$'
    match_answer = re.search(pattern_answer, input_string, re.S)
    if match_answer:
        answer = match_answer.group(1)
    else:
        return thinking, input_string

    # 提取思考过程
    pattern_thinking = r'<think>(.*?)</think>'
    match_thinking = re.search(pattern_thinking, input_string, re.S)
    if match_thinking:
        thinking = match_thinking.group(1)

    return thinking, answer


messages = []
messages.append({"role": "user", "content": "现有一笼子,里面有鸡和兔子若干只,数一数,共有头14个,腿38条,求鸡和兔子各有多少只?"})
input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
pred = model.generate(input_ids=input_ids, generation_config=generation_config)
response = tokenizer.decode(pred.cpu()[0][len(input_ids[0]):], skip_special_tokens=True)
thinking, answer = extract_thinking_and_answer(response)
messages.append({"role": "assistant", "content": answer, "reasoning_content": thinking})
print(json.dumps(messages, ensure_ascii=False, indent=4))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值