# Looped Transformers on a 30-Second LLM Pretraining Speedrun: Better Loss, 2× Too Slow

- Canonical URL: https://amund.blog/looped-transformers-modded-nanogpt-negative-result/
- Author: Amund Tveit (https://amund.blog/about/)
- Published: 2026-11-23

---

<div style="width: 100%; max-width: 1200px; margin: 0 auto 30px auto;">
<img src="./rnn-transformer-looped.jpg" alt="Three-panel diagram comparing RNN/LSTM looping across time, Modern Transformers with FlashAttention and MoE running parallel tokens in one pass, and Looped Transformers looping across depth via Sub-Top Feedback from Layer 8 back into Pass 2" style="width: 100%; height: auto; display: block; border-radius: 8px;" />
</div>

<div style="background-color: #fff3cd; border-left: 5px solid #ffc107; padding: 15px; margin-bottom: 20px; color: #856404;">

> **⚠️ Honest negative wall-clock result — no new record today.** Yesterday's [PR #406 / #407](https://amund.blog/modded-nanogpt-sub-30s-record-attempt/) hit **29.90 s** on 8×H100 using purely exact GPU systems fixes. Today we tested whether **Looped-Transformer** architecture changes could push further by needing fewer training steps. One idea (**Sub-Top Feedback**) genuinely improved validation loss by **−0.0088** (`3.2679` vs `3.2767`), but still cost roughly **2× too much wall-clock time** per unit of loss to beat 29.90 s — so we stopped early and skipped the 12-run certification. Negative results that explain *why* are worth sharing too.

</div>

## From RNN loops in time to Transformer loops in depth

Before Transformers took over in 2017, sequence models like **RNNs and LSTMs** were built around an explicit **loop across time**. The network reused the exact same weights for token 1, then token 2, then token 3, passing a hidden state forward one step at a time. That gave RNNs great parameter efficiency, but a brutal hardware drawback: token 100 had to wait for tokens 1 through 99, leaving modern GPUs mostly idle.

**Transformers** broke that sequential bottleneck by removing the time loop and processing all tokens in parallel across a fixed stack of layers (`11` layers in `modded-nanogpt`). Over the past few years, hardware-aware variants — **FlashAttention** (fusing attention into fast on-chip SRAM tiles), rotary embeddings (**RoPE**), grouped-query attention, **FP8** tensor cores, and sparse Mixture-of-Experts (**MoE**) — have turned single-pass Transformers into relentless GPU matmul engines. That is how the [modded-nanogpt](https://github.com/KellerJordan/modded-nanogpt) speedrun brought GPT-2-scale pretraining down from 45 minutes to under **30 seconds** on 8×H100.

**Looped Transformers** ask an intriguing question: **what if we keep all tokens parallel, but bring the RNN-style loop back *in depth*?** Instead of adding more parameters, the model feeds an intermediate hidden state back into the stack and reuses the same weights for a second (or third) pass — letting it "think twice" before predicting the next token.

In code, the core idea is remarkably tiny. Here is the entire diff to turn Jay Mody's famous 40-line NumPy GPT-2 ([picoGPT](https://github.com/jaymody/picoGPT)) into a Looped Transformer:

```diff
-def gpt2(inputs, wte, wpe, blocks, ln_f, n_head):
+def gpt2_looped(inputs, wte, wpe, blocks, ln_f, n_head, n_loops=2):
     x = wte[inputs] + wpe[range(len(inputs))]
-    for block in blocks:
-        x = transformer_block(x, **block, n_head=n_head)
+    for _ in range(n_loops):                     # loop in depth (reuse same weights)
+        for block in blocks:
+            x = transformer_block(x, **block, n_head=n_head)
     x = layer_norm(x, **ln_f)
     return x @ wte.T
```

*(See the [Appendix](#appendix-turning-picogpt-into-a-looped-transformer) at the bottom for the NumPy middle-block loop and Sub-Top Feedback variants.)*

The idea has a rich lineage — and suddenly moved from theory into headline models in November 2026:

- **The origins (2018–2023):** **Universal Transformers** (Google Brain / DeepMind, 2018) first looped a shared Transformer block with adaptive halting; **Facebook AI Research's Feedback Transformer** (Fan et al., 2020–2021) bridged RNNs and Transformers by feeding deeper layer abstractions back to lower layers; and **Giannou et al.** (ICML 2023, *Looped Transformers as Programmable Computers*) formalized the modern "Looped Transformer" name.
- **Open-weights & recent releases (2025–Nov 2026):** **ByteDance's Ouro** (2025) scaled looped pretraining to practical open models. In just the last few weeks of **November 2026**, **Thinking Machines Lab** released **Inkling 2 Mini** (an Apache-2.0 MoE looping its middle 12 layers three times, plus a variable-loop 1–5 pass research release), and **Z.ai / Zhipu** launched **GLM-5.4** (running a 28-layer block twice per token on a ~750B base model). On the research side, new variants like the **Loopback Transformer** (Nov 2026, decoupling geometric residual decay from cross-layer attention) and **Sub-Top Feedback** (Xiong et al.) cleaned up how looped passes mix history.
- **Frontier-lab rumors:** Unconfirmed industry reporting (including *The Information* and recent safety-monitorability discussions) has also pointed to looped / recurrent-depth architectures being explored inside next-generation frontier models at labs like OpenAI, Google DeepMind, and Anthropic — trading parameter bloat for internal latent reasoning passes (while raising new questions about how to monitor thoughts that happen inside loops rather than in visible text).

In [yesterday's post](https://amund.blog/modded-nanogpt-sub-30s-record-attempt/), we reached **29.90 s** on 8×H100 without changing a single bit of math. With looped Transformers suddenly everywhere, today we asked the opposite question: **if a looped Transformer learns more per step, can it cut enough training steps to beat 29.90 s on wall-clock time?**

## Four looped ideas screened on 1×H100 (and why three died fast)

Before renting an expensive 8×H100 node, we implemented four distinct looped-transformer ideas behind clean toggles on top of `#406` and screened them cheaply on a single H100 (total single-GPU screening cost: **~$9**):

*(Quick unit note: speedrunners often measure tiny validation-loss changes in **millinats** (`mnats`), where `1 mnat = 0.001` of cross-entropy validation loss. Lower is better, and Track 1 requires finishing at or below `3.2800`.)*

<div style="width: 100%; max-width: 1200px; margin: 0 auto 25px auto;">
<img src="./four-levers-and-tailaverages.jpg" alt="Two-part infographic showing the four Looped-Transformer ideas screened (Dory Row-Norm, Per-Channel Resid, Fused Loopback Attention, and Sub-Top Feedback L=9) and the 298-step TailAverages timeline showing why Step 974 onset caused a +17.9 mnat eval shock while Step 595 aligned 100% of the window for −8.80 mnats" style="width: 100%; height: auto; display: block; border-radius: 8px;" />
</div>

1. **Dory Row-Norm (`+0.0192` worse on 1×H100 — killed in Round 1).** Looped models often stabilize repeated passes by clamping weight row norms back to their initial scale. In `#406`, the ANVIL optimizer *already* normalizes update row energy and shapes weight norms smoothly with cautious weight decay (`wd = 2.25`). Hard-clamping weights to step-0 random norms actively fought the optimizer.
2. **Per-Channel Residual Gates (`+0.0010` to `+0.0014` worse across 3 seeds — killed in Round 3).** Expanding `#406`'s scalar residual mixing weights into 768 per-channel gates looked promising on a single 600-step seed (`−0.0013`), after we fixed a `bfloat16` backward reduction `NaN` with an explicit `fp32` column sum. Over three paired 1,500-step seeds, the gain completely vanished.
3. **Sparse Loopback Attention (`+0.0006` worse and `+3.13 s` slower on 8×H100 — killed).** Allowing later layers to attend back to earlier layer activations sounded like a natural lightweight loop, so we even wrote a custom **1-pass fused Triton forward+backward kernel** to eliminate extra memory traffic. Even fully fused on 8×H100, it added **+3.13 seconds** and slightly hurt loss (`3.2773` vs `3.2767`). Why? `#406` already has `x0` residual gates, value skips, and dense cross-layer mixing (`MUDD`), leaving almost no untapped cross-layer signal.
4. **Sub-Top Feedback (`−0.0034` better across 3/3 seeds on 1×H100 — promoted to 8×H100!).** Inspired by Xiong et al.'s [*Don't feed back the last block*](https://xjxyys.github.io/blog/feedback-source/) (Nov 2026), we run a fast, no-gradient **Pass 1** through layers `0..8`, take the *sub-top* representation `h₈` (one layer below the output head), pass it through a zero-initialized linear projection, and inject it into **Pass 2** right after the initial `x0` skip anchor:

```python
# Conceptual Sub-Top Feedback (L=9): Pass 1 refines Pass 2 using the same weights
if step >= subtop_start_step:
    with torch.no_grad():
        h_subtop = run_layers_0_to_8(x_in)           # Pass 1 (no grad, 9 layers)
    x_pass2 = x_pass2 + scale * fb_proj(h_subtop)    # Inject post-x0, keep x0 pure
out = run_layers_0_to_10(x_pass2)                    # Pass 2 (full 11 layers + grad)
```

Two early 1×H100 lessons made this work: injecting *before* the `x0` skip corrupted the shared embedding space (`+0.098` blowup!), and stopping Pass 1 earlier at layer `6` or `7` completely destroyed the gain (`+0.0021` / `+0.0025`). Only the true sub-top layer (`L=9`) delivered a clean **`3/3`-seed win** (`−0.00339 ± 0.00116`, paired `t = −5.06`).

## Plot twist #1 on 8×H100: the `TailAverages` ambush

Confident from the 3-seed 1×H100 result, we snagged an `8×H100 SXM5` node (`NV18` NVSwitch) on RunPod and ran Sub-Top Feedback turning on during the final taper stage (`step 974` of `1,053`) — expecting a surgical loss drop with only `+0.49 s` of extra compute.

Instead, validation loss **exploded by `+0.0179`** (`3.2946` vs `3.2767`), and repeated at `+0.0069` on a second seed.

What happened? On 1×H100 we evaluated the *final* model weights directly. On 8×H100, `#406` evaluates **`TailAverages`** — a running average of the final **298 steps (`755..1053`)**. By turning Sub-Top Feedback on at step `974`, **73% of the averaged backbone weights had trained with zero feedback**, while the new feedback projection itself wasn't averaged at all. Evaluation was feeding a live feedback signal into a mostly unlooped averaged model!

To prove the diagnosis, we swept the onset step earlier so Sub-Top Feedback would cover more of — and then **100% of** — the 298-step `TailAverages` window:

- **`START = 974` (79 active steps, hot):** `3.2946` (**`+0.0179`**, severe eval shock)
- **`START = 974` (79 active steps, mid):** `3.2763` (`−0.0004`, barely moving)
- **`START = 848` (205 active steps):** `3.2732` (**`−0.0035`**)
- **`START = 595` (458 active steps — 100% of `TailAverages`):** **`3.2679`** (**`−0.0088`** better than `#406` — and reproduced on our profiler run at **`3.2686`**!)

That is a massive, reproducible sample-efficiency improvement right at the `3.28` frontier — with zero extra backbone parameters.

## Plot twist #2: better loss, 2× too slow on the stopwatch

<div style="width: 100%; max-width: 1200px; margin: 0 auto 25px auto;">
<img src="./think-twice-stopwatch.jpg" alt="Simple two-card visual comparing a 1-pass Standard Transformer (#406: 30.1 s, ~0.20 s per 0.001 loss gain) against a 2-pass Looped Transformer (Sub-Top: better loss 3.268 at 33.7 s, ~0.41 s per 0.001 loss gain — 2x slower on wall-clock speed)" style="width: 100%; height: auto; display: block; border-radius: 8px;" />
</div>

Here is the catch that killed the world-record bid. Look at the full paired `8×H100` scoreboard (every run `1,053` steps on the exact same node):

<div style="width: 100%; max-width: 1200px; margin: 0 auto 25px auto;">
<img src="./looped-pareto-chart.png" alt="Two-panel editorial chart of all 8×H100 runs: Left panel plots validation loss against wall-clock time showing Sub-Top onset 974 to 848 to 595 dropping loss to 3.2679 (−8.8 mnats) while falling off the 1-pass #406 frontier; Right panel compares wall-clock cost per millinat gained: 167–239 ms/mnat for 1-pass #406 vs 408 ms/mnat for Sub-Top 595, 466 ms/mnat for Sub-Top 848, and 1,225 ms/mnat for Sub-Top 974" style="width: 100%; height: auto; display: block; border-radius: 8px;" />
</div>

| Run | Config | Wall Time | Validation Loss | Δ Loss vs `#406` | Extra Time / `0.001` Loss | GPU Energy (NVML) |
|---|---|---:|---:|---:|---:|---:|
| `#406` baseline (cold, `s42`) | 1-pass standard | `30.35 s` | `3.2767` | baseline | `167–239 ms` *(ref)* | `39.9 Wh` |
| `#406` baseline (warm, `s43`) | 1-pass standard | **`30.12 s`** | `3.2796` | — | `167–239 ms` *(ref)* | `43.2 Wh` |
| Sub-Top `START=974` (hot) | `L=9`, late onset | `31.54 s` | `3.2946` | `+0.0179` | shock | `44.6 Wh` |
| Sub-Top `START=974` (mid) | `L=9`, late onset | `31.02 s` | `3.2763` | `−0.0004` | `1,225 ms` | `44.5 Wh` |
| Sub-Top `START=848` | `L=9`, 205 active st | `31.75 s` | `3.2732` | `−0.0035` | `466 ms` | `46.0 Wh` |
| **Sub-Top `START=595`** | **`L=9`, 458 active st** | `33.71 s` | **`3.2679`** | **`−0.0088`** | **`408 ms`** | `46.1 Wh` |
| Sub-Top `START=595` (repro) | Same + CUPTI trace | `33.95 s` | **`3.2686`** | **`−0.0081`** | repro | — |
| Fused Loopback Attn | Custom Triton kernel | `33.25 s` | `3.2773` | `+0.0006` | regressed | `44.7 Wh` |

On this 8×H100 setup, simply running extra 1-pass `#406` steps near `3.28` buys `0.001` of validation loss for roughly **`167–239 ms`**. Even at its strongest operating point (`START=595`, `−0.0088` loss), Sub-Top Feedback's 9-layer Pass 1 added `+3.59 s` — costing **`408 ms` per `0.001` of loss**, or **`1.7×–2.4×` slower than standard 1-pass training** (and burning `46.1 Wh` vs `43.2 Wh`).

Why? Because `#406` is already **compute-saturated** on H100s. When every GPU core is already busy, doing an extra 9-layer Pass 1 (~`+7.8 ms/step`) has to deliver nearly twice the learning per FLOP to pay for itself in wall-clock time. Sub-Top Feedback is a genuine win if you are **parameter-constrained** or **data-constrained** — just not if you are racing a 30-second stopwatch on 8×H100.

Once that ratio was crystal clear across three onset points (`1,225 → 466 → 408 ms`), we stopped and skipped the ~$20 12-run certification run.

### Where this sits relative to previous record attempts (estimated)

We did not re-run earlier PRs on today's `EUR-NO-2` node, so this is a **cross-node estimate** anchored by our paired `#406` runs (`29.90 s` on yesterday's certification node vs `30.12 s` warm on today's node — a `+0.74%` node-speed offset):

| Attempt / Variant | Normalized to `29.90 s` node | Validation Loss | vs `#406` (`29.90 s`) | Basis |
|---|---:|---:|---:|---|
| **`#407 / #406` (Attempt #3, Nov 22)** | **`29.90 s`** | `3.2778` | baseline | measured (12 runs) |
| `#404` (`@caraxesml`, Nov 19) | `30.05 s` *(30.25 s GKE)* | `3.2795` | `+0.15 s` | measured (interleaved) |
| `#397 / #396` (Attempt #2, Oct 31) | `30.58 s` *(30.67 s PR)* | `3.2786` | `+0.68 s` | measured (same node) |
| `#393` (`@francesco-prignano`, Oct 25) | `31.29 s` | `≤ 3.28` | `+1.39 s` | reported PR time |
| **Sub-Top `START=595` (early-stop est. at `3.278`)** | **`~31.4–32.0 s`** | *`~3.278` (est.)* | **`+1.5 to +2.1 s`** | **estimated** (giving back `−0.0088` @ `167–239 ms/0.001`) |
| **Fused Loopback Attn (`1,053` st)** | **`~33.01 s`** | `3.2773` | **`+3.11 s`** | **estimated** (node-scaled from `33.25 s`) |
| **Sub-Top `START=595` (full `1,053` st)** | **`~33.47 s`** | **`3.2679`** | **`+3.57 s`** | **estimated** (node-scaled from `33.71 s`) |
| `#391` (Attempt #1, Oct 18) | `34.86 s` | `≤ 3.28` | `+4.96 s` | reported PR time |

Even if we cut `Sub-Top START=595` short to spend its entire `−0.0088` loss surplus and stop right at `3.278`, it would still land around **`~31.4–32.0 s`** — faster than my first attempt (`#391`, `34.86 s`), roughly near `#393` (`31.29 s`), and still **0.8–2.1 seconds behind `#396`, `#404`, and `#406`**. That shows just how tight the sub-31-second regime has become: a 3-second architectural overhead wipes out a full month of systems gains.

## Inside the GPU profiler: what *does* have room left

Before shutting down the 8×H100 node, we captured full Rank-0 **NVIDIA CUPTI** traces across all three training stages — including **Stage 3 Taper** (`steps 980..983`), where the model switches to full 50,304-token softmax. Rendering that exact `.json.gz` trace locally on macOS shows both why Pass 1 was too expensive *and* where the real remaining wall-clock savings live:

<div style="width: 100%; max-width: 1200px; margin: 0 auto 25px auto;">
<img src="./cupti-stage3-timeline.png" alt="Real NVIDIA CUPTI multi-stream GPU timeline of one Stage 3 Taper training step on Rank 0 H100, showing Pass 1 Sub-Top Loop, Pass 2 Forward, Full-Softmax lm_head and cplm_ce loss (~6.2 ms), Backward and MoE, and NCCL multi-GPU communication streams (ReduceScatter, n-gram all_to_all, and AllGather totaling 9.66% of GPU time)" style="width: 100%; height: auto; display: block; border-radius: 8px;" />
</div>

Two clear systems targets — plus visual proof of why looping couldn't hide — jump straight off the Stage 3 trace for a future sub-29.5 s attempt:

1. **Compute Stream 7 is `96.4%` busy**, with Pass 1's 9-layer loop eating a solid **`7.1 ms`** block right before Pass 2 (`8.9 ms`). There is essentially zero idle gap for a second pass to hide behind.
2. **Stage 3 full-softmax head + loss (`lm_head` fwd/dX/dW + `cplm_ce`) takes `8.44 ms/step` (`16.2%` of all Stage 3 kernel time):** `6.6 ms` for forward + cross-entropy + input gradient (`dX`), plus `2.1 ms` for `lm_head` weight gradient (`dW`) and `1.5 ms` of transpose copies right before it.
3. **Multi-GPU communication is `9.66%` of Stage 3 GPU time (`5.03 ms/step` raw NCCL):** led by gradient `ReduceScatter` (`7.89 ms / 4 steps`), every-4th-step n-gram embedding **`all_to_all`** (`7.04 ms / 4 steps`, pushing step 983 to `51.9 ms` vs `47.6 ms`), and weight `AllGather` (`4.72 ms / 4 steps`).

<div style="width: 100%; max-width: 1200px; margin: 0 auto 25px auto;">
<img src="./next-targets-roadmap.jpg" alt="Colorful three-card closing roadmap from the Stage 3 CUPTI trace showing where the next second (29.90 s toward ~29.0 s) is hiding: 16.2% Full-Softmax Head (8.4 ms/step), 9.7% Multi-GPU Chatter (5.0 ms/step), and 96.4% full compute stream leaving zero idle slack for extra loop passes" style="width: 100%; height: auto; display: block; border-radius: 8px;" />
</div>

So today didn't break 29.90 s — but we came away with a reproducible `−0.0088` looped-transformer finding, a sharp lesson about how `TailAverages` interacts with late-stage architectural changes, and a microsecond-level Stage 3 profiler map showing where the next real speedups are hiding.

<div style="background-color: #f0f7ff; border-left: 5px solid #007bff; padding: 15px; margin-top: 25px; margin-bottom: 20px;">

**ℹ️ How this experiment was run**

Built on top of yesterday's [PR #406](https://github.com/KellerJordan/modded-nanogpt/pull/406) (`e233546`) — full ablation code, Sub-Top Feedback, and fused Triton kernels are available on my public fork branch [`atveit/modded-nanogpt` (`attempt/wr4-looped-inspired`)](https://github.com/atveit/modded-nanogpt/tree/attempt/wr4-looped-inspired) (intentionally not opened as an upstream PR since it does not beat 29.90 s). Created with Google [Antigravity](https://antigravity.google/) and parallel Gemini agents for kernel implementation, 1×H100 multi-seed screening (~$9 total on RunPod), 8×H100 SXM5 validation + 10 Hz NVML power telemetry + 3-stage CUPTI profiling, and local macOS trace visualization.

Every run is reported — winners, dead ends, and the `TailAverages` blowup — and both GPU pods were terminated immediately after capturing the Stage 3 profiler trace.

**Key credit & further reading**
- **Sub-Top Feedback (our most promising result, `−0.0088`):** Xiong et al. (Nov 16, 2026), [*Don't feed back the last block*](https://xjxyys.github.io/blog/feedback-source/) — demonstrated that feeding back a sub-top hidden state (`h₈`) instead of the final layer unlocks substantial validation-loss gains without extra backbone parameters, even when enabled late in training.
- **Other tested inspirations:** Fishman et al. (NVIDIA, Nov 2026), [*Dory1.0-4B: A Looped Normalized-GPT*](https://arxiv.org/abs/2611.03998) ([Hugging Face](https://huggingface.co/collections/nvidia/nemotron-labs-dory)); Ouyang et al. (Nov 2026), *Loopback Transformer: Towards a Unified View of Residual Looped Transformers*.
- **Looped Transformer lineage & recent releases:** Dehghani et al., [*Universal Transformers*](https://arxiv.org/abs/1807.03819) (2018); Fan et al. (Facebook AI Research), [*Feedback Transformer*](https://arxiv.org/abs/2002.09402) (2020–2021); Giannou et al., [*Looped Transformers as Programmable Computers*](https://arxiv.org/abs/2301.13196) (ICML 2023); ByteDance, [*Ouro*](https://arxiv.org/abs/2510.25741) (2025); Thinking Machines Lab, [*Inkling 2 Mini*](https://thinkingmachines.ai/news/inkling-2-mini/) (Nov 2026); Z.ai / Zhipu, *GLM-5.4* (Nov 2026); and Jay Mody's [*picoGPT*](https://github.com/jaymody/picoGPT).

</div>

## Appendix: Turning picoGPT into a Looped Transformer

Jay Mody's [picoGPT](https://github.com/jaymody/picoGPT) implements a complete GPT-2 forward pass in ~40 lines of pure NumPy (`gpt2_pico.py`). Starting from the 4-line diff in the intro, here are the two real-world looped variants discussed in this post written in the same minimal NumPy style:

### 1. Middle-block loop (Inkling 2 Mini / GLM-5.4 style)

Production looped models usually keep a few unique **prelude** layers at the bottom and **coda** layers at the top, and loop only the shared **middle** block `n_loops` times:

```python
def gpt2_middle_loop(inputs, wte, wpe, prelude, middle, coda, ln_f, n_head, n_loops=3):
    x = wte[inputs] + wpe[range(len(inputs))]

    for block in prelude:                        # 1. entry layers (run once)
        x = transformer_block(x, **block, n_head=n_head)

    for _ in range(n_loops):                     # 2. shared middle stack (looped!)
        for block in middle:
            x = transformer_block(x, **block, n_head=n_head)

    for block in coda:                           # 3. exit layers (run once)
        x = transformer_block(x, **block, n_head=n_head)

    x = layer_norm(x, **ln_f)
    return x @ wte.T
```

### 2. Sub-Top Feedback (the `−0.0088` variant we tested on 8×H100)

Instead of feeding the raw top layer back into Layer 0, **Sub-Top Feedback** stops Pass 1 one layer below the top (`blocks[:-1]`), normalizes and linearly projects that *sub-top* representation (`W_fb`, initialized to zero), adds it into the Pass 2 input, and then runs the full stack:

```python
def gpt2_subtop_feedback(inputs, wte, wpe, blocks, ln_f, n_head, W_fb, scale=0.25):
    x0 = wte[inputs] + wpe[range(len(inputs))]

    # Pass 1: run up to the sub-top layer (no gradient during training)
    h = x0
    for block in blocks[:-1]:
        h = transformer_block(h, **block, n_head=n_head)

    # Inject projected sub-top representation into Pass 2 (keeping x0 untouched)
    h_norm = h / (np.sqrt(np.mean(h**2, axis=-1, keepdims=True)) + 1e-6)
    x = x0 + scale * (h_norm @ W_fb)

    # Pass 2: full forward pass reusing the exact same weights
    for block in blocks:
        x = transformer_block(x, **block, n_head=n_head)

    x = layer_norm(x, **ln_f)
    return x @ wte.T
```

*(Note: you cannot simply drop `n_loops=2` onto an already-trained standard GPT-2 checkpoint and expect lower loss — the model has to be **trained** with the loop active so Layer 0 learns what looped activations look like, which is the same distribution mismatch we ran into with `TailAverages` above.)*

Best Regard,  
Amund
