Skip to content

[DOC]: XFormer and FlashAttention which is faster? How to choose? #4625

Closed

Description

@butterluo

📚 The doc issue

Colossal AI LLaMA supports xformer and flash-attention both, but I can NOT find any doc about how to make a choice? Which one is faster? Which one has better accuracy?

Activity

  1. kurisusnowdeng commented on Sep 6, 2023

    @kurisusnowdeng
    Contributor

    Hi @butterluo , basically flash attention would be the first choice. However it may fail in some circumstances, where we have to use other versions of memory_efficient_attention from xformers. Fortunately, ColossalAI provides a ColoAttention API that is able to deal with the most cases. You could find its details at https://github.com/hpcaitech/ColossalAI/blob/main/colossalai/kernel/cuda_native/mha/mha.py

  2. JazyJiang commented on Oct 19, 2026

    @JazyJiang
    Collaborator

    Closing as answered, see above. Flash attention is the default choice; through Shardformer it is enabled with enable_flash_attention=True, and ColoAttention picks a suitable kernel for the inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions