# OpenLLaMA

**OpenLLaMA** 是 [Meta AI](https://www.edgepedia.org/zh/meta-ai) 的 LLaMA 大型语言模型的一个以宽松许可证发布的开源复现版本，由 OpenLM Research 项目开发，训练使用的是公开的 [RedPajama](https://www.edgepedia.org/zh/redpajama) 数据集，而非 Meta 的专有训练语料。该项目发布了 3B、7B 和 13B 参数模型，其中 3B 和 7B 版本在 1 万亿 token 上训练，早期的 13B 预览版在 6000 亿 token 上训练，同时提供了 PyTorch 和 JAX 权重，以及与原始 LLaMA 模型的基准对比。<sup>[1](https://github.com/openlm-research/open_llama)</sup><sup> • </sup><sup>[2](https://huggingface.co/openlm-research/open_llama_7b)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | Meta AI 的 LLaMA 的开源复现，模型权重可在现有实现中直接替换 LLaMA<sup>[1](https://github.com/openlm-research/open_llama)</sup> |
| 许可证 | EasyLM 训练框架和检查点权重均采用 Apache 2.0<sup>[1](https://github.com/openlm-research/open_llama)</sup> |
| 模型规模 | 3B 和 7B 在 1T token 上训练；13B 预览版为 600B token，后完成 1T token 训练<sup>[2](https://huggingface.co/openlm-research/open_llama_7b)</sup><sup> • </sup><sup>[1](https://github.com/openlm-research/open_llama)</sup> |
| 训练数据（v1） | RedPajama 数据集，即对约 1.2 万亿 token 的 LLaMA 训练语料的开源复现<sup>[1](https://github.com/openlm-research/open_llama)</sup><sup> • </sup><sup>[3](https://arxiv.org/abs/2411.12372)</sup> |
| 训练数据（v2） | Falcon RefinedWeb 数据集、StarCoder 数据集，以及 RedPajama 中 Wikipedia、ArXiv、书籍和 Stack Exchange 部分的混合<sup>[1](https://github.com/openlm-research/open_llama)</sup> |
| 硬件与吞吐量 | 云 TPU-v4 芯片，配合基于 JAX 的 EasyLM 框架；7B 模型每块 TPU-v4 芯片每秒超过 2200 token<sup>[1](https://github.com/openlm-research/open_llama)</sup> |
| 权重格式 | EasyLM（JAX）和用于 Hugging Face transformers 库的 PyTorch<sup>[1](https://github.com/openlm-research/open_llama)</sup> |

## 目的及与 LLaMA 的关系

Meta 的原始 LLaMA 于 2023 年 2 月推出，是一组从 7B 到 65B 参数的基础语言模型，以非商业许可证向研究人员发布，其训练数据集从未公开。<sup>[4](https://arxiv.org/abs/2302.13971)</sup> OpenLLaMA 同时解决了这两项限制：其权重和训练框架采用 Apache 2.0 许可证，训练数据完全公开。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

复现工作在已公开信息允许的范围内尽可能贴近原始 LLaMA 的配方。项目声明其使用了与 LLaMA 论文完全相同的预处理步骤和训练超参数，包括模型架构、上下文长度、训练步数、学习率调度和优化器；唯一的区别在于数据集，使用的是公开数据集而非 Meta 的数据集。<sup>[1](https://github.com/openlm-research/open_llama)</sup> 与原始模型不同，OpenLLaMA 的分词器和权重完全从头训练，因此用户无需获取原始 LLaMA 的分词器或权重。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

## 训练数据

**v1 模型使用的 RedPajama。** 第一代 OpenLLaMA 模型在 [Together AI](https://www.edgepedia.org/zh/together-ai) 发布的 RedPajama 数据集上训练，该数据集是对 LLaMA 训练语料的尽力而为的开源复现，包含约 1.2 万亿 token，取自七个来源：英文 CommonCrawl、C4、GitHub、[Wikipedia](https://www.edgepedia.org/zh/wikipedia)、书籍（[Project Gutenberg](https://www.edgepedia.org/zh/project-gutenberg) 和 Books3）、ArXiv 和 Stack Exchange。<sup>[1](https://github.com/openlm-research/open_llama)</sup><sup> • </sup><sup>[3](https://arxiv.org/abs/2411.12372)</sup> RedPajama 论文报告的 token 数量为：CommonCrawl 878B、C4 175B、GitHub 59B、书籍 26B、ArXiv 28B、Wikipedia 24B、Stack Exchange 20B。<sup>[3](https://arxiv.org/abs/2411.12372)</sup>

**v2 的修订混合。** 2023 年 7 月，项目发布了 7Bv2，随后发布了 3Bv2 和 3Bv3 模型，它们在不同的混合数据上训练：Falcon RefinedWeb 数据集与 [StarCoder](https://www.edgepedia.org/zh/starcoder) 代码数据集，以及 RedPajama 中的 Wikipedia、ArXiv、书籍和 Stack Exchange 部分相结合。项目称 v2 模型优于在原始混合数据上训练的 v1 模型。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

## 训练设置

训练在云 TPU-v4 芯片上运行，使用 EasyLM——该项目为训练和微调大型语言模型而开发的基于 JAX 的训练流水线。该设置将常规数据并行与[全分片数据并行](https://www.edgepedia.org/zh/fully-sharded-data-parallelism)（也称为 ZeRO 第三阶段）相结合，以平衡吞吐量和内存使用，7B 模型每块 TPU-v4 芯片的吞吐量超过每秒 2200 token。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

发布历史显示了一次迭代式的公开训练过程。首先发布了在 2000 亿 token 上训练的 7B 模型预览版，随后发布了 400B token 的检查点，然后是 7B 的 700B token 和 3B 的 600B token 检查点，最终于 2023 年 6 月 7 日发布了 3B 和 7B 的 1T token 版本，6 月 15 日发布了 13B 版本，后者是与 [Stability AI](https://www.edgepedia.org/zh/stability-ai) 合作训练的。<sup>[1](https://github.com/openlm-research/open_llama)</sup> 训练中途，团队发现早期检查点的分词器配置有误，导致换行符未被保留；他们重新训练了分词器并重新开始训练，观察到新分词器下训练损失更低。<sup>[1](https://github.com/openlm-research/open_llama)</sup> 分词器的一个特性也影响了使用建议：v1 分词器在分词前会将多个连续空格合并为一个，类似于 T5 分词器，因此不适合代码生成任务，项目建议用户在代码相关工作中使用 v2 模型。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

## 评估

OpenLLaMA 使用 EleutherAI 的 lm-evaluation-harness 在广泛的任务上进行了评估，原始 LLaMA 模型在相同的评估协议下运行以作对比，同时还对比了 GPT-J——一个在 Pile 上训练的 6B 参数模型。<sup>[1](https://github.com/openlm-research/open_llama)</sup> 项目报告称，OpenLLaMA 在大多数任务上与原始 LLaMA 和 GPT-J 表现相当，并在某些任务上优于它们。<sup>[1](https://github.com/openlm-research/open_llama)</sup> 已发布表格中的样本分数说明了这一模式：在 [HellaSwag](https://www.edgepedia.org/zh/hellaswag) 归一化准确率上，OpenLLaMA 7B 得分为 0.72，LLaMA 7B 为 0.73；在 ARC-Challenge 归一化准确率上，OpenLLaMA 7B 得分为 0.38，LLaMA 7B 为 0.41，而 OpenLLaMA 13B 达到 0.44，与 LLaMA 13B 持平。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

两个基准任务 CB 和 WSC 从已发布的对比中被移除，因为 OpenLLaMA 模型在这些任务上表现好得可疑，项目和后来的分析将其解读为训练数据中可能存在基准数据污染的迹象。<sup>[1](https://github.com/openlm-research/open_llama)</sup><sup> • </sup><sup>[5](https://deepwiki.com/openlm-research/open_llama/5.1-benchmark-tasks)</sup> 项目还指出，其自身的 LLaMA 基线数字与原始 LLaMA 论文略有不同，将其归因于不同的评估协议。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

## 使用与后续影响

权重以 PyTorch 格式通过 transformers 库直接从 [Hugging Face Hub](https://www.edgepedia.org/zh/hugging-face-hub) 加载，建议使用 LlamaTokenizer 类而非自动转换的快速分词器，因为项目观察到后者有时会产生错误的分词结果。<sup>[1](https://github.com/openlm-research/open_llama)</sup>

OpenLLaMA 成为后来开放模型研究中的标准对比点。Sheared-LLaMA 项目将 LLaMA2-7B 剪枝至 1.3B 和 2.7B 参数，该项目将 OpenLLaMA 列为其在同等规模开源模型中性能超越的对象之一，而所用计算量仅为从头训练的约 3%。<sup>[6](https://arxiv.org/abs/2310.06694)</sup> 后来的工作也在 MMLU 和 [TruthfulQA](https://www.edgepedia.org/zh/truthfulqa) 等基准上将 OpenLLaMA 作为基线引用。<sup>[7](https://openreview.net/pdf/2c183eaa96bc41fbe46d1228a7dfa063568e2bb1.pdf)</sup>

## References

1. [OpenLLaMA: An Open Reproduction of LLaMA, OpenLM Research GitHub repository](https://github.com/openlm-research/open_llama)
2. [openlm-research/open_llama_7b model card, Hugging Face](https://huggingface.co/openlm-research/open_llama_7b)
3. [Weber, M. et al. (2024). RedPajama: an Open Dataset for Training Large Language Models. arXiv:2411.12372](https://arxiv.org/abs/2411.12372)
4. [Touvron, H. et al. (2023). LLaMA: Open and Efficient Foundation Language Models. arXiv:2302.13971](https://arxiv.org/abs/2302.13971)
5. [Benchmark Tasks, DeepWiki: openlm-research/open_llama](https://deepwiki.com/openlm-research/open_llama/5.1-benchmark-tasks)
6. [Xia, M. et al. (2023). Sheared LLaMA: Accelerating Language Model Pre-training via Structured Pruning. arXiv:2310.06694](https://arxiv.org/abs/2310.06694)
7. [Conference paper at ICLR 2025 comparing against OpenLLaMA on TruthfulQA, OpenReview](https://openreview.net/pdf/2c183eaa96bc41fbe46d1228a7dfa063568e2bb1.pdf)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › Model families and named models › Large language model families › Open-weight model families

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/openllama

English original: https://www.edgepedia.org/openllama
