Attention variants from papers

From benchflow-ai/skillsbench · View interactive version

Attention variants from papers is an AI agent skill from the GitHub repository benchflow-ai/skillsbench. Implement paper-defined attention variants by extracting mechanism invariants, mapping tensor shapes, preserving module interfaces, validating numerical behavior, and integrating the custom attention into an existing transformer stack.

How to use this skill

Skill file

Attention Variants from Papers

Use this skill when a paper changes how attention scores, branches, normalization, or head sharing work, but the module still needs to behave like a drop-in transformer attention block.

Workflow

  1. Read the paper for invariants, not names.

Use paper-to-implementation.md to extract the external contract, the changed computation, and the training-time constraints.

  1. Build a shape ledger before coding.

Use shape-ledger.md to track projections, head grouping, branch count, and output width.

  1. Choose the mechanism pattern.

Use mechanism-patterns.md for subtractive attention, branch mixing, learned gates, and extra normalization.

  1. Preserve the module boundary.

Keep the same input and output shape, mask semantics, positional encoding flow, and cache behavior unless the task explicitly changes them.

  1. Validate in layers.

Start with random-tensor smoke tests, then compare against a baseline attention path. Use stability-and-validation.md.

  1. Integrate into the stack last.

Swap the new module into one transformer block, verify the residual path, then roll it through the full model. Use transformer-integration.md.

Checklist

Reference Map

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.