Skip to content
All posts

September 20, 2026 · 11 min

A³ Attention: The Softmax Is Not Sacred

Every Transformer since 2017 computes attention the same way: scale the scores, apply softmax, done. The softmax is treated as a fixed, untouchable part of the architecture — but nobody ever proved it has to be. Attention Is All You Need picked it, the field copied it, and eleven years of architectural research rearranged everything around it while leaving the activation itself frozen.

A³ (Adaptive Activation Attention) is my attempt to answer a question that felt almost too obvious to ask: should the distribution over tokens be shaped the same way for every head, in every layer, on every input? The answer I argue for is no — and the mechanism to fix it is smaller than you'd expect.

The mechanism

A³ replaces the fixed softmax with a learnable function fθ(S,c) = softmax(S ⊙ G + B). The gate G = σ(Wg·c) scales each score, and the bias B = Ucᵀ shifts it — both conditioned on a context vector c built from the mean query, mean key, and the current layer/head embedding.

The intuition is a temperature that the model controls per-head, per-token. Some inputs are ambiguous and deserve a diffuse distribution that hedges across many tokens; others have one clearly relevant token and deserve a sharp peak. A fixed softmax makes every head commit to one sharpening behavior. A³ lets the model decide at runtime, from the content of the sequence itself.

Two properties that make it safe

Dropping a learnable function into the middle of a Transformer is scary, so the design starts from two guarantees. Proposition 1: the output is always a valid probability distribution, no matter what the gate and bias learn — the outer softmax absorbs any real-valued distortion, so attention can never produce garbage.

Proposition 2 is the one I care about most: with bg = 3·1, Wg = 0 and U = 0, A³ exactly recovers standard softmax at initialization. The identity of σ(3) ≈ 0.95 means gated scores stay close to their originals at init. Training starts from a known-good point and only adapts when adapting helps. You are never worse than the baseline because of initialization luck.

What the gate actually learns

The empirical question is whether the model uses this freedom. It does. Heads near the first layers tend to learn softer, more diffuse distributions — they act as broad context collectors. Deeper heads sharpen selectively on the tokens they attend to. That division of labor is exactly what a fixed activation makes impossible: every head was forced into the same compromise.

What I'd want a reader to take away

The point of A³ is not that softmax is wrong. It's that the softmax was one point in a design space we stopped exploring. Activation functions are parameters of the architecture like anything else, and making them adaptive is a two-matrix change that composes with every existing attention variant — FlashAttention, MQA, GQA all still work, because the modification sits entirely on the score matrix before the final normalization.

The honest limitations

The gate and bias add a small parameter and compute overhead per head, and the benefits shrink as models scale up — big models already learn rich internal modulation, so the headroom is largest in small and mid-sized models. The paper, the code, and the Kaggle notebook are all linked on the Research page; the notebook reproduces every figure from a single run.

thanks for reading — more soon ✦

keep reading

M

drawing ideas into systems...