1. LLM架构
虽然不需要深入了解Transformer架构的细节,但了解现代LLM的主要步骤非常重要:通过分词将文本转换为数字,通过包含注意力机制的多层处理这些分词,最后通过各种采样策略生成新文本。
-
架构概览:了解从编码器-解码器Transformer到仅解码器架构(如GPT)的演变,这些架构是现代LLM的基础。重点关注这些模型如何在高级别上处理和生成文本。
-
分词:学习分词的原理——文本是如何被转换为LLM可以处理的数值表示的。探索不同的分词策略及其对模型性能和输出质量的影响。
-
注意力机制:掌握注意力机制的核心概念,特别是自注意力及其变体。了解这些机制如何使LLM能够处理长距离依赖关系,并在序列中保持上下文。
-
采样技术:探索各种文本生成方法及其权衡。比较确定性方法(如贪婪搜索和束搜索)与概率方法(如温度采样和核采样)。
推荐:
-
Visual intro to Transformers by 3Blue1Brown: Visual introduction to Transformers for complete beginners.(https://www.youtube.com/watch?v=wjZofJX0v4M)
-
LLM Visualization by Brendan Bycroft: Interactive 3D visualization of LLM internals.(https://bbycroft.net/llm)
-
nanoGPT by Andrej Karpathy: A 2h-long YouTube video to reimplement GPT from scratch (for programmers). He also made a video about tokenization.(https://www.youtube.com/watch?v=kCc8FmEb1nY)
-
Attention? Attention! by Lilian Weng: Historical overview to introduce the need for attention mechanisms.(https://lilianweng.github.io/posts/2018-06-24-attention/)
-
Decoding Strategies in LLMs by Maxime Labonne: Provide code and a visual introduction to the different decoding strategies to generate text.(https://mlabonne.github.io/blog/posts/2023-06-07-Decoding_strategies.html)
2. 预训练模型
预训练是一个计算密集且成本高昂的过程。虽然这不是本课程的重点,但了解模型是如何预训练的非常重要,尤其是在数据和参数方面。预训练也可以由爱好者在小规模上进行,例如使用小于10亿参数的模型。
-
数据准备:预训练需要海量的数据集(例如,Llama 3.1是在15万亿个标记上训练的),这些数据需要精心策划、清理、去重和分词。现代预训练流程会实施复杂的过滤,以去除低质量或有问题的内容。
-
分布式训练:结合不同的并行化策略:数据并行(批量分布)、流水线并行(层分布)和张量并行(操作拆分)。这些策略需要优化网络通信和跨GPU集群的内存管理。
-
训练优化:使用带有预热的自适应学习率、梯度裁剪和归一化以防止爆炸、混合精度训练以提高内存效率,以及使用经过调整的超参数的现代优化器(如AdamW、Lion)。
-
监控:使用仪表盘跟踪关键指标(如损失、梯度、GPU状态),为分布式训练问题实施针对性日志记录,并设置性能分析以识别计算和通信中的瓶颈。
推荐:
-
FineWeb by Penedo et al.: Article to recreate a large-scale dataset for LLM pretraining (15T), including FineWeb-Edu, a high-quality subset.(https://huggingface.co/spaces/HuggingFaceFW/blogpost-fineweb-v1)
-
RedPajama v2 by Weber et al.: Another article and paper about a large-scale pre-training dataset with a lot of interesting quality filters.(https://www.together.ai/blog/redpajama-data-v2)
-
nanotron by Hugging Face: Minimalistic LLM training codebase used to make SmolLM2.(https://github.com/huggingface/nanotron)
-
Parallel training by Chenyan Xiong: Overview of optimization and parallelism techniques.(https://www.andrew.cmu.edu/course/11-667/lectures/W10L2%20Scaling%20Up%20Parallel%20Training.pdf)
-
Distributed training by Duan et al.: A survey about efficient training of LLM on distributed architectures.(https://arxiv.org/abs/2407.20018)
-
OLMo 2 by AI2: Open-sou
大模型专家精通之路及免费资料推荐

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



