Jump to content

Training of large language models

From Wikipedia, the free encyclopedia

A large language model (LLM) needs to be trained. The training of an LLM has become more complex over time.

Pretraining

[edit]

Pretraining is the training stage where the objective is next-token prediction.

The pretraining stage can be split into several substages, one after another, as in curriculum learning. Each substage focuses on a different kind of learning, with later substages enabled by previous substages. All substages of pretraining would still use next-token prediction objective.

Midtraining

[edit]

Midtraining is a substage in pretraining. Like pretraining, the objective in midtraining is next-token prediction. They mainly differ in the design goals of the dataset that the model is predicting about. The pretraining dataset is designed to be larger and more diverse (such as Common Crawl or the Pile) to make the model generally capable, and the midtraining dataset is designed to be smaller, more specialized, and of higher quality, to efficiently make the model capable in specific areas.

The term "mid-training" was first used by OpenAI in 2024,[1] and came into more widespread use in 2025.[2][3]

Long-context training

[edit]

Long-context training is a training substage within pretraining, designed to increase the effective context length of a model.[4] A language model can have a long context length, but unable to use it effectively, a phenomenon sometimes called "context decay". Consequently, it is the effective context length that is of interest, i.e. the length of the context that a model can use effectively.[5]

A simple method of long-context training is simply to do next-token prediction on extended contexts, possibly extending more than once. Concretely, the model can be pretrained on context lengths up to 8K tokens, then up to 64K, then up to 512K. It was found that given a fixed training budget, training on a mixture of long contexts and short contexts resulted in higher performance than training on only long contexts.[6]

Some architectures were designed specifically to enable efficient long-context training. An early example is ALiBi (Attention with Linear Biases).[7] YaRN (Yet another RoPE extensioN) is a later method that has seen widespread use across many models, including DeepSeek, Qwen, Kimi, and GPT-OSS.[8]

See also

[edit]

References

[edit]
  1. ↑ Wang, Zengzhi; Zhou, Fan; Li, Xuefeng; Liu, Pengfei (2025-06-25). "OctoThinker: Mid-training Incentivizes Reinforcement Learning Scaling". arXiv:2506.20512 [cs.CL].
  2. ↑ "What's the deal with mid-training? | Vintage Data". vintagedata.org. Retrieved 2026-10-19.
  3. ↑ OLMo Team (2025-10-08). "2 OLMo 2 Furious". arXiv:2501.00656 [cs.CL].
  4. ↑ Gao, Tianyu; Wettig, Alexander; Yen, Howard; Chen, Danqi (2025-07). Che, Wanxiang; Nabende, Joyce; Shutova, Ekaterina; Pilehvar, Mohammad Taher (eds.). "How to Train Long-Context Language Models (Effectively)". Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Vienna, Austria: Association for Computational Linguistics: 7376–7399. doi:10.18653/v1/2025.acl-long.366. ISBN 979-8-89176-251-0. {{cite journal}}: Check date values in: |date= (help)CS1 maint: periodical has ISBN (link)
  5. ↑ Hsieh, Cheng-Ping; Sun, Simeng; Kriman, Samuel; Acharya, Shantanu; Rekesh, Dima; Jia, Fei; Zhang, Yang; Ginsburg, Boris (2024-08-06). "RULER: What's the Real Context Size of Your Long-Context Language Models?". arXiv:2404.06654 [cs.CL].
  6. ↑ Gao, Tianyu; Wettig, Alexander; Yen, Howard; Chen, Danqi (2025-07). Che, Wanxiang; Nabende, Joyce; Shutova, Ekaterina; Pilehvar, Mohammad Taher (eds.). "How to Train Long-Context Language Models (Effectively)". Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers). Vienna, Austria: Association for Computational Linguistics: 7376–7399. doi:10.18653/v1/2025.acl-long.366. ISBN 979-8-89176-251-0. {{cite journal}}: Check date values in: |date= (help)CS1 maint: periodical has ISBN (link)
  7. ↑ Press, Ofir; Smith, Noah A.; Lewis, Mike (2022-04-22). "Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation". arXiv:2108.12409 [cs.CL].
  8. ↑ Peng, Bowen; Quesnelle, Jeffrey; Fan, Honglu; Shippole, Enrico (2024-05-31). "YaRN: Efficient Context Window Extension of Large Language Models". International Conference on Learning Representations. 2024: 31932–31951.