Attention Backend Capsules #
Attention is the first place where the backend-contract distinction matters in practice.
The proof-facing FlashAttention spec and every registered runtime provider use hard-mask semantics: blocked entries have exactly zero softmax numerator. Additive attention biases are a separate operation and are never used to encode a boolean mask.
Composed TorchLean attention path.
TorchLean owns the tape and local VJP. CUDA batched matrix multiplication evaluates the two dense contractions, while TorchLean's hard-masked softmax supplies the attention weights. Unlike the direct reference kernel, this implementation has the expected quadratic dependence on sequence length.
Instances For
Direct native CUDA reference path.
The implementation computes attention without materializing the score matrix, but it is not the IO-tiled FlashAttention algorithm. Its backward kernel recomputes row statistics and is intended for parity checks and small inputs rather than large-model training.
Instances For
LibTorch SDPA forward provider while TorchLean keeps the graph/tape boundary.
Instances For
Built-in attention capsules in default planner order. Optional external providers register their own capsules in their provider modules.