影片高階EN6.8 萬 次觀看
Coding LLaMA 2 from scratch in PyTorch - KV Cache, Grouped Query Attention, Rotary PE, RMSNorm
來源 Umar Jamil
看影片(在新分頁開啟原站)連到 YouTube・Umar Jamil
摘要
由 Umar Jamil 示範如何從零開始使用 PyTorch 編碼 LLaMA 2 模型,涵蓋 KV Cache、分組查詢注意力 (GQA)、旋轉位置嵌入 (RoPE) 及 RMSNorm 等核心機制。講者詳細解釋了推論策略(如 Greedy、Beam Search、Top P)的數學原理與程式實作,並提供完整的程式碼與權重下載資源。
A comprehensive tutorial on coding LLaMA 2 from scratch in PyTorch, covering key components like KV Cache, GQA, RoPE, and RMSNorm, along with detailed explanations of inference strategies.
摘要、重點與章節標題由語言模型整理,細節(誰說的、數字、先後)可能有誤;要引用請以原始內容為準。
重點
- 從零開始編碼 LLaMA 2 架構,包含 RoPE、RMSNorm 與 GQA。
- 深入解析 KV Cache 機制如何加速推論過程。
- 實作並比較 Greedy、Beam Search 與 Top P 等推論策略。
章節
依話題轉折切分,標題由 AI 產生
- 00:00Introduction
- 01:20LLaMA Architecture
- 03:14Embeddings
- 05:22Coding the Transformer
- 19:55Rotary Positional Embedding
- 1:03:50RMS Normalization
- 1:11:13Encoder Layer
- 1:16:50Self Attention with KV Cache
- 1:29:12Grouped Query Attention
- 1:34:14Coding the Self Attention
- 2:01:40Feed Forward Layer with SwiGLU
- 2:08:50Model weights loading
- 2:21:26Inference strategies
- 2:25:15Greedy Strategy
- 2:27:28Beam Search
- 2:31:13Temperature
- 2:32:52Random Sampling
- 2:34:27Top K
- 2:37:03Top P
- 2:38:59Coding the Inference
提到的工具與公司
- PyTorch
- LLaMA 2
- Visual Studio Code
適合誰看
適合希望深入理解大型語言模型內部架構與推論機制的程式設計師或機器學習工程師。
摘要依據
- 依據
- 自動字幕
為什麼排在這裡
- 人氣
- 0.36
- 新鮮
- 0.01
在主題頁與搜尋結果裡,名次由相關、人氣、新鮮三個分數決定;這一頁沒有搜尋的關鍵字,所以沒有相關分數。排序怎麼算
相關內容
- LLaMA explained: KV-Cache, Rotary Positional Embedding, RMS Norm, Grouped Query Attention, SwiGLU影片 ・ Umar Jamil ・ 1 小時 11 分 ・
- What I Learned From Implementing LLM Architectures From Scratch (And How to Get Started)影片 ・ Sebastian Raschka ・ 53 分鐘 ・
- Coding a Multimodal (Vision) Language Model from scratch in PyTorch with full explanation影片 ・ Umar Jamil ・ 5 小時 46 分 ・
- Build an LLM from Scratch 3: Coding attention mechanisms影片 ・ Sebastian Raschka ・ 2 小時 16 分 ・
- Understanding Positional Embeddings in Modern LLMs文章 ・ Sebastian Raschka(部落格) ・
- Implementing GPT-2 From Scratch (Transformer Walkthrough Part 2/2)影片 ・ Neel Nanda ・ 1 小時 19 分 ・
這個來源最近的內容
摘要由 AI 根據原文產生,可能有誤;完整內容請看原站。看影片(在新分頁開啟原站)
