从头开始构建法学硕士:3 小时的编码研讨会
Building LLMs from the Ground Up: A 3-Hour Coding Workshop

原始链接: https://magazine.sebastianraschka.com/p/building-llms-from-the-ground-up

这是一个时长 3 小时的视频教程,介绍了理解大语言模型 (LLM) 的实践方法。 该视频涵盖了这些模型的实施、训练和使用,首先介绍了它们的基础知识。 它提供了分步指南,包括创建自定义分词器类、基于 GPT-2 和 Llama 等现有模型设置模型架构、加载预训练权重、执行指令微调、基准评估和测试会话性能。 该视频使用Python编程语言,所有必要的材料都可以在其随附的GitHub存储库和Lightning Studio资源中找到。 此外,研讨会还利用了 LitGPT 库,该库有一个单独的 GitHub 存储库。 本教程允许观看者从头开始构建自己的法学硕士。

作者认为,在讨论机器学习模型时,由于视角不同,自动微分、大规模并行计算等具体技术细节往往被忽视。 从数学家的角度来看,这些计算元素会分散注意力。 相反,重点应该放在根据基本数学原理构建模型,结合自然语言处理的见解,检查表示输入数据和评估损失的方法,解决有关数据处理的问题,并在更广泛的背景下考虑机器学习。 作者认为,除非您打算深入研究硬件或核心库的创建,否则没有必要深入研究复杂的编程问题,例如手动管理内存。 相反,作者建议在更早的阶段开始教育过程,重点关注编程基础、文本操作、生成基本统计数据、改进马尔可夫链,以及探索创建人工智能系统的各种架构。 虽然马尔可夫链可能与大型语言模型 (LLM) 不同,但它们为理解算法如何分析和生成文本提供了宝贵的基础。 立即从现有框架开始会忽略重要的基础知识。 此外,虽然术语“软件开发人员”、“编码员”和“工程师”可能会引起不同的含义,但作者认为,应该对专业工程师和开发人员抱有更实质性的期望,特别是在提到为商业应用程序设计的解决方案时。 最后,作者发现对包括法学硕士在内的人工智能系统使用“变压器”一词没有任何问题,因为这些技术采用原始输入并通过计算对其进行处理,从而产生与初始输入不同的输出,类似于转换。
相关文章

原文

If you’d like to spend a few hours this weekend to dive into Large Language Models (LLMs) and understand how they work, I've prepared a 3-hour coding workshop presentation on implementing, training, and using LLMs.

Below, you'll find a table of contents to get an idea of what this video covers (the video itself has clickable chapter marks, allowing you to jump directly to topics of interest):

0:00 – Workshop overview

2:17 – Part 1: Intro to LLMs

9:14 – Workshop materials

10:48 – Part 2: Understanding LLM input data

23:25 – A simple tokenizer class

41:03 – Part 3: Coding an LLM architecture

45:01 – GPT-2 and Llama 2

1:07:11 – Part 4: Pretraining

1:29:37 – Part 5.1: Loading pretrained weights

1:45:12 – Part 5.2: Pretrained weights via LitGPT

1:53:09 – Part 6.1: Instruction finetuning

2:08:21 – Part 6.2: Instruction finetuning via LitGPT

02:26:45 – Part 6.3: Benchmark evaluation

02:36:55 – Part 6.4: Evaluating conversational performance

02:42:40 – Conclusion

It's a slight departure from my usual text-based content, but the last time I did this a few months ago, it was so well-received that I thought it might be nice to do another one!

Happy viewing!

  1. Build an LLM from Scratch book

  2. Build an LLM from Scratch GitHub repository

  3. GitHub repository with workshop code

  4. Lightning Studio for this workshop

  5. LitGPT GitHub repository

联系我们 contact @ memedata.com