6. Exercises#
Several have computed answers: the computation is hidden below the exercise (click to show) and the answer is checked by the build.
6.1. Attention residuals contain PreNorm#
Show that with all \(\alpha_{i,j} = 1\) (no softmax) attention residuals reduce to the PreNorm
recursion (1). Then show that with uniform softmax weights (all queries zero, their
initial value in the released code: modeling_arloop.py, lines 112 and 115, torch.zeros) block attention residuals without a window produce exactly
the same updates as PreNorm, because the RMSNorm before each sublayer removes the positive factor
(exactly for \(\varepsilon = 0\); up to the RMSNorm’s \(\varepsilon\) otherwise).
Does this survive the released code’s first block, which starts from the embedding (finding F6)?
Answer
With \(\alpha_{i,j} = 1\) the state is \(h_i = h_0 + \sum_{j\le i} z_j\), the unrolled form of (1). With uniform weights over the embedding, the completed blocks and the partial block, the mixture is \((h_0 + \sum_j z_j)/(k+1)\) for \(k+1\) sources: PreNorm’s state times a positive number, which the RMSNorm removes. With the code’s first block the embedding is counted twice, the mixture is \((2h_0 + \sum_j z_j)/(k+1)\), and the identity fails from the second sublayer on. In the toy above the first two deviations are at rounding level and the third is not. [num]
6.2. A softmax mixture cannot grow the stream#
Let \(s_0, \dots, s_m\) be sources with \(\|s_j\| \le B\) and \(\alpha\) a softmax vector. Show \(\big\|\sum_j \alpha_j s_j\big\| \le B\). Then compute \(\|h\|\) at the read-out of PreNorm when the embedding and all updates are orthonormal, at the depths of both released ARLoop models.
Answer
By the triangle inequality, \(\|\sum_j\alpha_j s_j\| \le \sum_j \alpha_j\|s_j\| \le B\sum_j\alpha_j = B\). For orthonormal \(h_0, z_1, \dots, z_n\), \(\|h_0 + \sum z_j\|^2 = 1 + n\): \(\sqrt{109} \approx 10.44\) for the 108 sublayers of the 0.6B model and \(\sqrt{145} \approx 12.04\) for the 144 of the 1.2B model, while attention residuals stay at or below the norm of their largest source. The stream norms of the real PreNormLoop-0.6B are measured in E1.4. [num]
6.3. Count the routing parameters of ARLoop-1.2B#
From its configuration (book/data/hf/ARLoop-1.2B/config.json), count the depth-indexed routing
parameters and compare with the parameter count of the checkpoint (the list of the other modules is
in One query per effective sublayer: what it costs, what it fixes).
Answer
\(2 \times 24 \times 3 = 144\) effective sublayers, each with a query and a norm weight, plus the read-out pair: \(290 \times 2048 = 593{,}920\) routing parameters. Together with the backbone counted from the same configuration this gives 1,208,655,360, exactly the checkpoint’s count (see One query per effective sublayer: what it costs, what it fixes). [code + num]
6.4. When does the first block leave the window?#
For block size \(S\) sublayers and a window of \(W\) sources besides the embedding, at which effective layer is \(b_1\) read for the last time? Check the formula against the replay of the forward pass for the 0.6B model and windows \(W = 2, \dots, 6\).
Answer
Blocks are committed every \(S/2\) layers, \(b_k\) at the start of layer \(kS/2\). At the FFN sublayer of layer \(WS/2\) the router sees \(b_1, \dots, b_W\) and a partial block, one source too many, and \(b_1\) drops out; its last reader is the attention sublayer of layer \(WS/2\). For the 0.6B model (\(S/2 = 9\)): layers 18, 27, 36, 45 for \(W = 2, 3, 4, 5\); with \(W = 6\) the 54 layers end before \(b_1\) is dropped. With the released \(W = 3\) that is layer 27 (and layer 36 for ARLoop-1.2B, where \(S/2 = 12\)). [num]
6.5. How large must the GSM8K gap be?#
The paper’s GSM8K scores of the 0.6B pair are 40.9 and 35.7 on 1,319 items. Which numbers of solved items are consistent with these rounded percentages? If E1 finds the same net gap, for which numbers of discordant items (solved by exactly one model) is the exact McNemar test significant at 5%?
Answer
40.9% of 1,319 is 539 or 540 items, 35.7% is 471, so the paper’s gap is a net 68 or 69 items. The number of discordant items has the parity of the gap and is at most the sum of the two totals (when no item is solved by both models). For every discordant count the totals allow (the ranges are printed above) the exact McNemar test is significant at 5%: if E1 reproduces a gap of that size, it is not noise. Whether it reproduces is the question of E1.1 (E1: the released checkpoints, re-measured). [num]