🚀 🐋 Mistral-7B-OpenOrca 🐋
Mistral-7B-OpenOrca 是基于 Mistral 7B 模型,使用 OpenOrca 数据集进行微调得到的大语言模型。它在多个评测基准中表现出色,在小于 30B 的模型中排名第一,甚至能在性能上媲美 Llama2-70b-chat,且能在普通消费级 GPU 上全加速运行。

🚀 快速开始
如果你想立即体验该模型,可访问:https://huggingface.co/spaces/Open-Orca/Mistral-7B-OpenOrca ,这里使用了快速 GPU 且模型未进行量化。
若想可视化完整(预过滤)数据集,可查看 Nomic Atlas Map。

✨ 主要特性
- 高性能:在发布时,在小于 30B 的所有模型中,该模型在 HuggingFace 排行榜评估中排名第一,超越了所有其他 7B 和 13B 模型。
- 全开源:这是一个完全开源的模型,具有突破性的性能,甚至能在普通消费级 GPU 上全加速运行。
- 多基准领先:在 AGIEval、BigBench-Hard、GPT4ALL 排行榜、MT-Bench 等多个评测基准中均有出色表现。
📦 安装指南
由于 Mistral 的支持尚未发布到 PyPI,你需要安装 Transformers 的开发快照:
pip install git+https://github.com/huggingface/transformers
💻 使用示例
基础用法
chat = [
{"role": "system", "content": "You are MistralOrca, a large language model trained by Alignment Lab AI. Write out your reasoning step-by-step to be sure you get the right answers!"},
{"role": "user", "content": "How are you?"},
{"role": "assistant", "content": "I am doing well!"},
{"role": "user", "content": "Please tell me about how mistral winds have attracted super-orcas."},
]
tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
上述代码将输出:
<|im_start|>system
You are MistralOrca, a large language model trained by Alignment Lab AI. Write out your reasoning step-by-step to be sure you get the right answers!
<|im_end|>
<|im_start|>user
How are you?<|im_end|>
<|im_start|>assistant
I am doing well!<|im_end|>
<|im_start|>user
Please tell me about how mistral winds have attracted super-orcas.<|im_end|>
<|im_start|>assistant
如果你使用 tokenize=True
和 return_tensors="pt"
,则会得到一个经过分词和格式化的对话,可直接传递给 model.generate()
。
高级用法
推理详情可查看 此笔记本。
📚 详细文档
量化模型
该模型的量化版本由 TheBloke 慷慨提供:
- AWQ: https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ
- GPTQ: https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GPTQ
- GGUF: https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-GGUF
提示模板
模型使用 OpenAI 的聊天标记语言 (ChatML) 格式,并添加了 <|im_start|>
和 <|im_end|>
标记以支持该格式。
这意味着,例如在 oobabooga 中,“MPT-Chat
” 指令模板应该可以使用,因为它也使用了 ChatML。
这种格式化也可以通过预定义的 Transformers 聊天模板 获得,这意味着可以使用 apply_chat_template()
方法为你格式化消息列表。
评估
HuggingFace 排行榜性能
使用 HuggingFace 排行榜的方法和工具进行评估,发现该模型在基础模型上有显著改进。在 HuggingFace 排行榜评估中达到了基础模型性能的 106%,平均分为 65.84。
发布时,该模型击败了所有 7B 和 13B 模型,其性能也是 Llama2-70b-chat
的 98.6%。

指标 |
值 |
MMLU (5-shot) |
62.24 |
ARC (25-shot) |
64.08 |
HellaSwag (10-shot) |
83.99 |
TruthfulQA (0-shot) |
53.05 |
平均分 |
65.84 |
使用 语言模型评估工具包 运行上述基准测试,使用的版本与 HuggingFace LLM 排行榜相同。
AGIEval 性能
与基础 Mistral-7B 模型(使用 LM 评估工具包)相比,在 AGI 评估中达到了基础模型性能的 129%,平均分为 0.397。同时,也显著优于官方 mistralai/Mistral-7B-Instruct-v0.1
微调版本,达到了其性能的 119%。

BigBench-Hard 性能
在 BigBench-Hard 评估中达到了基础模型性能的 119%,平均分为 0.416。

GPT4ALL 排行榜性能
与之前的版本相比略有优势,再次位居排行榜榜首,平均分为 72.38。

MT-Bench 性能
MT-Bench 使用 GPT-4 作为模型响应质量的评判标准,涵盖了广泛的挑战。该模型的性能与 Llama2-70b-chat
相当,平均分为 6.86。

数据集
使用了 OpenOrca 数据集中经过精心挑选和过滤的大部分 GPT-4 增强数据,该数据集旨在重现 Orca 研究论文数据集。
训练
使用 8 个 A6000 GPU 进行了 62 小时的训练,在一次训练运行中对数据集完成了 4 个周期的全微调。成本约为 400 美元。
🔧 技术细节
- 模型类型:基于 Mistral 7B 微调的大语言模型
- 训练数据:OpenOrca 数据集中经过筛选的 GPT-4 增强数据
- 训练环境:8x A6000 GPUs,训练时长 62 小时,完成 4 个周期的全微调
📄 许可证
本项目采用 apache-2.0 许可证。
📖 引用
@software{lian2023mistralorca1
title = {MistralOrca: Mistral-7B Model Instruct-tuned on Filtered OpenOrcaV1 GPT-4 Dataset},
author = {Wing Lian and Bleys Goodson and Guan Wang and Eugene Pentland and Austin Cook and Chanvichet Vong and "Teknium"},
year = {2023},
publisher = {HuggingFace},
journal = {HuggingFace repository},
howpublished = {\url{https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca},
}
@misc{mukherjee2023orca,
title={Orca: Progressive Learning from Complex Explanation Traces of GPT-4},
author={Subhabrata Mukherjee and Arindam Mitra and Ganesh Jawahar and Sahaj Agarwal and Hamid Palangi and Ahmed Awadallah},
year={2023},
eprint={2306.02707},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{longpre2023flan,
title={The Flan Collection: Designing Data and Methods for Effective Instruction Tuning},
author={Shayne Longpre and Le Hou and Tu Vu and Albert Webson and Hyung Won Chung and Yi Tay and Denny Zhou and Quoc V. Le and Barret Zoph and Jason Wei and Adam Roberts},
year={2023},
eprint={2301.13688},
archivePrefix={arXiv},
primaryClass={cs.AI}
}