🚀 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模型索引