截至目前(2025年5月),Meta 发布的 LLaMA (Large Language Model Meta AI) 系列共经历了 4个大版本、7个主要迭代,下面逐一介绍。
一、LLaMA 1(2023年2月)
第一版 LLaMA(有时也称 LLaMA 1)于 2023 年 2 月 24 日通过博客和论文正式发布。[6]它包含四个文本模型,参数量分别为 7B、13B、33B 和 65B。[6]
架构特点:
LLaMA 1 的核心是标准 Transformer Decoder-Only 架构,但在此基础上集成了多项当时最优的改进技术:
- Pre-norm + RMSNorm :LLaMA 1 在标准 Transformer 架构上进行了若干改造,包括使用 RMSNorm 对输入进行预归一化(Pre-normalization)、使用 SwiGLU 激活函数和旋转位置编码(RoPE)。[1]
- SwiGLU 激活函数 :LLaMA 使用 SwiGLU 激活函数,而非 GPT-3 的 GeLU。[6]
- RoPE 位置编码 :LLaMA 使用旋转位置编码(RoPE)代替绝对位置编码,并以 RMSNorm 代替 Layer Normalization。[6]
- 上下文长度 :这些模型使用标准 Transformer Decoder 架构,训练时的上下文窗口为 2048 个 token。[6]
效果亮点:
LLaMA-13B 在大多数基准测试上超越了 GPT-3(175B),LLaMA-65B 可与 Chinchilla-70B 和 PaLM-540B 媲美。[6]这背后的核心设计理念是:开发团队专注于通过扩大训练数据量来提升性能,而非一味增加参数数量。[6]
二、LLaMA 2(2023年7月)
2023 年 7 月 18 日,Meta 联合微软发布了 LLaMA 2,提供 7B、13B 和 70B 三种参数规模。[6]
架构特点:
LLaMA 2 大体上保留了 LLaMA 1 的架构,但在更多 token 上进行预训练、将上下文长度翻倍,并在 70B 模型中引入了分组查询注意力(GQA)以提升推理效率。[3]
- GQA(Grouped Query Attention) :与标准多头注意力(MHA)不同,GQA 在保留多个 Query head 的同时减少了 Key/Value head 的数量,是 MQA 与 MHA 之间的折中方案。[1]
- 上下文扩展 :LLaMA 2 将上下文长度从 LLaMA 1 的 2K token 扩展到了 4K token。[2]
- 更多训练数据 :LLaMA 2 更新了预训练数据组成,对高质量和事实性强的数据来源进行了更多采样,并将预训练数据集规模增加了 40%。[2]
关键升级------对齐训练(RLHF):
LLaMA 2 采用了 RLHF、SFT 以及迭代奖励建模等微调方法。[2]LLaMA 2 是唯一一个分别为「安全性」和「有用性」训练独立 RLHF 模型的版本。[5]此外,Meta 还发布了专门针对对话的微调版本 LLaMA 2-Chat ,以及代码专用变体 Code LLaMA。
三、LLaMA 3(2024年4月)
2024 年 4 月 18 日,Meta 发布了 LLaMA 3,提供 8B 和 70B 两种参数规模。[6]
架构特点:
- GQA 全面推广 :尽管整体架构相比 LLaMA 2 没有根本改变,但所有规模的 LLaMA 3 变体均采用了 GQA(此前仅限于较大模型),GQA 通过更紧凑地表示注意力机制中的 Key/Value,大幅缩减了推理时的 KV 缓存占用。[5]
- 更大词汇表与更强分词器 :LLaMA 3 将 GQA 扩展到小模型,引入了更高效的分词器并扩大了词汇表规模。[5]
- 上下文长度提升 :LLaMA 3 的上下文窗口扩展至 8192 个 token,高于 LLaMA 2 的 4096 和 LLaMA 1 的 2048。[5]
- 更大规模训练数据 :LLaMA 3 的训练数据规模大幅提升至 15 万亿 token,远超 LLaMA 2 的 2 万亿 token。[5]
四、LLaMA 3.1(2024年7月)
LLaMA 3.1 于 2024 年 7 月发布,新增了 405B 参数规模的模型。[3]
主要升级:
LLaMA 3.1 并未改变核心架构,更大的变化在于训练数据的清洗流程、更长的上下文长度以及新增支持的语言。[5]
- 超长上下文 :LLaMA 3.1 支持高达 128K token 的上下文窗口,使其能够在长时间交互中保持连贯,并显著提升了复杂推理能力。[6]
- 里程碑式规模 :405B 是该版本的重要亮点,在此之前,开放大语言模型通常不超过 100B 参数规模。[10]
- 多语言支持:新增对 8 种语言的支持。
五、LLaMA 3.2(2024年9月/10月)
LLaMA 3.2 于 2024 年 10 月发布,是 Meta 第一个完全多模态的 LLM。[3]
主要升级:
- 多模态视觉能力 :LLaMA 3.2 系列引入了支持视觉的多模态模型,包括 11B 和 90B 参数的视觉模型,它们同时接受图片和文本输入。[6]
- 轻量化边缘部署 :1B 和 3B 的小型模型专为边缘设备和低功耗微调场景设计。[6]
- 所有 LLaMA 3 系列模型均支持 128K token 的超长上下文。
六、LLaMA 3.3(2024年12月)
LLaMA 3.3 于 2024 年 12 月发布,是一个 70B 参数的文本模型,针对多语言对话进行了指令微调,支持 8 种语言及 128K 上下文。[6]
主要升级:
Meta 声称,LLaMA 3.3 的 70B 变体能够在更低算力需求下达到与 3.1 的 405B 变体相当的性能。[3]本质上是对 LLaMA 3 系列较小模型的后期训练(Post-training)进行了大幅提升。
七、LLaMA 4(2025年4月)
2025 年 4 月 5 日,Meta 发布了 LLaMA 4 系列模型。[3]这是迄今为止架构变化最大的一次迭代,堪称"全面重构"。
核心架构革命------MoE(混合专家架构):
LLaMA 4 是 Llama 家族中首批采用混合专家(MoE)架构的模型:每次处理输入 token 时,只有一部分参数被激活,兼顾了能力与效率。[3]
LLaMA 4 采用交替的 Dense 层与 MoE 层来提升推理效率;MoE 层使用 128 个路由专家和一个共享专家,每个 token 会被发送给共享专家以及 128 个路由专家中的一个;虽然所有参数都存储在内存中,但实际推理时只有一部分参数被激活。[1]
iRoPE 架构:
LLaMA 4 架构的关键创新是使用了交错的、不含位置编码的注意力层,并在推理时对注意力进行温度缩放以增强长度泛化能力。Meta 将其称为 iRoPE 架构,其中"i"代表"交错"注意力层,暗示着支持"无限"上下文长度的长期目标,而"RoPE"则指大多数层中使用的旋转位置编码。[1]
三款子模型:
LLaMA 4 系列推出了两款高效模型:LLaMA 4 Scout(17B 激活参数、16 个专家)和 LLaMA 4 Maverick(17B 激活参数、128 个专家)。[2]此外还有 LLaMA 4 Behemoth,拥有 2880 亿激活参数、16 个专家,总参数量接近 2 万亿。[9]
原生多模态:
LLaMA 4 支持多模态输入(文本与图像输入,文本输出)以及 12 种语言的多语言能力。[6]
超长上下文:
LLaMA 4 Scout 提供 1000 万 token 的上下文窗口,Maverick 提供 100 万 token,远超此前 128K token 的主流标准。[8]
总结对比
| 版本 | 发布时间 | 参数规模 | 架构类型 | 上下文长度 | 关键技术 |
|---|---|---|---|---|---|
| LLaMA 1 | 2023.02 | 7B~65B | Dense Transformer | 2K | RMSNorm, SwiGLU, RoPE |
| LLaMA 2 | 2023.07 | 7B~70B | Dense Transformer | 4K | GQA (70B), RLHF |
| LLaMA 3 | 2024.04 | 8B~70B | Dense Transformer | 8K | GQA全面应用, 15T训练数据 |
| LLaMA 3.1 | 2024.07 | 8B~405B | Dense Transformer | 128K | 超大规模(405B), 多语言 |
| LLaMA 3.2 | 2024.09 | 1B~90B | Dense + 视觉编码器 | 128K | 原生多模态,轻量化 |
| LLaMA 3.3 | 2024.12 | 70B | Dense Transformer | 128K | 后期训练优化 |
| LLaMA 4 | 2025.04 | 17B激活~2T总参 | MoE + iRoPE | 1M~10M | MoE、原生多模态、iRoPE |
总体来看,LLaMA 4 引入了混合专家(MoE)和原生多模态等根本性架构变化,与 LLaMA 1~3 时代有了显著区别。[8]整个系列从最初的纯研究用途 Dense 模型,逐步演进为面向生产部署的高效多模态 MoE 系统。
- The Llama 4 herd: The beginning of a new era of natively multimodal AI innovation
- The LLaMA Family of Models, Model Architecture, Size, and Scaling Laws
- LLaMA 2: Open Foundation and Fine-Tuned Chat Models - ZHAOHONG LIU's Homepage
- meta-llama (Meta Llama)
- LLaMA Components: RMSNorm, SwiGLU, and RoPE - Interactive | Michael Brenndoerfer | Michael Brenndoerfer
- Llama 2 --- Klu
- Meta Llama 4 explained: Everything you need to know
- Meta Llama 4 Maverick
- LLaMA Architecture: Design Philosophy and Training Efficiency - Interactive | Michael Brenndoerfer | Michael Brenndoerfer
- Llama 2 - Transformers documentation
- Unmatched Performance and Efficiency | Llama 4
- LLaMA: Concepts Explained (Summary) | by Anshu Kumar | Medium
- LLaMA 2 | AI Wiki
- The Evolution of Llama: From Llama 1 to Llama 3.1
- Llama 4 Scout: A Technical Analysis of Native Multimodality, Sparse Architecture, and the 10-Million Token Context Frontier | Uplatz Blog
- Aman's AI Journal • Models • LLaMA
- Llama 2: Meta AI's Advanced Open-Source LLM Model
- Llama (language model) - Wikipedia
- Evolution of Meta's LLaMA Models and Parameter-Efficient Fine-Tuning of Large Language Models: A Survey
- Choosing the Best Llama Model: Llama 3 vs 3.1 vs 3.2
- GitHub - aju22/LLaMA2: This repository contains an implementation of the LLaMA 2 (Large Language Model Meta AI) model, a Generative Pretrained Transformer (GPT) variant. The implementation focuses on the model architecture and the inference process. The code is restructured and heavily commented to facilitate easy understanding of the key parts of the architecture. · GitHub
- Llama 4: Did Meta just push the panic button?
- Meta Unleashes New Llama 4 AI Models - AIwire
- Building LLaMA from Scratch: A Step-by-Step Guide
- Llama 2 · Hugging Face
- The Evolution of Meta's Llama LLMs - by Ram Komarraju
- Architecture, MoE, Multimodal Power - Meta LLama 4
- LLaMA: Efficient Language Models 2023 | PDF | Cognition
- LLaMA-2 from the Ground Up - by Cameron R. Wolfe, Ph.D.
- The Big LLM Architecture Comparison - Ahead of AI
- Meta releases Llama 4, a new crop of flagship AI models | TechCrunch
- Paper Study: LLaMA Open and Efficient Foundation Language Models | Mun Hou's Blog
- LLAMA Series. --- technical evolution of LLAMA models | by Ankit kumar | Medium
- The Evolution of Llama: From Llama 1 to Llama 3.1 | Towards Data Science
- All Meta AI models available in 2025: complete list for web, mobile, and developer APIs including Llama 4, 3.3, 3.2, and 3.1
- Transformer Design Guide (Part 2: Modern Architecture) | Rohit Bandaru
- Thoughts from LLama-2 paper. Meta recently launched LLama-2... | by Manav Gupta | Medium