Sam Babichenko

Reading notes / Attention and concepts

Position in attention

Shaw et al., 2018; Press et al., 2021; Su et al., 2021

Scores and positions
i,i, jjquery position and key position, j≤ij\le i
δ\deltadistance i−ji-j from the query back to the key, in tokens
hih_iresidual stream entering the layer at position ii
WQ,W_Q, WKW_Ka head's query and key maps
qi,q_i, kjk_jquery WQhiW_Qh_i and key WKhjW_Kh_j
dheadd_{\rm head}head dimension, 128 in Inkling 2 Mini
zijz_{ij}score of key jj from query ii, the input to the softmax
αij\alpha_{ij}attention weight, αij∝ezij\alpha_{ij}\propto e^{z_{ij}}
b(δ)b(\delta)position term added to the score at distance δ\delta, in logits
vj,v_j, oio_ivalue at jj and the head's output at ii
Position schemes
xi,x_i, PiP_itoken embedding and absolute position vector at ii
WQKW_{QK}WQ⊤WKW_Q^\top W_K, the head's bilinear form
ρδ,\rho_\delta, δmax⁡\delta_{\max}Shaw et al.'s learned key offset for distance δ\delta, and the clip distance
βbkt(δ)\beta_{\mathrm{bkt}(\delta)}T5's learned scalar for the bucket of δ\delta, one per head
m,m, HHan ALiBi head's slope, and the number of heads
R(⋅)R(\cdot)rotation of the plane by the given angle
θr\theta_rRoPE frequency of coordinate pair rr, 10000−2(r−1)/dhead10000^{-2(r-1)/d_{\rm head}}
qi(r),q_i^{(r)}, kj(r)k_j^{(r)}pair rr of the query and the key
φr\varphi_rangle from qi(r)q_i^{(r)} to kj(r)k_j^{(r)}
δ∗\delta^*a distance at which all of RoPE's cosines can peak together
F,F, ψ,\psi, γ,\gamma, n0n_0FIRE's MLP, log transform ψ(x)=log⁡(γx+1)\psi(x)=\log(\gamma x+1), its scale and threshold
ωu\omega_uCanon layer weight vector for the predecessor at offset uu
Inkling's bias
Wr,W_r, ccone head's 16×d16\times d projection and its 16 learned scales
clip⁡8\operatorname{clip}_8y↦ymin⁡(1,8/∥y∥)y\mapsto y\min(1,8/\|y\|)
y,y, ssthe query's 16 weights in one head, before and after the cap
pδp_\deltathe 16 shared profiles at distance δ\delta
zsinkz_{\rm sink}sink logit, an extra score with a zero value
αsink\alpha_{\rm sink}share of attention on the sink
Readout
wwa query token; bwb_w is its bias in one head of layer 0
πw(δ)\pi_w(\delta)bias-only attention, the softmax of bwb_w over 0≤δ<10240\le\delta\lt 1024
δ1/2\delta_{1/2}median distance of πw\pi_w
κ\kappaa constant added to the whole bias
Paper symbols
m,m, nnSu et al. write mm and nn for the positions ii and jj
aijKa^K_{ij}Shaw et al. write aijKa^K_{ij} for ρmin⁡(δ,δmax⁡)\rho_{\min(\delta,\delta_{\max})}
c,c, LLLi et al. write cc for γ\gamma and LL for n0n_0
ttAllen-Zhu writes tt for the position jj

Context. An attention head scores each earlier key by its content, and nothing in that score says where the key sits. Language models supply position explicitly. That choice sets which order patterns a head can express with few parameters, and how the model behaves past its training length. an open-weights looped mixture-of-experts language model released by Thinking Machines Lab in 2026. Reading note: Inkling 2 Mini lets each query token pick its own position term. In layer 0 that term depends on the token alone, so the released weights give it for the whole vocabulary.

Position bias as a prior over distance. Most schemes add a position bias the position term added to the score of a key at distance δ\delta, in logits to the content score, where the distance in tokens from the query position ii back to the key position jj; δ=0\delta=0 is the query's own token is the distance back to the key. The softmax input is zij=qi⊤kj/dhead+b(i−j)z_{ij}=q_i^\top k_j/\sqrt{d_{\rm head}}+b(i-j) for query a head's query vector at the query position ii, qi=WQhiq_i=W_Qh_i, with hih_i the residual stream entering the layer at ii and WQW_Q the head's query map and key the head's key vector at a key position j≤ij\le i, kj=WKhjk_j=W_Kh_j, with WKW_K the head's key map of width the head dimension, the width of qiq_i and kjk_j. Exponentiating turns the sum into a product, so the the share of query ii's attention on key jj, αij∝ezij\alpha_{ij}\propto e^{z_{ij}}; the weights over j≤ij\le i sum to 1 is a distance prior reweighted by content:αij∝eb(i−j) eqi⊤kj/dhead.\alpha_{ij}\propto e^{b(i-j)}\,e^{q_i^\top k_j/\sqrt{d_{\rm head}}}.attention with linear biases: no position parameters; each head subtracts a fixed slope times the distance from every score (Press et al., 2021) fixes bb to a line, the text-to-text transformer of Raffel et al., 2020, whose position term is one learned scalar per head for each of 32 distance buckets, shared by all layers learns a bucket table per head, and Inkling lets each query choose a profile. rotary position embedding: each pair of query and key coordinates is rotated by an angle proportional to the token's position (Su et al., 2021) adds no separate term and instead makes the content score depend on distance.

When bb is known, its softmax gives the head's distance prior. That prior is the attention each distance gets when every key has the same content score. In Inkling's layer 0, six heads look one or two tokens back for nearly every token, five look hundreds of tokens back, and five change reach with the query token. On text, the bias raises layer-0 attention within 8 tokens from 1% to 28%.

Without position, attention sees a set; the causal mask leaks order. Drop both the position signal and the mask, and a head outputs the head's output at position ii, the attention-weighted average of the value vectors vjv_j the head computes at each position, the weighted sum oi=∑jαijvjo_i=\sum_j\alpha_{ij}v_j over value vectors vjv_j with αij∝eqi⊤kj/dhead\alpha_{ij}\propto e^{q_i^\top k_j/\sqrt{d_{\rm head}}}. That sum treats the keys and values as an unordered set. Permuting the input tokens permutes the outputs the same way, and tokenwise MLPs keep that symmetry, so "dog" gets the same representation in "dog bites man" and "man bites dog". A causal mask breaks the symmetry because position ii averages exactly ii values. Set the query map WQ=0W_Q=0 so all scores tie, and give a fixed start token a value with first coordinate 1 while every other token has 0 there. Thenoi=1i∑j≤ivj,(oi)1=1i.o_i=\frac1i\sum_{j\le i}v_j,\qquad (o_i)_1=\frac1i.The output encodes ii, and a later MLP can read it off.

Language models exploit this leak in practice. Haviv et al. (2022) trained 1.3B-parameter decoders without position signals to 13.10 perplexity on the Pile, against 13.05 with learned absolute embeddings. By the middle layers, probes read absolute position from those hidden states about as well as from the learned-embedding model. Masked language models have no causal mask and failed to train without position, stuck at perplexity 147 against about 4. Kazemnejad et al. (2023) proved that a first layer using the 1/i1/i construction recovers absolute position, and that later layers can build relative attention on top of it. In their reasoning and arithmetic tests on about 107M-parameter decoders, no positional encoding: a decoder with no explicit position signal, which gets order only from the causal mask; the term is Kazemnejad et al., 2023's, and Haviv et al., 2022 write NoPos extrapolated better than fixed position vectors added to the token embeddings, Pi,2r−1=sin⁡(i/100002(r−1)/d)P_{i,2r-1}=\sin(i/10000^{2(r-1)/d}) and Pi,2r=cos⁡(i/100002(r−1)/d)P_{i,2r}=\cos(i/10000^{2(r-1)/d}) for model width dd, chosen because Pi+δP_{i+\delta} is a linear function of PiP_i for each fixed δ\delta (Vaswani et al., 2017), ALiBi, and RoPE. Its attention patterns were closest to T5's relative bias.

Absolute embeddings make the score depend on both positions. The original transformer adds a position vector PiP_i to each token embedding xix_i before layer 0. That vector is either learned per position or fixed to the sinusoids of Vaswani et al. (2017). Writing the head's bilinear form, so that qi⊤kj=hi⊤WQKhjq_i^\top k_j=h_i^\top W_{QK}h_j, the layer-0 score splits into four terms:(xi+Pi)⊤WQK(xj+Pj)=xi⊤WQKxj+xi⊤WQKPj+Pi⊤WQKxj+Pi⊤WQKPj.\begin{aligned}&(x_i+P_i)^\top W_{QK}(x_j+P_j)\\&=x_i^\top W_{QK}x_j+x_i^\top W_{QK}P_j\\&\quad+P_i^\top W_{QK}x_j+P_i^\top W_{QK}P_j.\end{aligned}Only the first term is pure content. The middle two let tokens favor specific absolute indices. The last depends on ii and jj separately, so a previous-token head must make Pi⊤WQKPi−1P_i^\top W_{QK}P_{i-1} large at every ii. Learned embeddings stop at the training length. Sinusoids remain defined past it, yet Press et al. (2021) found that sinusoidal language models failed to extrapolate more than a few dozen tokens beyond training length.

Relative terms tie the score to distance alone. When the position term depends only on δ=i−j\delta=i-j, absolute indices drop out of the score. Shaw et al. (2018) introduce a learned vector added to the key for each clipped distance, so that the score of key jj from query ii depends on the positions only through i−ji-j (Shaw et al., 2018), adding a learned vector ρδ\rho_\delta to each key up to a clip distance δmax⁡\delta_{\max}:zij=qi⊤(kj+ρmin⁡(δ,δmax⁡))dhead.z_{ij}=\frac{q_i^\top\big(k_j+\rho_{\min(\delta,\delta_{\max})}\big)}{\sqrt{d_{\rm head}}}.Distances past δmax⁡\delta_{\max} (16 in their base model) share one vector, and the cross-term qi⊤ρδ/dheadq_i^\top\rho_\delta/\sqrt{d_{\rm head}} gives each query its own distance profile. T5 (Raffel et al., 2020) drops that query dependence and stores one learned scalar per head in 32 distance buckets, b(δ)=βbkt(δ)b(\delta)=\beta_{\mathrm{bkt}(\delta)}. In its decoder, buckets cover single distances up to 15 and then widen logarithmically, with every distance from 113 on sharing the last bucket. Each head gets one fixed distance profile, and a single layer cannot separate distances past 113. Because unseen distances land in that last bucket, the bias stays defined on longer inputs. Press et al. found T5-bias models still improving 600 to 800 tokens past training length, though at twice the training time of sinusoidal models or more.

ALiBi fixes each head's profile to a line. ALiBi (Press et al., 2021) keeps T5's length stability without learned tables or extra runtime cost by subtracting a linear penalty mδm\delta. Each head gets a fixed slope mm before training, forming a geometric sequence across HH heads:b(δ)=−m δ,m∈{2−8/H,2−16/H,…,2−8}.\begin{aligned}b(\delta)&=-m\,\delta,\\ m&\in\{2^{-8/H},2^{-16/H},\dots,2^{-8}\}.\end{aligned}Each head's distance prior is geometric, e−mδe^{-m\delta}, with mean distance about 1/m1/m. That reach runs from one or two tokens in the steepest head to about 256 in the flattest. Tested on 2,048 tokens, a 1.3B-parameter ALiBi model trained on 1,024 tokens matched the perplexity of a sinusoidal model trained on 2,048 while training 11% faster. Past training length, ALiBi's perplexity stays stable while the sinusoidal model's explodes. Under standard nonoverlapping evaluation, ALiBi's perplexity even improves on longer windows. Press et al. trace that gain to the the higher perplexity of predictions made early in each evaluation window, which see little context. Longer windows contain a smaller share of early low-context predictions. Under sliding-window evaluation, where every prediction already has long context, ALiBi's perplexity stays flat as inputs grow, so it may not use history past its training length.

RoPE turns the content score itself into a function of distance. RoPE (Su et al., 2021) builds position directly into the dot product with no additive bias. It splits each query and key into dhead/2d_{\rm head}/2 coordinate pairs qi(r)q_i^{(r)} and kj(r)k_j^{(r)}. Pair rr rotates by iθri\theta_r at the query and jθrj\theta_r at the key, with frequencies θr=10000−2(r−1)/dhead\theta_r=10000^{-2(r-1)/d_{\rm head}}, the rotation frequency of pair rr, from 1 radian per token down to about 10−410^{-4} running from fast to slow. Writing R(⋅)R(\cdot) for plane rotation, transposing negates the angle and rotations add, so pair rr contributes(R(iθr)qi(r))⊤R(jθr) kj(r)=qi(r)⊤R(−δθr) kj(r)=∥qi(r)∥ ∥kj(r)∥cos⁡(θrδ−φr),\begin{aligned}&\big(R(i\theta_r)q_i^{(r)}\big)^\top R(j\theta_r)\,k_j^{(r)}\\&=q_i^{(r)\top}R(-\delta\theta_r)\,k_j^{(r)}\\&=\|q_i^{(r)}\|\,\|k_j^{(r)}\|\cos(\theta_r\delta-\varphi_r),\end{aligned}where φr\varphi_r is the angle from qi(r)q_i^{(r)} to kj(r)k_j^{(r)}. Positions enter only through δ\delta, so RoPE is relative. The score becomes a sum of cosines in δ\delta whose amplitudes and phases come from content. When contents set φr=θrδ∗\varphi_r=\theta_r\delta^* in every pair, all cosines peak together at δ∗\delta^*. In slow pairs, θrδ\theta_r\delta stays small across the context, so those coordinates match on content regardless of distance. Past training length, Press et al. found rotary models improving for only 100 to 200 tokens. In Kazemnejad et al.'s 1B-parameter code models, RoPE's perplexity exploded beyond training length.

FIRE learns the profile on a normalized distance. Fixed-window biases flatten past their last bucket, and unnormalized schemes meet unseen angles or distances on longer inputs. functional interpolation for relative positions: a bias given by a small MLP of the distance divided by the query position, both log-transformed (Li et al., 2023) (Li et al., 2023) passes a log-normalized distance into a small MLP FF with one output per head:b(i,j)=F ⁣(ψ(i−j)ψ(max⁡{n0,i})),ψ(x)=log⁡(γx+1).\begin{aligned}b(i,j)&=F\!\left(\frac{\psi(i-j)}{\psi(\max\{n_0,i\})}\right),\\ \psi(x)&=\log(\gamma x+1).\end{aligned}Here γ>0\gamma>0 is a learned scale and n0n_0 is a learned threshold. The input always stays in [0,1][0,1], so longer sequences sample the same function more finely while the log stretches nearby distances. Li et al. prove this form can represent both T5 and ALiBi biases. A 125M-parameter FIRE model trained on 2,048 tokens reached 21.24 perplexity on C4 when tested zero-shot on 8,192 tokens, against 23.52 for the best other scheme.

Canon layers supply local order outside attention. Short-range order need not sit inside attention scores. a causal convolution of width 4 with learned per-coordinate weights and a residual connection, inserted before attention, after the query, key and value projections, before the MLP or inside it (Allen-Zhu, 2025) (Allen-Zhu, 2025) add a width-4 causal convolution over each position and its three predecessors:hj′=hj+∑u=03ωu⊙hj−u,h'_j=h_j+\sum_{u=0}^{3}\omega_u\odot h_{j-u},with learned per-coordinate weights ωu\omega_u. With Canon layers, NoPE often matched or beat RoPE on Allen-Zhu's synthetic tasks. At 1.3B parameters trained on 100B tokens, NoPE with Canon layers matched RoPE.

Inkling 2 Mini lets each query choose its own distance profile. Citing Shaw et al., Inkling keeps query-dependent profiles cheap by giving each query 16 weights over a bank of 16 profiles shared across the layer's heads. In one head, the query's weights ss and score at distance 0≤δ<10240\le\delta\lt 1024 arey=c⊙Wr RMSNorm(hi),s=clip⁡8(y),zij=qi⊤kjdhead+s⊤pδ.\begin{aligned}y&=c\odot W_r\,\mathrm{RMSNorm}(h_i),\\ s&=\operatorname{clip}_8(y),\\ z_{ij}&=\frac{q_i^\top k_j}{\sqrt{d_{\rm head}}}+s^\top p_\delta.\end{aligned}Here a 16×d16\times d matrix, the head's rows of the projection that sets the 16 weights, with dd the model width; the code's wr_du is the head's projection, a vector of 16 learned scales, one per weight, separate for each head holds its 16 learned scales, clip⁡8(y)=ymin⁡(1,8/∥y∥)\operatorname{clip}_8(y)=y\min(1,8/\|y\|), which shrinks a vector longer than 8 to length 8 and leaves shorter ones unchanged caps the vector norm at 8, and the 16 learned profiles' values at distance δ\delta, one column of a 16×102416\times1024 bank shared by the heads of the layer holds the 16 shared profiles at distance δ\delta. Beyond 1,024 tokens the bias is zero. Because b(δ)=s⊤pδb(\delta)=s^\top p_\delta changes with the query, one token can look a token back while another in the same head looks hundreds back. Thinking Machines report that this relative embedding performs better and extrapolates better to longer sequences than RoPE in Inkling.

Inkling also mixes local order into keys and values with a width-4 causal convolution like Canon layers. In sliding-window layers, including layer 0, each key becomes itself plus a learned weighted sum of keys at j,…,j−3j,\dots,j-3, divided by 5\sqrt5. In global layers those convolution weights also depend on the input. In layer 0, hih_i is the normalized embedding of the token at ii, so ss and its profile depend on that token alone and can be from the weights alone, with no forward pass; how to find and check such readouts in a released model. Reading note: Reading a model's weights for all 200,058 vocabulary tokens.

The softmax of the bias isolates a head's distance prior. When a head's profile depends only on query token ww, as in Inkling's layer 0, write bwb_w for its bias. Its the softmax over distances of one head's bias for a query token ww, πw(δ)∝ebw(δ)\pi_w(\delta)\propto e^{b_w(\delta)} for 0≤δ<10240\le\delta\lt 1024; the attention the head would give if every key in a full window had the same content score isπw(δ)=ebw(δ)∑δ′=01023ebw(δ′),\pi_w(\delta)=\frac{e^{b_w(\delta)}}{\sum_{\delta'=0}^{1023}e^{b_w(\delta')}},the distance prior before any key's content enters the score. Its the smallest δ\delta with ∑δ′≤δπw(δ′)≥12\sum_{\delta'\le\delta}\pi_w(\delta')\ge\tfrac12, the distance within which half of the bias-only attention lies tracks reach better than the peak arg⁡max⁡δbw(δ)\arg\max_\delta b_w(\delta). A steep profile and a flat one can share a peak while differing by hundreds of tokens in reach. In head 19 of Inkling's layer 0, "the" and "model" (each with a leading space) both peak at δ=1\delta=1, yet their medians are 1 and 199 tokens. The the median over a layer's 24 heads of each head's median distance δ1/2\delta_{1/2} for the token summarizes a token's reach across all 24 heads in one number.

Sorting layer-0 heads by δ1/2\delta_{1/2} across tokens separates them into three classes. A head with a median of one or two tokens for nearly every token is a a head that attends from each position to the one before it and copies information about that token into the current position; with an induction head it forms the circuit for completing [A][B] … [A] with [B] (Olsson et al., 2022), the component Olsson et al. (2022) found feeding induction heads. In Inkling, the key convolution already folds keys j−1j-1 through j−3j-3 into key jj, doing part of that job without a head. A head whose median stays in the hundreds for nearly every token is broad. A head whose median ranges from a few tokens to hundreds depending on the token is token-dependent.

Four checks govern how to read a profile, starting with the attention sink. Xiao et al. (2023) found that because softmax weights must sum to 1, language models dump unneeded mass onto the first tokens, forming an a token that receives a large share of attention regardless of its content, typically the first token, because the softmax weights must sum to 1 (Xiao et al., 2023). One fix they test adds a fixed zero logit paired with a zero value vector. Inkling instead gives each head a learned, query-dependent sink logit the sink logit, one extra score per query and head whose value vector is zero, so the attention it receives is removed from the output; a learned linear function of the query's input. Adding a constant κ\kappa to the whole bias leaves πw\pi_w unchanged, yet shifts the sink's share αsink\alpha_{\rm sink} of bias-only attention:αsink=11+eκ−zsink∑δebw(δ).\alpha_{\rm sink}=\frac{1}{1+e^{\kappa-z_{\rm sink}}\sum_{\delta}e^{b_w(\delta)}}.A profile's overall level drops out of πw\pi_w. It moves attention into or out of the sink and says nothing about distance.

Three further checks limit what a layer-0 profile shows. First, the key convolution folds keys δ+1\delta+1 through δ+3\delta+3 into key δ\delta, so a peak at δ=1\delta=1 draws on information up to 4 tokens back. Second, only layer 0 assigns a fixed profile to each token. From layer 1 on, hih_i carries context, so the same token gets a different profile in each context and any readout must average over a corpus. Third, every linguistic peak needs a control. A peak matching a plausible distance, such as back to an opening bracket, counts as evidence only if a token with a different linguistic distance peaks elsewhere.

Inkling's layer 0 separates into local, broad and token-dependent heads. The figures below are computed here from the released weights, with heads numbered from 0. They cover the 8,035 tokens appearing at least 30 times in a 5.3M-token sample of English text and Python code. Heads 1, 6, 9, 10, 12 and 17 are previous-token heads, with median distance at most 4 for at least 98% of those tokens. Heads 2, 3, 13, 21 and 23 are broad, with medians of at least 100 for at least 99.6%. Heads 0, 7, 15, 16 and 19 are token-dependent, acting local for some frequent tokens and broad for others. The remaining eight heads have medians from one token to a few dozen for most tokens. All eleven local and broad heads keep their classes jointly for 95% of frequent token types. Because those exceptions include common tokens such as newlines, indentation, quotes, and punctuation, all eleven keep their class at just over half of sample positions. A newline turns heads 1 and 6 broad, with medians 586 and 945, and turns head 21 local, with median 2.

Averaged across the 24 heads, the bias sits near −2-2 logits at δ=0\delta=0, peaks at δ=1\delta=1 for all but one frequent token, and decays with distance. Its first principal component across frequent tokens carries 91.5% of variance, yet correlates −0.9999-0.9999 with each profile's mean. By the sink check, that level shift moves attention only into or out of the sink. Once each profile's mean is removed, the first two components carry 53% and 29%, so profiles vary in shape along at least two directions.

Reach varies by word class and tokenization. Nine common prepositions with a leading space have a mean head-median of 4.3 tokens, against 19 for ten common nouns and 31 for five common adjectives. Tokenization splits reach even more sharply across thousands of tokens. The 2,494 frequent lowercase tokens without a leading space, mostly word continuations, have a median head-median of 3 tokens. The 3,073 with a leading space, which begin words, have a median of 27.

Head 16 illustrates both a real lexical split and the need for controls. Under its bias alone, the median distance is 1 to 4 tokens for "of", "to" and "by", against about 190 to 420 for "in", "on", "at", "for" and "with". Both groups leave the head comparably active, with sink shares of 42% to 64% for the first group and 60% to 76% for the second. In the same head, " )" with a leading space peaks at exactly 40 tokens, close to the median 41 tokens back to its matching opener. Yet ")" without a space also peaks at 40, even though its opener sits a median 6 tokens back. The period, comma, and other closing brackets peak at 40 too, so the peak does not track the opener.

On running text, the bias pulls layer-0 attention toward recent tokens. On 2,048-token English and Python samples, queries with a full 1,024-token window average about 500 tokens of attention distance over keys without the bias, near the 512 of uniform attention. Adding the bias cuts that mean distance to about 160 tokens. Across a query's keys, the bias varies roughly as much as the content score, with a median standard deviation of 1.2 logits against 1.0 to 1.1 for content. The bias also lowers scores overall, lifting the sink's share from 17% to 25% on English and from 11% to 18% on Python.

Full-model runs confirm the head classes on real text. Inkling 2 Mini's Q4_K_XL GGUF file run in llama.cpp, with layer 0's attention recorded after the softmax; that attention is within a mean total variation distance of 0.003 per row of a reimplementation run on the BF16 weights, far below the gaps between the model and the bias reported here. Reading note: Reading a model's weights confirms all three classes on three passages of English prose, Python, and nested brackets, each at most 485 tokens long (computed here with the local quantized model). Previous-token heads keep medians of 1 to 3 tokens, broad heads sit at 56 to 127, and token-dependent heads rank queries like their bias-only medians, with rank correlations of 0.86 to 0.96. On these passages, heads 14 and 18, along with the token-dependent head 19, are as local as the previous-token heads. Heads 8, 11, and 20 vary across queries as much as the token-dependent heads, both in the model and under the bias alone. Only the type-based lists above keep those six heads out of the corresponding groups. Compared with the bias alone, the model puts less mass at δ=1\delta=1, dropping head 1's share of key attention there from 65% to 48%. It also sends less attention to the sink in 21 of 24 heads, most sharply in head 13, where the sink share falls from 85% to 23%.

Specific bias predictions also carry over, subject to passage length. Head 16's preposition split holds on English text, with medians of 2 tokens for "of", "to" and "by" against 26 for "in", "on", "at", "for" and "with" (2 and 32 under the bias alone). A newline turns head 1 broad, with median 163, and sends 99% of head 6's key attention to the newline itself, matching the bias alone over those keys. Passages this short cap the broad heads' medians, so the full-window 1,024-distance figures above are not directly comparable. Head 6's full-window median of 945 tokens after a newline puts half of its bias-only attention past the end of these passages.

Terms

Permutation equivariance
with no position signal and no mask, permuting the tokens permutes the outputs, so order is invisible
Causal-mask leak
position ii averages exactly ii values, so uniform attention on a start token's value gives 1/i1/i
Position term as prior
αij∝eb(δ)eqi⊤kj/dhead\alpha_{ij}\propto e^{b(\delta)}e^{q_i^\top k_j/\sqrt{d_{\rm head}}}: the bias is a log-prior over distance
T5 bias
one scalar per head per distance bucket, 32 buckets; in the decoder every distance from 113 on shares the last
ALiBi
b(δ)=−mδb(\delta)=-m\delta with fixed geometric slopes; stable on long inputs, and its gain from longer windows comes from the early token curse
RoPE
score =∑r∥q(r)∥∥k(r)∥cos⁡(θrδ−φr)=\sum_r\|q^{(r)}\|\|k^{(r)}\|\cos(\theta_r\delta-\varphi_r): relative, with a content-set profile
FIRE
bias =F(ψ(δ)/ψ(max⁡{n0,i}))=F(\psi(\delta)/\psi(\max\{n_0,i\})), an MLP on a distance normalized into [0,1][0,1]
Canon layer
hj′=hj+∑u=03ωu⊙hj−uh'_j=h_j+\sum_{u=0}^3\omega_u\odot h_{j-u}, local order outside attention
Inkling bias
b(δ)=s⊤pδb(\delta)=s^\top p_\delta with s=clip⁡8(c⊙WrRMSNorm(hi))s=\operatorname{clip}_8(c\odot W_r\mathrm{RMSNorm}(h_i)): the query picks its profile
Bias-only attention
πw(δ)∝ebw(δ)\pi_w(\delta)\propto e^{b_w(\delta)}, the attention under equal content scores
Head-median
median over heads of each head's median distance under bias-only attention
Sink check
a constant shift of the bias leaves πw\pi_w unchanged but moves attention into or out of the sink
Peak control
a peak at a plausible distance needs a token whose plausible distance differs and that peaks elsewhere

Sources

Connected notes

  • Direct preference optimizationLearning from human preferences · Exponential tilting

    Without the KL term the best policy puts all its mass on one sequence; with it the target is πrefer/β/Z\pi_{\rm ref}e^{r/\beta}/Z, which puts mass on exactly the sequences the reference model gives mass to and moves toward the best sequences as β\beta falls.

  • In a PAC-Bayes bound the KL from posterior to prior is the complexity term, and a Gaussian prior centered at the initialization makes it grow with how precisely the weights are specified and how far they move in training.

  • Noisy training minimizes a free energy, half the risk plus weight decay minus the entropy over β\beta, and its unique minimizer is the Gibbs fixed point, proportional to e−βΨλe^{-\beta\Psi_\lambda} for a potential Ψλ\Psi_\lambda that itself depends on the minimizer.

  • PPO and RLOO for language modelsReinforcement learning for reasoning · Exponential tilting

    In Ziegler et al.'s mock task, where the reward is known, the best policy at each KL is the reference reweighted by er/βe^{r/\beta} and renormalized; PPO trained on 2M episodes, the number used in the main experiments, earns clearly less reward than this optimum at the same KL, and more training mostly closes the gap.

Threads