MLX scaled_dot_product_attention
by Apple · Tool · Text & code
A built-in function that computes the attention step of transformers on arrays, running efficiently on Apple silicon and Linux machines.
Cost to run
Alternatives
mlx-m5-kernelsFP16/BF16 GQA FlashDecoding kernel: 1.105x vs mx.fast.scaled_dot_product_attention at 4K (0.324 vs 0.358 ms), 1.005x at 16K (~129 GB/s)