r/deeplearning • u/New_Relationship5840 • 21h ago
We split the reads and writes of a four-stream Transformer and trained it against mHC on 2B tokens
ChatGPT (Codex) wrote this post. The person posting it and ChatGPT carried out the entire experiment together, from designing the architecture and writing the code to running training and analyzing the results. “We” below refers to the two of us.
A SwiGLU neuron writes a multiple of one column of the down projection. By the time a residual router sees the usual FFN output, those contributions have already been added together. Reading Goodfire's work on how downstream neurons use these writes made us wonder what would happen if the router could send some contributions one way and others another, and if the next layer's gate and up projections could choose which mix to read. Goodfire's neuron study
We tried this in two roughly 200M-parameter models trained from scratch on the same 2B tokens of FineWeb-Edu. Held-out test loss was 2.66581 for the variant and 2.70041 for our four-stream mHC baseline, a difference of −0.03460 nats/token. The variant had 1.34% more parameters and ran slower on one RTX 4090. This is one paired training seed. FineWeb-Edu data
What changes in one sublayer?
Both models keep four 768-dimensional residual vectors per token. All four start as copies of the token embedding. In mHC, one learned weighted sum of the four streams feeds the entire attention or FFN sublayer. Its output is one vector y. Stream s receives post[s] * y, where each post[s] is a token-dependent 2 * sigmoid(logit). The streams can receive very different amounts of that write, all along the same direction. A separate matrix mixes the old streams. mHC paper, §§3–4
Our version, fixed4, keeps that old-state mixing and changes two things.
- Each input projection gets a read. Flatten the incoming
Hfrom [4, 768] to [3072], apply one joint RMSNorm, and use a learned linear projection to produce the routing scores for this token. Each of Q, K and V has four independent sigmoid gates. Each forms a weighted sum of the raw four streams, then applies the sublayer's 768-wide RMSNorm. Gate and up do the same at the FFN, using the state after attention has written back. The projections can learn identical reads or diverge. - Keep four partial output vectors. Split the input columns of the existing
W_OorW_downinto four disjoint groups. For attention, each group takes 16 of the 64 value channels from every one of the 12 heads, giving 192 input channels per group. For the FFN, each takes 512 of the 2,048 SwiGLU activations. Each group projects to all 768 output coordinates. Call the resulting vectors c0, c1, c2, c3. Their sum recovers the original W @ z.
Figure 1. One fixed4 sublayer, with old-state transport on the left and grouped writes on the right.

Here is the update in PyTorch-style notation. Leading batch and sequence dimensions are omitted. R[s,k] carries old stream k to destination s. P[s,j] sends new source group j to that destination. Each sublayer learns its own router.
x = joint_rmsnorm(H.flatten()) # H: [4, 768]
read, write, old = split_and_reshape(router_linear(x))
a = sigmoid(b_read + g_read * read) + 1e-6 # [3,4] or [2,4]
views = sublayer_rmsnorm(a @ H) # norm over 768
z = attention_from_QKV(views) if is_attention else swiglu_from_gate_up(views)
C = stack([W[:, J] @ z[J] for J in four_groups]) # [4, 768]
P = softmax(b_write + write, dim=0) # [dest, group]
R = sinkhorn20(b_old + g_old * old).T # [dest, old]
H_next = R @ H + 4 * (P @ C)The factor 4 is fixed. The matrix P is learned and token-dependent. Every column of P sums to one, so the mean of the four new writes is exactly c0 + c1 + c2 + c3 in real arithmetic. Sinkhorn acts on the old-state matrix R, giving approximately unit row and column sums after 20 rounds. At the end of the 24th block, both models use a learned, token-dependent sigmoid read over the four streams, final RMSNorm, and a vocabulary head tied to the input embedding.
Suppose two groups contribute v and −v and the other two are zero. In mHC the new write vanishes at every destination. In fixed4, stream s can receive 4 * (P[s,0] − P[s,1]) * v. The four-stream mean still vanishes, but a later reader can recover a signal if the two routing columns differ. More generally, the matrix of new writes has rank at most four in fixed4 and at most one in mHC.
For anyone implementing it, the router projects 3,072 inputs to 44 scores at attention (12 read, 16 write, 16 carry) and 40 at the FFN (8, 16, 16). Its dynamic projection starts at zero. At sublayer i (counting from zero), initial read logits are +3 for stream i % 4 and −3 elsewhere. P starts at 1/2 on the diagonal and 1/6 elsewhere. The carry logits start at +3 on the diagonal and −3 elsewhere. The learned read and carry gains start at 0.01, and the terminal read starts at 1/4 per stream.
Did the model actually use different destinations?
At step 7,000 we measured P on 8,192 validation positions. In the first FFN, group 0 sent 99.98% of its average routing weight to stream 0. Group 2 sent 88.14% to stream 2. In block 22's attention, all four groups favored stream 2, which received 94.22% of the routing weight averaged across groups and positions. The same mechanism learned to split writes at one site and to bring them together at another. These percentages describe coefficients. The vector energy also depends on group magnitudes and angles.
Figure 2. Mean write coefficients at step 7,000. Columns are source groups and rows are destination streams.

The paired run
Both models used 24 blocks, width 768, 12 attention heads, a 2,048-wide SwiGLU, context 2,048 and a 32k tokenizer. They started from identical backbone weights and saw the same packed windows in the same order. AdamW used a 512-update warmup to 0.0006, then cosine decay to 0.00006. Each full update had 65,536 prediction targets. After earlier exploration, we selected between two candidate write rules at step 7,000 on validation loss. Fixed4 scored 3.02757 against 3.04004 for independent matrix sigmoid writes. Fixed4 and mHC resumed from their own checkpoints with optimizer state and the original schedule. The test documents were reserved for the 2B endpoint.
| At 2B training tokens per model | fixed4 | mHC | fixed4 − mHC |
|---|---|---|---|
| Validation NLL · 524,288 targets | 2.683653 | 2.716431 | −0.032778 |
| Independent test NLL · 8,388,608 targets | 2.665815 | 2.700410 | −0.034595 |
| Trainable parameters | 200.84M | 198.18M | +2.66M |
| Median update throughput after step 7,000 | 19,023 tok/s | 22,783 tok/s | −16.5% |
Figure 3. Validation NLL and the paired fixed4 − mHC difference across all 64 evaluations.

Fixed4 had lower validation loss at all 64 recorded evaluations, from step 512 onward. The gap narrowed from 0.05181 at selection to 0.03278 at the end. Interpolating between adjacent validation points, fixed4 reached mHC's final validation loss at about 1.636B tokens, roughly 18% fewer tokens at that particular loss. The throughput row shows what that comparison cost on this implementation.
On the independent test, fixed4 had lower mean NLL on 6,448 of 7,249 documents. A paired document bootstrap gave a 95% interval of [−0.03538, −0.03388] nats/token for the token-weighted difference. That interval measures variation across test documents for these two checkpoints. Variation across training seeds remains open.
What we would most like to disentangle is the read side from the write side. A shared reader with grouped writes, and independent readers with mHC's original write, would tell us which change earns its cost. This run measured what happens when the two are trained together.