🚀 MoLM
MoLM是一系列基于混合专家(MoE)的语言模型,参数规模从40亿到80亿不等。这是MoLM - 700M - 4B预训练模型的仓库,该模型已转换为Hugging Face Transformers格式。其他模型的链接可在底部的索引中找到。
🚀 快速开始
要加载该模型,你需要安装ModuleFormer包。然后,你可以使用以下代码加载模型:
from transformers import AutoTokenizer, AutoModelForCausalLM, AutoConfig, AutoModelForSequenceClassification
from moduleformer import ModuleFormerForCausalLM, ModuleFormerConfig, ModuleFormerForSequenceClassification
AutoConfig.register("moduleformer", ModuleFormerConfig)
AutoModelForCausalLM.register(ModuleFormerConfig, ModuleFormerForCausalLM)
AutoModelForSequenceClassification.register(ModuleFormerConfig, ModuleFormerForSequenceClassification)
tokenizer = AutoTokenizer.from_pretrained('ibm/MoLM-700M-4B')
model = AutoModelForCausalLM.from_pretrained('ibm/MoLM-700M-4B')
✨ 主要特性
- 参数规模多样:提供40亿和80亿参数规模的模型,且40亿参数模型还有不同计算成本的变体。
- 计算效率高:每个输入令牌仅激活部分参数,在计算上等效于较小的密集模型。
- 数据丰富:所有模型均在3000亿个公开可用的令牌上进行预训练。
📚 详细文档
模型详情
- MoLM - 350M - 4B:基于MoE的语言模型,有40亿参数,但每个输入令牌仅激活3.5亿参数,计算上等效于3.5亿的密集模型。
- MoLM - 700M - 4B:有40亿参数,计算上等效于7亿的密集模型。
- MoLM - 700M - 8B:有80亿参数,计算上等效于7亿的密集模型。
所有模型均在3000亿个公开可用的令牌上进行训练,学习率为3.0 x 10⁻⁴,全局批量大小为300万个令牌。
模型开发者
IBM
模型变体
MoLM有两种不同的参数规模——40亿和80亿。40亿参数的模型有两种不同计算成本的变体——3.5亿和7亿。
输入输出
- 输入:模型仅接受文本输入。
- 输出:模型仅生成文本输出。
模型架构
MoLM是一个自回归语言模型,使用ModuleFormer架构。每个注意力层有16个注意力模块,每个MLP层有32个MLP模块。推理时,在每层中,MoLM - 350M - 4B和MoLM - 700M - 8B每个令牌激活2个模块,而MoLM - 700M - 4B激活4个模块。MoLM - 350M - 4B和MoLM - 700M - 4B有24个块,MoLM - 700M - 8B有48个块。
模型状态
这是一个基于离线数据集训练的静态模型。随着我们根据社区反馈改进模型安全性,未来将发布调优后的模型版本。
研究论文
"ModuleFormer: Modularity Emerges from Mixture - of - Experts"
📊 评估结果
在本节中,我们报告了MoLM模型在标准学术基准测试中的结果。所有评估均使用LM evaluations Harness。
模型 |
延迟 (ms) |
内存 (GB) |
吞吐量 (tokens/sec) |
Hellaswag (acc) |
PIQA (acc) |
ARC - e (acc) |
ARC - c (acc) |
OBQA (acc) |
Pythia 410M |
554 |
25 |
59594 |
33.72 |
66.70 |
51.89 |
21.42 |
18.2 |
GPT - Neo 1.3B |
991 |
23 |
32857 |
38.66 |
71.11 |
56.19 |
23.12 |
21.4 |
Pythia 1.4B |
918 |
42 |
35559 |
40.41 |
70.84 |
60.52 |
26.11 |
22.2 |
MoLM - 350M - 4B |
497 |
27 |
71017 |
39.21 |
70.13 |
56.44 |
23.55 |
20.8 |
GPT - Neo 2.7B |
1737 |
35 |
18788 |
42.71 |
72.2 |
61.07 |
27.47 |
23.2 |
Pythia 2.8B |
2111 |
70 |
15522 |
45.34 |
73.99 |
64.35 |
29.35 |
23.8 |
MoLM - 700M - 4B |
863 |
27 |
39931 |
42.20 |
73.01 |
60.82 |
25.94 |
22.6 |
MoLM - 700M - 8B |
939 |
38 |
37419 |
43.33 |
72.91 |
62.46 |
27.90 |
23.8 |
模型 |
TriviaQA (0 - shot) |
TriviaQA (1 - shot) |
TriviaQA (5 - shot) |
HumanEval (pass@1) |
HumanEval (pass@10) |
HumanEval (pass@100) |
Wikitext (PPL) |
Pythia 410M |
2.32 |
5.02 |
6.42 |
1.20 |
3.85 |
9.98 |
20.09 |
GPT - Neo 1.3B |
5.24 |
8.01 |
9.74 |
3.62 |
6.87 |
14.50 |
16.16 |
Pythia 1.4B |
5.30 |
9.87 |
12.84 |
2.19 |
7.31 |
14.33 |
14.71 |
MoLM - 350M - 4B |
5.40 |
11.12 |
13.70 |
3.04 |
6.99 |
13.79 |
15.15 |
GPT - Neo 2.7B |
4.82 |
11.23 |
13.67 |
4.89 |
9.54 |
17.90 |
13.93 |
Pythia 2.8B |
7.38 |
15.58 |
18.98 |
4.91 |
11.76 |
21.54 |
12.68 |
MoLM - 700M - 4B |
9.07 |
14.24 |
16.49 |
5.50 |
10.65 |
20.27 |
13.20 |
MoLM - 700M - 8B |
11.47 |
16.73 |
20.75 |
5.51 |
12.58 |
20.40 |
12.97 |
⚠️ 伦理考量与局限性
MoLM是一项新技术,使用时存在风险。到目前为止进行的测试均使用英语,且未涵盖也无法涵盖所有场景。因此,与所有大语言模型一样,MoLM的潜在输出无法提前预测,在某些情况下,模型可能会对用户提示产生不准确、有偏见或其他令人反感的响应。因此,在部署MoLM的任何应用程序之前,开发人员应针对其特定的模型应用进行安全测试和调优。
📄 许可证
Apache - 2.0
📖 引用
如果您使用此仓库中的数据或代码,请引用以下论文:
@article{shen2023moduleformer,
title={ModuleFormer: Learning Modular Large Language Models From Uncurated Data},
author={Shen, Yikang and Zhang, Zheyu and Cao, Tianyou and Tan, Shawn and Chen, Zhenfang and Gan, Chuang},
journal={arXiv preprint arXiv:2306.04640},
year={2023}
}
📋 MoLM模型索引