许可证:apache-2.0
数据集:
- tiiuae/falcon-refinedweb
管道标签:文本生成
库名称:openlm
标签:
- mamba
- linear
语言:
- en
模型索引:
- 名称:mamba-7b
结果:
- 任务:
类型:文本生成
数据集:
类型:MMLU
名称:MMLU
指标:
- 名称:准确率
类型:准确率
值:33.3
已验证:false
- 任务:
类型:文本生成
数据集:
类型:HellaSwag
名称:HellaSwag
指标:
- 名称:准确率
类型:准确率
值:77.9
已验证:false
- 任务:
类型:文本生成
数据集:
类型:PIQA
名称:PIQA
指标:
- 名称:准确率
类型:准确率
值:81.0
已验证:false
- 任务:
类型:文本生成
数据集:
类型:Winogrande
名称:Winogrande
指标:
- 名称:准确率
类型:准确率
值:71.8
已验证:false
- 任务:
类型:文本生成
数据集:
类型:ai2_arc
名称:ARC-E
指标:
- 名称:准确率
类型:准确率
值:77.5
已验证:false
- 任务:
类型:文本生成
数据集:
类型:ai2_arc
名称:ARC-C
指标:
- 名称:准确率
类型:准确率
值:46.7
已验证:false
Mamba-7B
这是一个基于Mamba架构的70亿参数模型,在RefinedWeb数据集上进行了多轮训练(1.2万亿标记)。
Mamba是一种状态空间模型,与标准Transformer架构不同,它不使用自注意力机制。它在多种自然语言基准测试中表现出色。截至目前,公开的最大纯Mamba预训练模型是Mamba-2.8B。
我们遵循其训练方法,并发布了我们的Mamba-7B版本。
该模型是我们论文《线性化大型语言模型》的基线模型。
模型详情
参数 |
隐藏层大小 |
层数 |
词汇量 |
序列长度 |
70亿 |
4096 |
64 |
50432 |
2048 |
训练详情
- Mamba-7B使用AWS SageMaker在128块H100 80GB GPU上训练。
- 训练于2024年3月开始,持续三周。
| 超参数 | 值 |
|--------------------|------------|
| 精度 | bfloat16
|
| 优化器 | AdamW |
| 学习率 | 3e-4 |
| 学习率冷却结束值 | 1e-5 |
| 预热步数 | 2000 |
| Z-loss | 1e-4 |
| 批量大小 | 200万 |
使用方法
该模型使用OpenLM训练。权重已转换为兼容HuggingFace的格式。
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("tri-ml/mamba-7b-rw")
model = AutoModelForCausalLM.from_pretrained("tri-ml/mamba-7b-rw")
inputs = tokenizer(["The Toyota Supra"], return_tensors="pt")
gen_kwargs = {"max_new_tokens": 50, "top_p": 0.8, "temperature": 0.8, "do_sample": True, "repetition_penalty": 1.1}
output = model.generate(inputs['input_ids'], **gen_kwargs)
output = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
print(output)
性能评估
我们的评估使用Eleuther LM Eval Harness库完成。
下表展示了Mamba 7B与其他基础模型的性能对比。
|
HellaSwag |
PIQA |
Winogrande |
ARC-E |
ARC-C |
MMLU (5-shot) |
Mamba-1.4B |
59.0 |
73.9 |
61.4 |
65.5 |
32.9 |
25.2 |
Mamba-2.8B |
71.0 |
78.1 |
65.9 |
68.2 |
41.7 |
26.2 |
RWKV5-1.7T-7B |
73.0 |
78.6 |
72.9 |
75.8 |
45.6 |
34.9 |
Llama2-7B |
76.0 |
79.1 |
69.1 |
76.3 |
46.3 |
45.9 |
Gemma-7B |
80.7 |
81.9 |
73.7 |
81.1 |
53.2 |
62.9 |
Mistral-7B |
81.0 |
82.1 |
74.0 |
80.9 |
53.8 |
62.4 |
Mamba-7B |
77.9 |
81.0 |
71.8 |
77.5 |
46.7 |
33.3 |
引用方式
如果您使用此模型,请引用我们的论文《线性化大型语言模型》。
@article{Mercat2024Linearizing,
title={Linearizing Large Language Models},
author={Jean Mercat and Igor Vasiljevic and Sedrick Keh and Kushal Arora and Achal Dave and Adrien Gaidon and Thomas Kollar},
journal={arXiv preprint arXiv:2405.06640},
year={2024}
}
参考文献
Mamba
@article{mamba,
title={Mamba: Linear-Time Sequence Modeling with Selective State Spaces},
author={Gu, Albert and Dao, Tri},
journal={arXiv preprint arXiv:2312.00752},
year={2023}
}
OpenLM
@misc{open_lm,
author = {Gururangan, Suchin and Wortsman, Mitchell and Gadre, Samir Yitzhak and Dave, Achal and Kilian, Maciej and Shi, Weijia and Mercat, Jean and Smyrnis, Georgios and Ilharco, Gabriel and Jordan, Matt and Heckel, Reinhard and Dimakis, Alex and Farhadi, Ali and Shankar, Vaishaal and Schmidt, Ludwig},
title = {{open_lm}: a minimal but performative language modeling (LM) repository},
year = {2023},
note = {GitHub repository},
url = {https://github.com/mlfoundations/open_lm/}
}