# 持续预训练

持续预训练（continual pre-training，CPT）是指取用一个已经预训练好的语言模型，在新的语料上继续预训练——例如新的领域、新的语言或更新的数据——而不是从头训练一个模型。它位于原始预训练与监督微调之间，其核心张力在于：既要获得新能力，又要避免灾难性遗忘，即模型在先前学到的知识上性能退化。<sup>[1](https://arxiv.org/abs/2404.16789)</sup>

| 关键事实 | 详情 |
|---|---|
| 定义 | 在来自不同垂直领域、时间或语言领域的一系列语料上对模型进行增量预训练<sup>[2](https://doi.org/10.1145/3716629)</sup> |
| 三种偏移类型 | 语言偏移（如从英语到中文）、内容偏移（如从化学到生物学）和时间偏移（如从2021年新闻到2022年新闻）<sup>[3](https://doi.org/10.1145/3735633)</sup> |
| 奠基性结果 | 跨四个领域、八项分类任务的领域自适应预训练（DAPT）在高资源和低资源设置下均提升了性能（Gururangan等，ACL 2020）<sup>[4](https://aclanthology.org/2020.acl-main.740/)</sup> |
| 规模示例 | Code Llama 是在5000亿代码token上对Llama-2进行持续预训练得到的；Llama-3.1以同样方式将上下文从8K扩展到128K token<sup>[5](https://llmbook.icsgen-ai.org/part-2-understanding-llms/module-06-pretraining-scaling-laws/section-6.2.html)</sup> |
| 模型规模效应 | 在一项覆盖GPT-2各规模和RoBERTa的基准测试中，持续预训练在目标领域困惑度上始终优于单独的DAPT，且模型越小优势越大<sup>[6](https://cagatayyildiz.github.io/projects/domain-adaptation/)</sup> |
| 数据量注意事项 | 在该设置下Llama-2-7B未获益，原因是各领域语料太小，不足以撼动一个70亿参数的模型<sup>[6](https://cagatayyildiz.github.io/projects/domain-adaptation/)</sup> |
| 主要风险 | 对先前知识的灾难性遗忘，可通过回放、正则化、蒸馏和架构隔离来缓解<sup>[7](https://openreview.net/pdf?id=10XgR4QORn)</sup> |

## 与领域自适应预训练的关系

术语上存在重叠。2020年那项颇具影响力的研究《不要停止预训练》（Don't Stop Pretraining）表明，在领域内文本上进行第二阶段预训练——作者称之为领域自适应预训练（DAPT）——能改善下游分类任务，而在DAPT之后进一步在任务的无标注数据上自适应（任务自适应预训练，TAPT）仍有帮助。<sup>[4](https://aclanthology.org/2020.acl-main.740/)</sup>此后的综述将众多在用名称——包括“持续预训练”“进一步预训练”“领域调优”和“知识注入训练”——统一归入DAP标签之下，并将持续预训练（CPT）、领域自适应预训练（DAP）和持续微调（CFT）定位为大语言模型自适应的三个阶段。<sup>[3](https://doi.org/10.1145/3735633)</sup>

一篇关于终身学习的综述将持续预训练定义为在一系列数据集 \( \mathcal{D}^{(1)}, \ldots, \mathcal{D}^{(T)} \) 上的增量学习，其中每个数据集代表来自不同垂直领域、时间领域或语言领域的语料，并区分了持续垂直领域预训练、持续语言领域预训练和持续时间领域预训练。<sup>[2](https://doi.org/10.1145/3716629)</sup>

## 证据说明了什么

**模型规模在两个方向上都有影响。** 一项2024年关于持续领域自适应预训练（continual domain-adaptive pretraining）的基准研究报告称，持续预训练在15亿参数以下的模型上持续带来提升，并优于普通的领域自适应；在同一语料上持续预训练时，更大的模型总能达到比小模型更好的困惑度；而小模型最为敏感，学习和遗忘的速率都最高。持续预训练还提升了GPT-2系列的下游任务表现。<sup>[8](https://arxiv.org/abs/2402.17400)</sup>在GPT-2各规模（Small、Medium、Large、XL）和RoBERTa上，持续预训练最终达到的目标领域困惑度均低于单独的DAPT，小模型的优势幅度很大，大模型的优势虽收窄但仍然存在。<sup>[6](https://cagatayyildiz.github.io/projects/domain-adaptation/)</sup>

**数据量限制大模型。** 在同一设置下，Llama-2-7B未获益；作者将其归因于数据量而非架构，因为各领域语料太小，不足以撼动一个70亿参数的模型。<sup>[6](https://cagatayyildiz.github.io/projects/domain-adaptation/)</sup>这与文献中一个更广泛的观察一致：有限的预训练数据在持续预训练中可能有害。<sup>[9](https://aclanthology.org/2025.acl-long.1551.pdf)</sup>

**领域顺序与相似性影响迁移。** 该2024年研究发现，当领域序列在语义上相似时，持续预训练能让模型更好地专精；而在其他情况下，打乱训练领域顺序会带来更好的迁移和最终性能。<sup>[8](https://arxiv.org/abs/2402.17400)</sup>

**在数据丰富的领域，从头训练仍可能胜出。** 对于拥有大量无标注文本的领域（如生物医学），从头预训练一个语言模型相比在通用领域模型上持续预训练能带来显著收益，因此CPT是一种成本驱动的选择，而非普适最优解。<sup>[10](https://doi.org/10.1145/3458754)</sup>

**时间自适应比领域自适应更难。** 关于时间效应的研究发现，在更新的数据上重新训练能在特定时间点获得最佳性能，但在按未来时段划出的一小部分数据上进行的持续预训练实验导致了急剧的性能下降；所引研究还表明，即便有数百万个样本，通过持续预训练进行时间自适应的收益也有限。<sup>[11](https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00497/112912/Temporal-Effects-on-Pre-trained-Models-for)</sup>一个大规模时间持续基准（TiC-CC）被构建出来以模拟规模化预训练，其中指出早期的持续学习比较显示方法之间差距很小，可能源于预训练规模较小。<sup>[9](https://aclanthology.org/2025.acl-long.1551.pdf)</sup>

## 防止遗忘的方法

大多数CPT方法建立在经典持续学习技术之上。<sup>[7](https://openreview.net/pdf?id=10XgR4QORn)</sup>

- **回放**将来自早期预训练数据的样本或伪样本混入新的训练数据中。<sup>[12](https://openreview.net/pdf?id=Vk1rNMl0J1)</sup>
- **参数正则化**约束参数漂移，使用弹性权重巩固（EWC）和RecAdam等方法。<sup>[7](https://openreview.net/pdf?id=10XgR4QORn)</sup>
- **蒸馏**使模型在旧数据上的输出接近教师模型；在一项覆盖研究论文流和按时间排序的推文流的终身预训练研究中，基于蒸馏的方法在保留早期领域下游性能方面最为有效。<sup>[13](https://aclanthology.org/2022.bigscience-1.1/)</sup>
- **架构隔离**添加适配器模块、扩展词表，或采用稀疏模块化结构（如混合专家），以容纳新知识而不覆盖旧表征。<sup>[7](https://openreview.net/pdf?id=10XgR4QORn)</sup>
- **数据选择**可以减少需要学习的内容：RHO-1提出选择性语言建模（Selective Language Modeling），用参考模型对token困惑度打分，只在困惑度高的token上持续预训练。<sup>[3](https://doi.org/10.1145/3735633)</sup>

LoRA和DoRA等参数高效方法也已在持续多模态预训练中被研究，其中自适应能力与保持能力之间的权衡取决于秩以及更新哪些参数。<sup>[14](https://proceedings.nips.cc/paper_files/paper/2024/file/f1a6a2cdc7e65dbb4579e78f97cd2665-Paper-Datasets_and_Benchmarks_Track.pdf)</sup>

## 实际应用

CPT远比从头训练基础模型便宜，但它仍然是一个完整的训练系统工程，涉及数据血缘、优化器轨迹、分词器兼容性、分布式检查点和回归测试。<sup>[15](https://sungeuns.github.io/foundation-model-engineering/chapter-8/continued-pretraining-and-domain-adaptation/)</sup>有记录的生产案例包括[Code Llama](https://www.edgepedia.org/zh/code-llama)（Llama-2在5000亿代码token上继续训练）、Llama-3.1从8K到128K的上下文扩展，以及医学、法律和金融领域的领域模型。<sup>[5](https://llmbook.icsgen-ai.org/part-2-understanding-llms/module-06-pretraining-scaling-laws/section-6.2.html)</sup>该技术也被应用于文本之外，例如对Wav2vec 2.0进行持续预训练，使语音识别适应小学数学课堂音频，适应后的模型对标注微调数据中未见的人群泛化得更好。<sup>[16](https://arxiv.org/abs/2405.13018)</sup>

评估实践很重要：如果持续预训练之后立即进行监督微调，且只评估最终模型，就无法判断是哪个阶段带来了改进，因此应在每个阶段进行下游评估。<sup>[17](https://diogoribeiro7.github.io/machine-learning/domain_adaptive_pretraining_before_sft/)</sup>综述指出，CPT研究仍处于早期阶段，技术多样性有限，长程模拟很少，且没有针对垂直遗忘的标准化基准。<sup>[7](https://openreview.net/pdf?id=10XgR4QORn)</sup>研究兴趣正在快速增长：大语言模型的持续微调在2022–23年四大主要会议的持续学习录用论文中占8.7%，到2024–25年升至22.9%，其中所梳理的文献中有52篇论文涉及语言模型的持续预训练。<sup>[18](https://atlas.scime.ai/research/continual-learning/continual-fine-tuning-of-llms)</sup>

## References

1. [Haizhou Shi et al. (2024). Continual Learning of Large Language Models: A Comprehensive Survey. arXiv:2404.16789.](https://arxiv.org/abs/2404.16789)
2. [Towards Lifelong Learning of Large Language Models: A Survey. ACM Computing Surveys.](https://doi.org/10.1145/3716629)
3. [Continual Learning of Large Language Models: A Comprehensive Survey. ACM Computing Surveys.](https://doi.org/10.1145/3735633)
4. [Suchin Gururangan et al. (2020). Don't Stop Pretraining: Adapt Language Models to Domains and Tasks. ACL 2020.](https://aclanthology.org/2020.acl-main.740/)
5. [Section 6.2: Pretraining Objectives & Paradigms, Foundation Model Engineering.](https://llmbook.icsgen-ai.org/part-2-understanding-llms/module-06-pretraining-scaling-laws/section-6.2.html)
6. [Çağatay Yıldız. Domain adapting LLMs (project page).](https://cagatayyildiz.github.io/projects/domain-adaptation/)
7. [Under review as a conference paper at ICLR 2026 (OpenReview preprint).](https://openreview.net/pdf?id=10XgR4QORn)
8. [Çağatay Yıldız et al. (2024). Investigating Continual Pretraining in Large Language Models: Insights and Implications. arXiv:2402.17400.](https://arxiv.org/abs/2402.17400)
9. [TiC-LM: A Web-Scale Benchmark for Time-Continual LLM Pretraining. ACL 2025.](https://aclanthology.org/2025.acl-long.1551.pdf)
10. [Domain-Specific Language Model Pretraining for Biomedical Natural Language Processing. ACM Transactions on Computing for Healthcare.](https://doi.org/10.1145/3458754)
11. [Temporal Effects on Pre-trained Models for Language Processing Tasks. Transactions of the ACL.](https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00497/112912/Temporal-Effects-on-Pre-trained-Models-for)
12. [Learning Dynamics in Continual Pre-Training for Large Language Models (OpenReview).](https://openreview.net/pdf?id=Vk1rNMl0J1)
13. [Xisen Jin et al. (2022). Lifelong Pretraining: Continually Adapting Language Models to Emerging Corpora. BigScience Workshop.](https://aclanthology.org/2022.bigscience-1.1/)
14. [A Practitioner's Guide to Continual Multimodal Pretraining. NeurIPS 2024 Datasets and Benchmarks Track.](https://proceedings.nips.cc/paper_files/paper/2024/file/f1a6a2cdc7e65dbb4579e78f97cd2665-Paper-Datasets_and_Benchmarks_Track.pdf)
15. [8.5 Continued Pre-training & Domain Adaptation, Foundation Model Engineering.](https://sungeuns.github.io/foundation-model-engineering/chapter-8/continued-pretraining-and-domain-adaptation/)
16. [Continued Pretraining for Domain Adaptation of Wav2vec2.0 in Automatic Speech Recognition for Elementary Math Classroom Settings. arXiv:2405.13018.](https://arxiv.org/abs/2405.13018)
17. [Diogo Ribeiro. Domain-Adaptive Pretraining Comes Before Instruction Tuning.](https://diogoribeiro7.github.io/machine-learning/domain_adaptive_pretraining_before_sft/)
18. [Continual fine-tuning of LLMs research map, scime atlas.](https://atlas.scime.ai/research/continual-learning/continual-fine-tuning-of-llms)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Machine learning and neural computation › Neural networks and deep learning › Deep learning software and hardware › Fine-tuning and transfer of deep models

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/continual-pre-training

English original: https://www.edgepedia.org/continual-pre-training
