🚀 MobiLlama-05B
MobiLlama-05B是一個參數規模為5億的小型語言模型。它基於Amber數據源 Amber-Dataset 進行訓練,能在資源受限的場景下提供高效且準確的語言處理能力。
🚀 快速開始
在資源受限的設備上進行自然語言處理時,MobiLlama-05B是一個不錯的選擇。它從大型模型出發,通過精心設計的參數共享方案,降低了預訓練和部署成本,同時保證了模型的性能。
✨ 主要特性
- 輕量級設計:專為資源受限的計算環境設計,減少資源需求的同時提升性能。
- 完全透明:完整的訓練數據管道、訓練代碼、模型權重以及300多個檢查點和評估代碼均可在 Github 上獲取。
- 架構優勢:採用LLaMA-7B的架構設計構建小型語言模型(SLM)。
📚 詳細文檔
模型概述
在最近的大語言模型(LLM)發展中,“越大越好”一直是主流趨勢。然而,LLM並不適合需要設備端處理、能源效率、低內存佔用和響應效率的場景。這些需求對於隱私、安全和可持續部署至關重要。本文通過應對為資源受限設備設計準確且高效的小型語言模型(SLM)這一挑戰,探索了“少即是多”的範式。我們的主要貢獻是引入了一個準確且完全透明的開源5億(0.5B)參數的SLM,名為MobiLlama,它滿足了資源受限計算的特定需求,強調在減少資源需求的同時提高性能。MobiLlama是一種從大型模型開始的SLM設計,並應用了精心設計的參數共享方案,以降低預訓練和部署成本。我們的工作不僅致力於填補開源SLM的空白,還確保了完全透明,完整的訓練數據管道、訓練代碼、模型權重以及300多個檢查點和評估代碼均可在我們的 Github 上獲取。
Arxiv論文鏈接
模型描述
💻 使用示例
基礎用法
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("MBZUAI/MobiLlama-05B", trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained("MBZUAI/MobiLlama-05B", trust_remote_code=True)
model.to('cuda')
text = "I was walking towards the river when "
input_ids = tokenizer(text, return_tensors="pt").to('cuda').input_ids
outputs = model.generate(input_ids, max_length=1000, repetition_penalty=1.2, pad_token_id=tokenizer.eos_token_id)
print(tokenizer.batch_decode(outputs[:, input_ids.shape[1]:-1])[0].strip())
🔧 技術細節
訓練數據混合
子集 |
令牌數(十億) |
Arxiv |
30.00 |
書籍 |
28.86 |
C4 |
197.67 |
Refined-Web |
665.01 |
StarCoder |
291.92 |
StackExchange |
21.75 |
維基百科 |
23.90 |
總計 |
1259.13 |
超參數
超參數 |
值 |
總參數 |
0.52B |
隱藏層大小 |
2048 |
中間層大小(MLPs) |
5632 |
注意力頭數量 |
32 |
隱藏層數量 |
22 |
RMSNorm ɛ |
1e^-5 |
最大序列長度 |
2048 |
詞彙表大小 |
32000 |
評估
評估基準 |
MobiLlama-0.5B |
MobiLlama-0.8B |
MobiLlama-1.2B |
HellaSwag |
52.52 |
54.09 |
62.99 |
MMLU |
26.45 |
26.92 |
24.23 |
Arc Challenge |
29.52 |
30.20 |
34.55 |
TruthfulQA |
38.05 |
38.48 |
35.57 |
CrowsPairs |
64.03 |
64.82 |
68.12 |
PIQA |
72.03 |
73.17 |
75.29 |
Race |
33.68 |
33.37 |
35.31 |
SIQA |
40.22 |
41.60 |
41.96 |
Winogrande |
57.53 |
57.45 |
61.08 |
📄 許可證
本模型採用MIT許可證,詳情請見 許可證鏈接。
引用
BibTeX:
@misc{thawakar2024mobillama,
title={MobiLlama: Towards Accurate and Lightweight Fully Transparent GPT},
author={Omkar Thawakar and Ashmal Vayani and Salman Khan and Hisham Cholakkal and Rao Muhammad Anwer and Michael Felsberg and Timothy Baldwin and Eric P. Xing and Fahad Shahbaz Khan},
year={2024},
eprint={2402.16840},
archivePrefix={arXiv},
primaryClass={cs.CL}
}