FlashAttention - Tri Dao | Stanford MLSys #67

  Рет қаралды 28,590

Stanford MLSys Seminars

Stanford MLSys Seminars

Күн бұрын

Episode 67 of the Stanford MLSys Seminar “Foundation Models Limited Series”!
Speaker: Tri Dao
Abstract:
Transformers are slow and memory-hungry on long sequences, since the time and memory complexity of self-attention are quadratic in sequence length. Approximate attention methods have attempted to address this problem by trading off model quality to reduce the compute complexity, but often do not achieve wall-clock speedup. We argue that a missing principle is making attention algorithms IO-aware -- accounting for reads and writes between levels of GPU memory. We propose FlashAttention, an IO-aware exact attention algorithm that uses tiling to reduce the number of memory reads/writes between GPU high bandwidth memory (HBM) and GPU on-chip SRAM. We analyze the IO complexity of FlashAttention, showing that it requires fewer HBM accesses than standard attention, and is optimal for a range of SRAM sizes. We also extend FlashAttention to block-sparse attention, yielding an approximate attention algorithm that is faster than any existing approximate attention method. FlashAttention trains Transformers faster than existing baselines: 15% end-to-end wall-clock speedup on BERT-large (seq. length 512) compared to the MLPerf 1.1 training speed record, 3× speedup on GPT-2 (seq. length 1K), and 2.4× speedup on long-range arena (seq. length 1K-4K). FlashAttention and block-sparse FlashAttention enable longer context in Transformers, yielding higher quality models (0.7 better perplexity on GPT-2 and 6.4 points of lift on long-document classification) and entirely new capabilities: the first Transformers to achieve better-than-chance performance on the Path-X challenge (seq. length 16K, 61.4% accuracy) and Path-256 (seq. length 64K, 63.1% accuracy).
This work received the Best Paper Award at the Hardware-Aware Efficient Training Workshop at ICML, 2022. FlashAttention is now widely used in some of the largest research labs and companies, in just 6 months after its release.
Paper: arxiv.org/abs/...
Github: github.com/Haz...
Bio:
Tri Dao is a PhD student in Computer Science at Stanford, co-advised by Christopher Ré and Stefano Ermon. He works at the interface of machine learning and systems, and his research interests include sequence models with long-range memory and structured matrices for compact deep learning models. His work has received the ICML 2022 Outstanding paper runner-up award.
Check out our website for the schedule: mlsys.stanford.edu
Join our mailing list to get weekly updates: groups.google....

Пікірлер: 14
@anishbhanushali
@anishbhanushali Жыл бұрын
22:08 (basics of attention + memory hierarchy in GPU till here ) actual explainations starts
@denizlarson8862
@denizlarson8862 10 ай бұрын
good research and nicely explained
@rfernand2
@rfernand2 Жыл бұрын
Great work and presentation. Where else could this be applied?
@shuminghu
@shuminghu Жыл бұрын
Why does tiling reduce HBM to SRAM transfer? Or is it through pipelining that transfer time overlap more with compute?
@xianbiaoqi7009
@xianbiaoqi7009 Жыл бұрын
Good idea and nice talk.
@aamirmirza2806
@aamirmirza2806 Жыл бұрын
Really nice well explained.
@sskhdsk
@sskhdsk Жыл бұрын
simple and effective
@JazevoAudiosurf
@JazevoAudiosurf Жыл бұрын
well explained
@deepanshusingh2527
@deepanshusingh2527 Жыл бұрын
This is utilised in inference as well? How fast compared to naive implementation?
@TheAIEpiphany
@TheAIEpiphany Жыл бұрын
btw at 28:10 the animation got the order wrong compared to the paper's Algorithm 1, the inner loop should be going over queries not over values
@for-ever-22
@for-ever-22 6 ай бұрын
These videos are amazing
@kawingchan
@kawingchan Жыл бұрын
I am not familiar at all with CPU or GPU architecture, so i naturally wonder how much of this also applies to Apple GPU (MPS). It was mentioned this is already in pytorch, but i do doubt if it even get activated on MPS. I would love to know, maybe at high level, how it may (if possible) be ported to Apple GPU, which has this unified memory thing.
@brandomiranda6703
@brandomiranda6703 Жыл бұрын
ML for theorem proving would also benefit with longer sequences! Reference Lemma proved in 300 BC...
@brandomiranda6703
@brandomiranda6703 Жыл бұрын
11:09
Distributed and Decentralized Learning  - Ce Zhang | Stanford MLSys #68
48:13
Stanford MLSys Seminars
Рет қаралды 6 М.
How Strong is Tin Foil? 💪
00:26
Preston
Рет қаралды 122 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 244 МЛН
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 1 МЛН
Поветкин заставил себя уважать!
01:00
МИНУС БАЛЛ
Рет қаралды 6 МЛН
Monarch Mixer: Making Foundation Models More Efficient - Dan Fu | Stanford MLSys #86
56:32
The KV Cache: Memory Usage in Transformers
8:33
Efficient NLP
Рет қаралды 38 М.
State Space Models (S4, S5, S6/Mamba) Explained
38:11
Anastasia Borovykh
Рет қаралды 3,1 М.
Flash Attention 2.0 with Tri Dao (author)! | Discord server talks
1:00:25
Aleksa Gordić - The AI Epiphany
Рет қаралды 18 М.
Fast LLM Serving with vLLM and PagedAttention
32:07
Anyscale
Рет қаралды 23 М.
Hardware-aware Algorithms for Sequence Modeling - Tri Dao | Stanford MLSys #87
1:19:06
The math behind Attention: Keys, Queries, and Values matrices
36:16
Serrano.Academy
Рет қаралды 245 М.
Training LLMs at Scale - Deepak Narayanan | Stanford MLSys #83
55:59
Stanford MLSys Seminars
Рет қаралды 8 М.
Is this Samsung's change over time #shorts
0:13
Si pamerR
Рет қаралды 754 М.
Apple Event - September 9
1:38:50
Apple
Рет қаралды 26 МЛН