跳到主要內容
AI 武林
影片高階EN8.1 萬 次觀看

Build an LLM from Scratch 3: Coding attention mechanisms

來源 Sebastian Raschka人物 Sebastian Raschka

看影片(在新分頁開啟原站)連到 YouTube・Sebastian Raschka

摘要

由 Sebastian Raschka 講解如何從零編碼大型語言模型的核心引擎——注意力機制。內容涵蓋無訓練權重的簡化版自注意力、引入可訓練權重的真實自注意力、因果注意力遮罩以防止偷窺未來詞元,以及多頭注意力的實作與效能比較。

This video demonstrates how to code attention mechanisms from scratch, covering self-attention, causal masking, dropout, and multi-head attention implementations using PyTorch.

摘要、重點與章節標題由語言模型整理,細節(誰說的、數字、先後)可能有誤;要引用請以原始內容為準。

重點

  • 從零實作自注意力機制,包含計算注意力分數與權重。
  • 加入因果遮罩與 Dropout 遮罩以符合現代 LLM 架構需求。
  • 實作並比較多頭注意力與 PyTorch 內建版本的效能差異。

章節

依話題轉折切分,標題由 AI 產生

  1. 00:003.3.1 A simple self-attention mechanism without trainable weights
  2. 41:013.3.2 Computing attention weights for all input tokens
  3. 52:403.4.1 Computing the attention weights step by step
  4. 1:12:333.4.2 Implementing a compact SelfAttention class
  5. 1:21:003.5.1 Applying a causal attention mask
  6. 1:32:333.5.2 Masking additional attention weights with dropout
  7. 1:38:053.5.3 Implementing a compact causal self-attention class
  8. 1:46:553.6.1 Stacking multiple single-head attention layers
  9. 1:58:553.6.2 Implementing multi-head attention with weight splits

提到的工具與公司

適合誰看

適合希望深入理解 Transformer 架構原理並具備程式實作能力的開發者。

摘要依據

講者
Sebastian Raschka
依據
人工字幕

為什麼排在這裡

人氣
0.45
新鮮
0.09

在主題頁與搜尋結果裡,名次由相關、人氣、新鮮三個分數決定;這一頁沒有搜尋的關鍵字,所以沒有相關分數。排序怎麼算

這個來源最近的內容

Sebastian Raschka 的所有內容

摘要由 AI 根據原文產生,可能有誤;完整內容請看原站。看影片(在新分頁開啟原站)