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

Flash Attention derived and coded from first principles with Triton (Python)

來源 Umar Jamil

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

摘要

從零開始,僅用紙筆推導 Flash Attention 的數學原理,並結合 Triton 與 CUDA 從頭實作前後向傳。內容涵蓋多頭注意力機制、Online Softmax 證明、矩陣分塊乘法、Tensor 佈局、自動微分原理,以及 Triton 的自調優與軟體排程技巧,讓讀者深入理解其核心運作。

This video derives Flash Attention from first principles using pen and paper, then implements both forward and backward passes in Python with Triton and CUDA, covering Online Softmax proofs, block matrix multiplication, and GPU optimization techniques.

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

重點

  • 從頭推導 Flash Attention 數學公式並手寫程式碼實作。
  • 詳細解說 Online Softmax 演算法及其數學證明過程。
  • 介紹 Triton 自調優與軟體排程等 GPU 最佳化技術。

章節

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

  1. 00:00Introduction
  2. 03:10Multi-Head Attention
  3. 09:06Why Flash Attention
  4. 12:50Safe Softmax
  5. 27:03Online Softmax
  6. 39:44Online Softmax (Proof)
  7. 47:26Block Matrix Multiplication
  8. 1:28:38Flash Attention forward (by hand)
  9. 1:44:01Flash Attention forward (paper)
  10. 1:50:53Intro to CUDA with examples
  11. 2:26:28Tensor Layouts
  12. 2:40:48Intro to Triton with examples
  13. 2:54:26Flash Attention forward (coding)
  14. 4:22:11LogSumExp trick in Flash Attention 2
  15. 4:32:53Derivatives, gradients, Jacobians
  16. 4:45:54Autograd
  17. 5:00:00Jacobian of the MatMul operation
  18. 5:16:14Jacobian through the Softmax
  19. 5:47:33Flash Attention backwards (paper)
  20. 6:13:11Flash Attention backwards (coding)
  21. 7:21:10Triton Autotuning
  22. 7:23:29Triton tricks: software pipelining
  23. 7:33:38Running the code

提到的工具與公司

適合誰看

適合希望深入理解 Flash Attention 原理、熟悉 PyTorch 並想學習使用 Triton 或 CUDA 進行 GPU 程式設計的開發者。

摘要依據

依據
自動字幕

為什麼排在這裡

人氣
0.46
新鮮
0.06

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

這個來源最近的內容

Umar Jamil 的所有內容

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