什么是LLaMA
LLaMA是由美国的Meta AI发布的大语言系列模型,全称是Large Language Model Meta AI,论文:LLaMA: Open and Efficient Foundation Language Models。Llama这个单词本身是指美洲大羊驼,所以社区也将这个系列的模型昵称为羊驼系模型。
在这篇论文中,使用数万亿个(trillions of) token 训练LLaMA模型,证明了使用公开数据集就能训练出最先进的模型, 而并非必须使用专有和私有数据集。
训练数据集有几种不同来源,涵盖了多个领域,如下表所示。
LLaMA 模型能够生成文本、进行对话、总结书面材料以及解决数学定理或预测蛋白质结构等。按照参数量规模,LLaMA可分为四个:LLaMA-7B、LLaMA-13B、LLaMA-30B与LLaMA-65B。这里的B是billion的缩写,指代模型的参数规模。故最小的模型7B包含70亿个参数,而最大的一款65B则包含650亿个参数。
如何获取LLaMA
LLaMA本身的代码开源,其Github地址为:llama,如下图所示:
但是其权重需要向Meta在线申请。下载完成后的权重文件大概如下所示:
LLaMA
├── 13B
│ ├── checklist.chk
│ ├── consolidated.00.pth
│ ├── consolidated.01.pth
│ └── params.json
├── 30B
│ ├── checklist.chk
│ ├── consolidated.00.pth
│ ├── consolidated.01.pth
│ ├── consolidated.02.pth
│ ├── consolidated.03.pth
│ └── params.json
├── 65B
│ ├── checklist.chk
│ ├── consolidated.00.pth
│ ├── consolidated.01.pth
│ ├── consolidated.02.pth
│ ├── consolidated.03.pth
│ ├── consolidated.04.pth
│ ├── consolidated.05.pth
│ ├── consolidated.06.pth
│ ├── consolidated.07.pth
│ └── params.json
├── 7B
│ ├── checklist.chk
│ ├── consolidated.00.pth
│ └── params.json
├── llama.sh
├── tokenizer_checklist.chk
└── tokenizer.model
全部文件加起来的大小约253.2GB。注意使用附带的checklist.chk文件校验文件哈希值。
md5sum -c checklist.chk
不过,基于 Llama 2 构建应用并不只是把它从开源库里下载下来那么简单,模型的后续调优、中文增强、安全评估、与外部数据的融合、推理算力消耗等都是摆在开发者、企业面前的现实问题。这也是当前很多大模型的共性问题。大模型和应用之间需要一座桥梁。
以LLaMA为基础,后续衍生出了多个“羊驼家族”模型如Vicuna(小羊驼)和Alpaca(羊驼)。