Attention Is Only as Good as Its Witnesses

The propagator

One layer, one linear solve

Each question is a graph from the search benchmark of Saparov et al., drawn as a map: every road is one edge, one way, from a town to the next. From the current town (dark), the layer must name the road toward the goal (rose ring). It sums the walks of every length at once, X = S (I − G)−1: the source S sits on the goal, the learned gates G weigh each step back along a road, and the weight of the walks that reach a town lights it. Trained on graphs of 49 vertices, it answered every test question at every lookahead on graphs of 250 vertices, in each of its three runs.

Playing the recorded run while the layer loads (300 KB).

Map Lookahead
Next road from 216 toward the goal 73?
1: click to make it the goal2: click to make it the goal3: click to make it the goal4: click to make it the goal5: click to make it the goal6: click to make it the goal7: click to make it the goal8: click to make it the goal9: click to make it the goal10: click to make it the goal11: click to make it the goal12: click to make it the goal13: click to make it the goal14: click to make it the goal15: click to make it the goal16: click to make it the goal17: click to make it the goal18: click to make it the goal19: click to make it the goal20: click to make it the goal21: click to make it the goal22: click to make it the goal23: click to make it the goal24: click to make it the goal25: click to make it the goal26: click to make it the goal27: click to make it the goal28: click to make it the goal29: click to make it the goal30: click to make it the goal31: click to make it the goal32: click to make it the goal33: click to make it the goal34: click to make it the goal35: click to make it the goal36: click to make it the goal37: click to make it the goal38: click to make it the goal39: click to make it the goal40: click to make it the goal41: click to make it the goal42: click to make it the goal43: click to make it the goal44: click to make it the goal45: click to make it the goal46: click to make it the goal47: click to make it the goal48: click to make it the goal49: click to make it the goal50: click to make it the goal51: click to make it the goal52: click to make it the goal53: click to make it the goal54: click to make it the goal55: click to make it the goal56: click to make it the goal57: click to make it the goal58: click to make it the goal59: click to make it the goal60: click to make it the goal61: click to make it the goal62: click to make it the goal63: click to make it the goal64: click to make it the goal65: click to make it the goal66: click to make it the goal67: click to make it the goal68: click to make it the goal69: click to make it the goal70: click to make it the goal71: click to make it the goal72: click to make it the goal73: click to make it the goal74: click to make it the goal75: click to make it the goal76: click to make it the goal77: click to make it the goal78: click to make it the goal79: click to make it the goal80: click to make it the goal81: click to make it the goal82: click to make it the goal83: click to make it the goal84: click to make it the goal85: click to make it the goal86: click to make it the goal87: click to make it the goal88: click to make it the goal89: click to make it the goal90: click to make it the goal91: click to make it the goal92: click to make it the goal93: click to make it the goal94: click to make it the goal95: click to make it the goal96: click to make it the goal97: click to make it the goal98: click to make it the goal99: click to make it the goal100: click to make it the goal101: click to make it the goal102: click to make it the goal103: click to make it the goal104: click to make it the goal105: click to make it the goal106: click to make it the goal107: click to make it the goal108: click to make it the goal109: click to make it the goal110: click to make it the goal111: click to make it the goal112: click to make it the goal113: click to make it the goal114: click to make it the goal115: click to make it the goal116: click to make it the goal117: click to make it the goal118: click to make it the goal119: click to make it the goal120: click to make it the goal121: click to make it the goal122: click to make it the goal123: click to make it the goal124: click to make it the goal125: click to make it the goal126: click to make it the goal127: click to make it the goal128: click to make it the goal129: click to make it the goal130: click to make it the goal131: click to make it the goal132: click to make it the goal133: click to make it the goal134: click to make it the goal135: click to make it the goal136: click to make it the goal137: click to make it the goal138: click to make it the goal139: click to make it the goal140: click to make it the goal141: click to make it the goal142: click to make it the goal143: click to make it the goal144: click to make it the goal145: click to make it the goal146: click to make it the goal147: click to make it the goal148: click to make it the goal149: click to make it the goal150: click to make it the goal151: click to make it the goal152: click to make it the goal153: click to make it the goal154: click to make it the goal155: click to make it the goal156: click to make it the goal157: click to make it the goal158: click to make it the goal159: click to make it the goal160: click to make it the goal161: click to make it the goal162: click to make it the goal163: click to make it the goal164: click to make it the goal165: click to make it the goal166: click to make it the goal167: click to make it the goal168: click to make it the goal169: click to make it the goal170: click to make it the goal171: click to make it the goal172: click to make it the goal173: click to make it the goal174: click to make it the goal175: click to make it the goal176: click to make it the goal177: click to make it the goal178: click to make it the goal179: click to make it the goal180: click to make it the goal181: click to make it the goal182: click to make it the goal183: click to make it the goal184: click to make it the goal185: click to make it the goal186: click to make it the goal187: click to make it the goal188: click to make it the goal189: click to make it the goal190: click to make it the goal191: click to make it the goal192: click to make it the goal193: click to make it the goal194: click to make it the goal195: click to make it the goal196: click to make it the goal197: click to make it the goal198: click to make it the goal199: click to make it the goal200: click to make it the goal201: click to make it the goal202: click to make it the goal203: click to make it the goal204: click to make it the goal205: click to make it the goal206: click to make it the goal207: click to make it the goal208: click to make it the goal209: click to make it the goal210: click to make it the goal211: click to make it the goal212: click to make it the goal213: click to make it the goal214: click to make it the goal215: click to make it the goal216: click to make it the goal217: click to make it the goal218: click to make it the goal219: click to make it the goal220: click to make it the goal221: click to make it the goal222: click to make it the goal223: click to make it the goal224: click to make it the goal225: click to make it the goal226: click to make it the goal227: click to make it the goal228: click to make it the goal229: click to make it the goal230: click to make it the goal231: click to make it the goal232: click to make it the goal233: click to make it the goal234: click to make it the goal235: click to make it the goal236: click to make it the goal237: click to make it the goal238: click to make it the goal239: click to make it the goal240: click to make it the goal241: click to make it the goal242: click to make it the goal243: click to make it the goal244: click to make it the goal245: click to make it the goal246: click to make it the goal247: click to make it the goal248: click to make it the goal249: click to make it the goal250: click to make it the goal
≤ 0 roads

Running the layer on this question…

lookahead 31, test question 1 of 1250 towns, 249 roadsrecorded run

What the layer reads Only this list of tokens, as the benchmark writes it: the map is our drawing, never its input, and the town numbers are names drawn at random for each question. Hover a road’s tokens to find it on the map.

755 tokens3 padding249 roads × 3query and path 5

pad ×3 E 231 102E 107 211E 194 11E 234 81E 123 229E 128 15E 183 9E 191 20E 126 58E 44 6E 228 236E 129 205E 22 28E 54 68E 99 199E 207 238E 115 186E 169 134E 21 69E 14 159E 34 188E 49 244E 50 135E 119 95E 80 88E 51 16E 208 112E 39 44E 92 33E 121 57E 35 242E 197 121E 62 53E 232 222E 184 170E 32 99E 9 212E 124 78E 219 215E 24 234E 210 143E 1 230E 45 152E 239 43E 205 105E 214 164E 89 235E 8 240E 209 93E 144 127E 95 210E 76 227E 229 221E 74 239E 96 183E 11 136E 42 82E 53 123E 157 137E 236 243E 217 162E 65 60E 77 139E 134 49E 131 83E 67 232E 75 189E 152 124E 36 247E 19 187E 135 36E 233 228E 176 3E 224 30E 18 184E 93 190E 69 248E 151 160E 78 223E 155 166E 116 226E 248 13E 13 117E 122 154E 84 138E 82 185E 164 208E 137 167E 163 52E 113 198E 235 131E 63 150E 7 176E 242 59E 100 80E 2 173E 61 202E 26 125E 171 209E 240 145E 112 224E 66 86E 88 79E 193 175E 106 225E 216 219E 216 1E 216 104E 216 67E 216 48E 216 92E 216 203E 216 70E 140 111E 41 151E 221 169E 25 65E 223 85E 17 116E 133 196E 150 66E 213 237E 57 161E 247 128E 167 63E 187 26E 83 4E 6 107E 15 172E 94 32E 109 22E 86 246E 172 74E 60 214E 98 158E 138 192E 192 75E 33 90E 4 126E 246 55E 156 89E 23 133E 160 103E 20 12E 196 182E 203 54E 136 47E 38 24E 166 109E 188 37E 27 140E 158 142E 149 155E 90 18E 108 96E 81 106E 55 168E 237 180E 72 61E 37 113E 64 41E 117 115E 79 146E 104 171E 139 206E 10 165E 110 101E 199 31E 170 19E 190 204E 68 179E 201 141E 211 108E 180 149E 153 40E 97 163E 111 71E 118 129E 212 35E 120 64E 249 174E 238 7E 3 46E 165 72E 105 76E 230 119E 154 249E 5 100E 243 217E 175 181E 43 25E 198 98E 130 39E 182 21E 227 29E 244 27E 215 245E 174 178E 28 250E 202 2E 241 191E 59 241E 31 193E 147 56E 29 45E 146 220E 47 38E 148 5E 127 197E 141 120E 40 213E 102 233E 52 110E 178 23E 103 84E 70 157E 245 17E 132 130E 218 97E 12 91E 56 8E 114 42E 58 14E 222 144E 46 77E 143 207E 181 194E 101 122E 204 200E 179 50E 159 195E 206 147E 125 177E 48 231E 142 201E 71 153E 177 132E 161 218E 173 114E 226 118E 145 156E 162 34E 85 10E 200 62E 189 87E 185 73E 168 51E 30 148E 16 94 Q 216 73 P216
What it writes one score for every town name; nothing is drawn by the model

250 names, one logit each, then a softmax: the answer is 219, the next town from 216

Each bar a name’s logit, lowest to highest; names in order.

namelogitp
2198.050.99
2033.500.01
480.576e-4
92-0.223e-4
1-1.338e-5
The current town’s roads the walk weight that has come back to the town each road leads to
road walks that reached its town weight
216 → 219 < 0.0003
216 → 1 < 0.0003
216 → 104 < 0.0003
216 → 67 < 0.0003
216 → 92 < 0.0003
216 → 203 < 0.0003
216 → 70 < 0.0003
216 → 48 < 0.0003
Learned gates the weight of one step along each road of this map, both ways; hover or tap a road to read it

median gate walking a road back 0.97largest forward 3 × 10⁻⁵largest with no road 6 × 10⁻⁶

Click a town to make it the goal: the walks start from there, and the query token changes. Hover or tap a road to read its gates and find its tokens; drag the walks slider to add the walks one length at a time; rename the towns to give the layer the same question in other tokens.

Guv=t0 G~uvmax⁡(∑v′G~uv′, t0),G~uv=t0 σ(w⋅tuv+b),Suk=σ(w′⋅tuk+b′),X=S (I−G)−1=∑m≥0S Gm,G_{uv} = \frac{t_0\, \tilde G_{uv}}{\max\big(\sum_{v'} \tilde G_{uv'},\ t_0\big)}, \quad \tilde G_{uv} = t_0\, \sigma(w \cdot t_{uv} + b), \quad S_{uk} = \sigma(w' \cdot t_{uk} + b'), \quad X = S\, (I - G)^{-1} = \sum_{m \ge 0} S\, G^m ,

In each of four channels the layer forms gates G and a source S from the normalised pair state, caps every row of G so that it sums to at most t0 = 0.99, and solves for the walk sum. The cap keeps the spectral radius below one on any graph, so the walk sum converges. The map shows the channel that carries the answer: its gates are near one on roads walked back and near zero on roads walked forward and between towns with no road. The layer has 28,472 parameters. This page runs the same forward pass in TypeScript, checked against the training code’s own outputs at 49, 125 and 250 towns to within 0.001.

Layer by layer

The depth law

Before one solve, depth. A pair state keeps a state for every pair of towns, and each layer sums over the two-step walks u → k → v through every middle town k. By the depth law (Theorem 1 of the paper), L such layers reach exactly 2L − 1 roads beyond the current town’s next town, lookahead 2L, for every L; trained pair states over names answer at least 95% at every lookahead up to 2L and fall just past it. The 8 layers here are the pair state over vertex names trained at 49 vertices (39,504 parameters).

The second model is the OR join: one pair layer, repeated, whose sum over the middle town is read through an OR, 1 − e−Z, so it says only whether some middle town connects a pair. Trained at 49 vertices and tested at 125, it answered at least 99.6% at every lookahead.

Playing a recorded run while the model loads (450 KB).

Model Map
Lookahead
Next road from 35 toward the goal 45?

After layer 0 of 8 it would answer 45 (p = 0.76)

lookahead 6, test question 63 of 30025 towns, 24 roadstowns tinted by the current town’s read-out: rose above its average, cobalt below

What the model reads Only these tokens, never the map; the town numbers are names drawn at random for each question. Each road walked is one more forward pass, its town appended to the path.

152 tokens75 padding24 roads × 3query and path 5

pad ×75 E 24 16E 7 8E 35 6E 35 36E 35 49E 35 30E 30 14E 48 45E 1 15E 6 42E 12 23E 49 1E 9 19E 3 9E 47 7E 5 31E 23 47E 42 24E 14 13E 36 12E 16 48E 15 3E 31 46E 13 5 Q 35 45 P35
What it writes after the last layer, one score for every town name; nothing is drawn by the model

25 names, one score each, then a softmax: the answer is 6, the next town from 35

Each bar a name’s probability; names in order.

namelogitp
6–1.00
1–0
3–0
5–0
7–0
What the pair state would answer from each town (rows) to each town (columns), after layer 0

deeper rose, more probable; hover a cell to see its route

Layer by layer its answer if it stopped after each layer; click a layer to stop there

Click a town to make it the goal; drag from one town to another to build a road; click a road to close it. The model searches the new map from its start.

Recorded results

8 layers: which layer answers which depth

share of the test questions (12 per lookahead) the read-out gets right after each layer; this question outlined

After the start and the first three layers it answers only lookahead 1. Layer 5 answers most questions of lookahead 2 to 5, layer 6 most up to 7, layer 7 most up to 14, and layer 8 all of them: the depth it sees roughly doubles per layer, as the depth law says.

One layer, repeated: how far it sees

the longest lookahead it answers after each number of iterations, 99% or more of the test questions at every lookahead up to it

How it works

The map is only a drawing: no model sees it. Each reads the question as the benchmark writes it, a list of edges E u v, then Q start goal and the path so far, one token each. Tokens are pooled into the town names they write, each read with its two neighbours, and a state zuv of 16 numbers is kept for every ordered pair of names. With t the state normalised over its channels, each of the 8 layers is the summed pair layer

zuv←zuv+σ(Γtuv)⊙1n∑k(Atuk)⊙(Btkv),zuv←zuv+MLP(tuv′),z_{uv} \leftarrow z_{uv} + \sigma(\Gamma t_{uv}) \odot \frac{1}{\sqrt n} \sum_k (A t_{uk}) \odot (B t_{kv}), \qquad z_{uv} \leftarrow z_{uv} + \mathrm{MLP}(t'_{uv}),

a route from u to k and a route from k to v make a route from u to v, so the length of route a pair can know about can double with each layer. The OR join replaces the sum, with no factor 1/√n, by

Ouv=1−exp⁡(−∑kσ(Atuk) σ(Btkv)),zuv←zuv+σ(Γtuv)⊙WoOuv,O_{uv} = 1 - \exp\Big(-\sum_k \sigma(A t_{uk})\, \sigma(B t_{kv})\Big), \qquad z_{uv} \leftarrow z_{uv} + \sigma(\Gamma t_{uv}) \odot W_o O_{uv},

one matrix product per channel. Every name v is scored by w · norm(zcv) for the current town c; the table shows that read-out applied to every row, and the map tints each town by the current row. The 8 layers (39,504 parameters) answer all 300 exported test questions; the OR join has 24,896. This page runs both forward passes in plain TypeScript, checked against the training code: to within 0.001 in every logit for the 8 layers, to within 0.0001 after every iteration from 1 to 10 for the OR join, on maps of 49 and 125 towns. Each question’s map was laid out once, offline, with its own land; every road on it is an edge of the question.

The benchmark is Saparov et al., “Transformers Struggle to Learn to Search” (ICLR 2025): their generator, their test sets and their Transformer code. The paper states the depth law and the size law, the training runs, and where each layer falls short.