LLM 学习资源精选导览
开发者整理的 LLM 理论与实践资源合集,适合入门和深化理解。
开发者整理的 LLM 理论与实践资源合集,适合入门和深化理解。
尽快建立关于 LLM 的基础知识体系,重点偏向 GPT。
避免堆砌链接,尽量只提供有价值、精心筛选过的信息。
在开始学习 Transformer 之前,先看一些神经网络相关链接。
https://www.youtube.com/watch?v=aircAruvnKk&list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi
https://www.3blue1brown.com/topics/neural-networks
http://neuralnetworksanddeeplearning.com/
🟢 = 简单,🟠 = 中等,🔴 = 困难
🕰️ = 内容较长,🙉 = 音质较差
🟢🕰️ Łukasz Kaiser《Attention is all you need; Attentional Neural Network Models》:这场演讲来自 6 年前。
🟢🕰️ Andrej Karpathy《The spelled-out intro to language modeling: building makemore》:基础内容。先通过计数构建 bi-gram 人名生成模型,再使用神经网络实现。使用 PyTorch。
🟢🕰️ Andrej Karpathy《Building makemore Part 2: MLP》:
🕰️ Andrej Karpathy《Building makemore Part 3: Activations & Gradients, BatchNorm》:
🕰️ Andrej Karpathy《Building makemore Part 4: Becoming a Backprop Ninja》:
🟢 Andrej Karpathy《State of GPT》
🟢 Hedu AI《Visual Guide to Transformer Neural Networks - (Episode 1) Position Embeddings》:Token 被嵌入到语义空间中。对 sine/cosine 位置编码的解释非常出色。
🟢 Hedu AI《Visual Guide to Transformer Neural Networks - (Episode 2) Multi-Head & Self-Attention》:清晰概述了 multi-head attention。
🟢 Hedu AI《Visual Guide to Transformer Neural Networks - (Episode 3) Decoder’s Masked Attention》:进一步讲解 Transformer 架构的细节。
🟠🕰️ Andrej Karpathy《Andrej Karpathy - Let's build GPT: from scratch, in code, spelled out.》:从零开始构建一个类似 GPT-2、用于生成莎士比亚文本的模型。先从 bi-gram 开始,然后逐项添加功能。使用 PyTorch。
🔴🕰️ Chris Olah《CS25 I Stanford Seminar - Transformer Circuits, Induction Heads, In-Context Learning》:关于模型解释的内容,深入研究 induction head 的运作机制。另有配套文章。
🟢 Jay Alammar《The Illustrated Word2vec - A Gentle Intro to Word Embeddings in Machine Learning》
🟢 Jay Alammar《How GPT3 Works - Easily Explained with Animations》:非常高层、基础的概述。
🟢🕰️ Jay Alammar《The Narrated Transformer Language Model》:更深入地研究架构,包含详细讲解。另有配套文章。
🔥 Sebastian Raschka《L19: Self-attention and transformer networks》:学术课程风格的 self-attention Transformer 系列讲座。
🟢🕰️🙉 Mark Chen《Transformers in Language: The development of GPT Models including GPT3》:这场讲座有一部分内容是关于如何将 GPT 应用于图像。它与 Chris Olah 的讲座属于同一个系列。另有该系列的其余内容。演讲中列出的论文包括:"GPT-1":Liu et al.《Generating Wikipedia by Summarizing Long Sequences》;"GPT-2":Radford et al.《Language Models are Unsupervised Multitask Learners》、github.com/openai/gpt-2、OpenAI《Better Language Models》、Fermats Library;"GPT-3":Brown et al.《Language Models are Few-Shot Learners》(我认为是这篇,但在论文中找不到演讲引用的文字)。
"GPT-1":Liu et al.《Generating Wikipedia by Summarizing Long Sequences》
"GPT-2":Radford et al.《Language Models are Unsupervised Multitask Learners》、github.com/openai/gpt-2、OpenAI《Better Language Models》、Fermats Library
"GPT-3":Brown et al.《Language Models are Few-Shot Learners》(我认为是这篇,但在论文中找不到演讲引用的文字)
🟠🕰️ Future Mojo《NLP Demystified 15: Transformers From Scratch + Pre-training and Transfer Learning With BERT/GPT》:对 Transformer 每一个细节都做了极其清晰的解释。节奏把握得很好,很容易跟上。包含 TensorFlow 代码。这是整套 NLP 课程的集大成之作,而整套课程都非常优秀。
🟢 Viktor Garske《Transformer Models Timeline and List》:模型家谱。
🟢 Jakob Uszkoreit《Transformer: A Novel Neural Network Architecture for Language Understanding》:Google 通过一篇简单易懂的博客文章介绍 Transformer 模型,场景是机器翻译。
🟠 Jay Mody《GPT in 60 Lines of NumPy》
🟠 PyTorch《Language Modeling with nn.Transformer and TorchText》
🟠 Sasha Rush et al.《The Annotated Transformer》
🟢 Jay Alammar《The Illustrated Transformer》:上面视频的配套文章。🟠 Jay Alammar《The Illustrated GPT-2 (Visualizing Transformer Language Models)》🟢 Jay Alammar《How GPT3 Works - Visualizations and Animations》
🟠 Jay Alammar《The Illustrated GPT-2 (Visualizing Transformer Language Models)》
🟢 Jay Alammar《How GPT3 Works - Visualizations and Animations》
🔥 Chris Olah et al.《In-context Learning and Induction Heads》:上面视频讲座的配套文章。
🟢 Finbarr Timbers《Five years of GPT progress》
🟠 Sebastian Raschka《Understanding and Coding the Self-Attention Mechanism of Large Language Models From Scratch》
🟢 Jason Wei《137 emergent abilities of large language models》:其中包含一份很不错的高级 prompting 策略清单。
🟢 Jay Alammar 和 Cohere《LLM University》
Jean Nyandwi《The Transformer Blueprint: A Holistic Guide to the Transformer Neural Network Architecture》
🔥 Eugene Yan《Patterns for Building LLM-based Systems & Products》:一篇非常深入的文章,介绍了实用的工程概念,对于构建将 LLM 作为组件的软件非常有帮助。
🟠 Finbarr Timbers《Five years of GPT progress》:从 GPT 开始,对 LLM 发展历程做了出色的技术概述。
Sebastian Raschka《Understanding Large Language Models -- A Transformative Reading List》:这篇文章列出了该领域一些最重要的论文,是一份非常优秀的论文时间线。
OpenAI Research Index
1️⃣(GPT-1)Radford et al.《Improving Language Understanding by Generative Pre-Training》(2018)。OpenAI 博客上有一篇与这篇论文配套的文章《Improving language understanding with unsupervised learning》。源代码由 thomwolf 整理,位于:huggingface.co/.../openai-gpt
2️⃣(GPT-2)Radford et al.《Language Models are Unsupervised Multitask Learners》(2019)。配套的 OpenAI 博客文章为《Improving language understanding with unsupervised learning》。源代码位于:github.com/openai/gpt-2
3️⃣(GPT-3)Brown et al.《Language Models are Few-Shot Learners》
Kaplan et al.《Scaling Laws for Neural Language Models》:使用不同的计算量、数据集规模和参数数量训练了多种模型。这让我们能够预测哪些参数设置会在未来更大的模型中取得良好效果。另见 Gwern Branwen《The Scaling Hypothesis》。
Mary Phuong et al.《Formal Algorithms for Transformers》:这篇论文为多个版本的 Transformer 提供了伪代码(不知为何,其中一些数组索引从 1 开始)。是一份非常实用的参考资料。
Isaac Asimov《The Last Question》(1956)
Justin Weinberg,Daily Nous《Philosophers On GPT-3》
Fernando Borretti《And Yet It Understands》
Ted Chiang《ChatGPT Is a Blurry JPEG of the Web》
Noam Chomsky《The False Promise of ChatGPT》
Janus《Simulators》:这是一篇很长的文章,但你可以从中得到的核心观点是,LLM 的行为类似模拟器,可以创建许多不同的 persona 来生成文本。另有相关且更易阅读和理解的《Janus' Simulators》。
Julian Togelius《Is Elden Ring an existential risk to humanity?》:一篇讽刺文章,由此引出了对“智能”这一概念的批判。
Josh Whiton《From AI to A-Psy》:讨论 Bing Sydney 对 prompt injection 的反应。
Chip Huyen《Building LLM applications for production》:如何在实际使用 LLM 时获得良好结果。
https://github.com/sw-yx/ai-notes/tree/main —— 包含大量文章和播客。
https://github.com/giuven95/chatgpt-failures —— 一份很长的案例清单,展示了 ChatGPT 现在或过去答错的内容。
https://github.com/PrefectHQ/marvin —— 只需在注释中描述 Python 函数,就能实现整个函数。
https://github.com/pgosar/ChatGDB —— 使用自然语言输入 GDB 调试器命令。
https://github.com/TheR1D/shell_gpt —— 可以输入 "list files" 之类的内容,而不必输入 "ls"。
https://github.com/RomanHotsiy/commitgpt —— 创建 Git commit message。
https://github.com/densmirnov/git2gpt/commits/main —— 根据代码仓库和 prompt 创建 Git commit,随着时间推移持续修改代码库。
https://www.chatpdf.com/ —— 上传 PDF 并围绕其内容展开讨论。
https://www.debate-devil.com/en —— 魔鬼代言人辩论游戏。
https://micahflee.com/2023/04/capturing-the-flag-with-gpt-4/ —— 在 CTF 中作弊。
https://www.thisworddoesnotexist.com/ —— 创造不存在的单词。
https://ggpt.43z.one/ —— prompt injection 高尔夫游戏。
https://gandalf.lakera.ai/ —— 另一个 prompt injection 游戏。
https://github.com/AdmTal/chat-gpt-games —— 本身就是游戏的对话!
ConLang 与古代文字相关内容
Dylan Black《I Taught ChatGPT to Invent a Language》:Gloop splog slopa slurpi
Ryszard Szopa《Teaching ChatGPT to Speak my Son’s Invented Language》:hingadaa’ng’khuu’ngkilja’khłattama’khattama
https://www.reddit.com/r/LocalLLaMA/comments/13j3747/tutorial_a_simple_way_to_get_rid_of_as_an_ai/
https://matt-rickard.com/rellm + https://matt-rickard.com/context-free-grammar-parsing-with-llms
https://github.com/microsoft/guidance
《Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection》https://arxiv.org/abs/2302.12173
如果你想知道哪些模型最好,尤其是在比较本地模型时,可以参考:
https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard
https://leaderboard.lmsys.org/
这个页面尚未完成,我会继续补充内容。