FlashAttention-2 builds upon FlashAttention to achieve faster attention computation with better GPU resource utilization. It enhances parallelism by also parallelizing along the sequence length dimension, optimizing work partitioning between thread blocks and warps to reduce shared memory access. A key improvement is the reduction of non-matmul FLOPs, which are less efficient on modern GPUs optimized for matrix multiplication. These enhancements lead to significant speedups compared to FlashAttention and standard attention, reaching higher throughput and better model FLOPs utilization in end-to-end training for Transformers.