Enum Class AttentionBackend

java.lang.Object
java.lang.Enum<AttentionBackend>
smile.llm.attention.AttentionBackend
All Implemented Interfaces:
Serializable, Comparable<AttentionBackend>, Constable

public enum AttentionBackend extends Enum<AttentionBackend>
Pluggable attention kernel backends (SGLang-style names).
  • Enum Constant Details

    • TORCH_NATIVE

      public static final AttentionBackend TORCH_NATIVE
      LibTorch scaled_dot_product_attention (contiguous Q/K/V).
    • FLASHINFER

      public static final AttentionBackend FLASHINFER
      FlashInfer paged BatchPrefill / BatchDecode.
  • Method Details

    • values

      public static AttentionBackend[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AttentionBackend valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • id

      public String id()
      Config / CLI identifier (e.g. torch_native).
      Returns:
      lowercase backend id.
    • parse

      public static AttentionBackend parse(String value)
      Parses a config string (case-insensitive).
      Parameters:
      value - torch_native or flashinfer.
      Returns:
      matching backend.
      Throws:
      IllegalArgumentException - if value is unknown.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<AttentionBackend>