mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-10 20:04:52 +00:00
Update docs/source/conceptual/flash_attention.md
Co-authored-by: Nicolas Patry <patry.nicolas@protonmail.com>
This commit is contained in:
parent
181dcb6219
commit
2035f3b7bc
@ -1,6 +1,6 @@
|
||||
# Flash Attention
|
||||
|
||||
Scaling transformer architecture is heavily bottlenecked by the self-attention mechanism, which has quadratic time and memory complexity. Recent developments in accelerator hardware are mainly focused on enhancing compute capacities and not memory and transferring data between hardware. This results in attention operation having a bottleneck in memory, also called _memory-bound_. Flash Attention is an attention algorithm used to overcome this problem and scale transformer-based models more efficiently, enabling faster training and inference.
|
||||
Scaling transformer architecture is heavily bottlenecked by the self-attention mechanism, which has quadratic time and memory complexity. Recent developments in accelerator hardware are mainly focused on enhancing compute capacities and not memory and transferring data between hardware. This results in attention operation having a bottleneck in memory, also called _memory-bound_. Flash Attention is an attention algorithm used to reduce this problem and scale transformer-based models more efficiently, enabling faster training and inference.
|
||||
In standard attention implementation, the cost of loading and writing keys, queries, and values from High Bandwidth Memory (HBM) is high. It loads key, query, value from HBM to GPU, performs a single step of the attention mechanism and writes it back to HBM, and repeats this for every singular step of the attention. Instead, Flash Attention loads keys, queries, and values once, fuses the operations of the attention mechanism and writes them back.
|
||||
It is implemented for models with custom kernels, you can check out the full list of models that support Flash Attention [here](https://github.com/huggingface/text-generation-inference/tree/main/server/text_generation_server/models).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user