LLM Architecture

Why Adaptive Halting Is Hard to Train: From ACT to PonderNet

Contents
  1. 1. How ACT Works and Why Its Gradients Break at the Threshold
  2. 2. Jensen's Inequality and Intermediate-State Cancellation
  3. 3. PonderNet's Variational Objective and Prior Design
  4. References

Adding per-token adaptive halting to a looped Transformer (see Why Transformers Can Loop: Orthogonal Residual Streams and Circuit Depth) promises to let routine function words exit early while reserving deep recurrence for multi-step deduction—yet immediately hits a contradiction with backpropagation. As soon as a token executes if h_t > tau: stop, the integer halting step $N$ has zero derivative almost everywhere with respect to the gating parameters, cutting off gradient flow to the decision boundary.

The Universal Transformer (Dehghani et al., 2018) inherited Adaptive Computation Time (ACT) from Graves (2016), attempting to smooth discrete halting via cumulative probability sums and remainders, but still left zero-gradient steps, threshold jumps, and state-blending cancellation intact. PonderNet (Banino et al., 2021) later formulated halting depth as a discrete latent variable under a geometric prior with an expected per-step loss, yielding smooth gradients—though unaligned token depths still collide with GPU batching constraints (analyzed in Why Token Skipping Fails on GPUs: The Roofline Ridge, MoD, CDB, and Null Experts).


1. How ACT Works and Why Its Gradients Break at the Threshold#

Suppose after each recurrent step $t$ we produce a hidden vector $H^{(t)} \in \mathbb{R}^d$ and evaluate a scalar halting logit $h_t = \sigma(w_h^\top H^{(t)} + b_h) \in (0, 1)$. Implementing if h_t > tau: stop directly severs the dependency between the returned hidden state and the halting weights: as long as the discrete halting index $N$ stays fixed under an infinitesimal perturbation, gradients with respect to $(w_h, b_h)$ vanish identically almost everywhere.

ACT attempts to make halting differentiable through cumulative prefix sums and a remainder term. Given a hard step cap $T_{\max}$ and small tolerance $\epsilon \in (0, 1)$ (such as $0.01$), ACT injects time and position embeddings into the recurrent input, $H_{\text{in}}^{(t)} = H^{(t-1)} + P^t$. The Universal Transformer (Dehghani et al., 2018) uses additive 2D sinusoidal embeddings over token position $p$ and recurrent step $t$:

$$\begin{aligned} P^t_{p, 2i} &= \sin\!\left(\frac{p}{10000^{2i/d}}\right) + \sin\!\left(\frac{t}{10000^{2i/d}}\right), \\ P^t_{p, 2i+1} &= \cos\!\left(\frac{p}{10000^{2i/d}}\right) + \cos\!\left(\frac{t}{10000^{2i/d}}\right) \end{aligned}$$

Halting scores are then accumulated until crossing $1 - \epsilon$:

$$N = \min\{ n \le T_{\max} \mid \sum_{t=1}^n h_t \ge 1 - \epsilon \}, \quad R = 1 - \sum_{t=1}^{N-1} h_t$$

Why does ACT accumulate scores additively instead of comparing each step $h_t > \tau$ independently? Two constraints drive that choice:

Across tokens in a sequence, the Universal Transformer handles ragged halting via frozen states: if an easy function word such as "the" halts at step 1, its hidden vector freezes in place, yet a harder token such as "bank" continuing to steps 2 and 3 still attends to "the"'s frozen representation in Self-Attention, keeping cross-token context intact.

To make the coefficients sum exactly to one while discarding excess halting probability mass from the final step, ACT defines the scalar ponder penalty $\rho$ and mixed hidden representation $H_{\text{out}}$ as:

$$\begin{aligned} \rho &= N + R = N + 1 - \sum_{t=1}^{N-1} h_t, \\ H_{\text{out}} &= \sum_{t=1}^{N-1} h_t H^{(t)} + R H^{(N)} \end{aligned}$$

Original figure (Graves, 2016, Fig. 2): RNN computation graph with Adaptive Computation Time (ACT) halting units and convex state/output mixing across steps (arXiv:1603.08983).
Figure 1: RNN computation graph with Adaptive Computation Time (ACT) halting units and convex state/output mixing across steps (arXiv:1603.08983). (Source: Graves, 2016, Fig. 2)

Mapping Graves's RNN symbols onto Transformer notation makes the control flow clear: input $x_t$ enters through $W_x$ into ponder step states $s_t^1, \dots, s_t^N$ advanced vertically by transition operator $\mathcal{S}$, while $W_h$ emits halting scores $h_t^n$ and $W_y$ emits step outputs $y_t^n$ blended into $s_t$ and $y_t$. In a Looped Transformer, the horizontal axis $t$ becomes parallel sequence position $p$ coupled via Self-Attention, $s_t^n$ becomes token hidden vector $H^{(n)}$, $h_t^n$ maps to scalar halting gate $h_n$, and $\mathcal{S}$ is the shared Transformer block.

Testing this rule on a concrete three-step trace illustrates the mechanics. Suppose $h = [0.40, 0.40, 0.50]$; for simple arithmetic we evaluate the boundary $\epsilon \to 0$ (threshold $1 - \epsilon = 1.0$; in practice $\epsilon > 0$, such as $0.01$, ensures a single confident step $h_1 = 0.995$ can halt at $N = 1$). Running prefix sums give $0.40$ at step 1, $0.80$ at step 2, and $1.30 \ge 1.0$ at step 3. Halting therefore triggers at $N = 3$ with remainder $R = 1 - (0.40 + 0.40) = 0.20$, producing the blended state $H_{\text{out}} = 0.40 H^{(1)} + 0.40 H^{(2)} + 0.20 H^{(3)}$ and compute penalty $\rho = 3 + 0.20 = 3.20$.

Notice why Graves added $+R$ instead of penalizing $N$ alone: if $h_1$ is nudged from $0.40 \to 0.41$, the discrete count $N=3$ stays completely flat, whereas $\rho = N + R$ drops smoothly from $3.20 \to 3.19$, giving early steps $t < N$ a nonzero gradient of $-1$ inside $\mathcal{L}_{\text{ACT}} = \mathcal{L}_{\text{task}}(H_{\text{out}}) + \tau \rho$.

At first glance $R$ and $H_{\text{out}}$ appear smoothly differentiable. Substituting $R = 1 - \sum_{t=1}^{N-1} h_t$ back into $\rho$ and $H_{\text{out}}$ and computing partial derivatives immediately exposes a structural discontinuity: once the halting step $N$ is selected, $h_N$ itself vanishes completely from both $R$ and the blended output:

$$\begin{aligned} \frac{\partial \rho}{\partial h_t} &= -1 \;\; (t < N), & \frac{\partial H_{\text{out}}}{\partial h_t} &= H^{(t)} - H^{(N)} \;\; (t < N), \\ \frac{\partial \rho}{\partial h_N} &= 0, & \frac{\partial H_{\text{out}}}{\partial h_N} &= 0 \end{aligned}$$

Two optimization failures follow directly from these derivatives:

  1. Zero gradient on the decisive halting step $N$: Even though $h_N$ is the exact probability mass that pushed the prefix sum across $1 - \epsilon$, neither the compute penalty $\tau \rho$ nor the task loss through $H_{\text{out}}$ sends any gradient back to $h_N$. Meanwhile, the regularization term pushes $\partial \rho / \partial h_t = -1$ on every preceding step $t < N$, uniformly inflating early halting probabilities.
  2. Macroscopic jump discontinuities at threshold crossings: Whenever an optimization update nudges $S_{N-1} = \sum_{t=1}^{N-1} h_t$ from $1 - \epsilon - \delta$ to $1 - \epsilon + \delta$, the integer step count drops discontinuously from $N$ to $N - 1$. The remainder jumps from $R_{\text{old}} = 1 - S_{N-1} = \epsilon + \delta$ to $R_{\text{new}} = 1 - S_{N-2} = h_{N-1} + \epsilon - \delta$, causing $\rho$ to undergo an abrupt step discontinuity of size $1 - h_{N-1}$ while $H_{\text{out}}$ drops all weight on $H^{(N)}$ and suffers a discrete $\mathcal{O}(\epsilon)$-scale jump. This makes ACT brittle under changes to the ponder weight $\tau$ (e.g. $10^{-3}$ vs. $5\times 10^{-3}$), frequently collapsing to minimal steps or saturating at $T_{\max}$.
ACT Control Flow: Loop-Back Originates From Decision Diamond to Input Adder State H⁽ᵗ⁻¹⁾ Coords Pᵗ + Block T_θ H⁽ᵗ⁾ Blended Output (Explicit N−1 Sum + Remainder) H_out = Σ(t=1..N−1) hₜH⁽ᵗ⁾ + R H⁽ᴺ⁾ h=[0.4, 0.4, 0.5] → N=3, R=0.2, ρ=3.20 hₜ = σ(wₕᵀH⁽ᵗ⁾+b) Σh ≥ 1−ε No: Continue Loop (Σh < 1−ε) Yes Remainder R = 1 − Σ hₜ ∂ρ/∂h_N = 0 and ∂H_out/∂h_N = 0 (triggering gate gets zero direct gradient)
Figure 2: ACT control flow with loop-back routing from the halting threshold diamond back to the input adder.
Calculation

Numerical Check: The $-0.502$ Threshold Cliff: Set $\epsilon = 0.01$ (halting threshold $1 - \epsilon = 0.99$). With $h = [0.489, 0.50, 0.50]$, the two-step prefix sum is $S_2 = 0.989 < 0.99$, so halting waits until $N = 3$ with remainder $R = 1 - 0.989 = 0.011$ and total penalty $\rho = 3 + 0.011 = \mathbf{3.011}$. Nudging $h_1$ up by just $+0.002$ to $h = [0.491, 0.50, 0.50]$ pushes $S_2 = 0.991 \ge 0.99$, dropping $N$ to $2$ with $R = 1 - 0.491 = 0.509$ and teleporting $\rho$ down to $\mathbf{2.509}$—a $\Delta \rho = \mathbf{-0.502}$ cliff from a $+0.002$ weight nudge.

A secondary limitation arises from additive step encodings ($H_{\text{in}}^{(t)} = H^{(t-1)} + P^t$): when unrolling beyond the training horizon $T_{\max}$ at inference time, repeated additions of unseen sinusoidal step vectors accumulate amplitude drift inside the residual stream. Under careful hand-tuning of $\tau$ on controlled benchmarks, ACT can still display interpretable depth allocation—for instance, on synthetic bAbI QA stories below, irrelevant background statements halt in 1 step while supporting facts and the final question receive 3–5 iterations.

Original figure (Dehghani et al., 2018, Fig. 3): Universal Transformer dynamic halting ponder time across story sentences and the final query in bAbI, allocating 1 step to routine statements and 3–5 steps to supporting facts (arXiv:1807.03819).
Figure 3: Universal Transformer dynamic halting ponder time across story sentences and the final query in bAbI, allocating 1 step to routine statements and 3–5 steps to supporting facts (arXiv:1807.03819). (Source: Dehghani et al., 2018, Fig. 3)

2. Jensen's Inequality and Intermediate-State Cancellation#

A subtler defect in ACT comes from evaluating the task loss only once on the weighted mixture $H_{\text{out}}$, rather than scoring each recurrent step individually. Because intermediate states are blended before decoding, individual passes face no direct incentive to represent calibrated next-token predictions on their own; opposite errors across steps can cancel linearly before the loss is ever measured.

Caveat

Pitfall: Intermediate-State Cancellation Under State Blending: Consider a scalar target $y = 0$ under squared error $\mathcal{L}(\hat{y}, y) = (\hat{y} - y)^2$ with uniform step weights $p_1 = p_2 = 0.5$. Suppose step 1 outputs an extreme error $\hat{y}_1 = +10$ and step 2 outputs the opposite extreme $\hat{y}_2 = -10$. Scoring after blending (as in ACT) sees $\bar{y} = 0.5(+10) + 0.5(-10) = 0$, giving zero task loss ($\mathcal{L}_{\text{ACT}} = \mathbf{0}$) and zero corrective gradient despite both steps being wildly wrong—whereas scoring each step before averaging yields $0.5 \times 10^2 + 0.5 \times (-10)^2 = \mathbf{100}$.

Expanding the gap between expected step loss and blended-output loss for any normalized distribution $\{p_t\}_{t=1}^N$ ($\sum_{t=1}^N p_t = 1$) under linear readout $\hat{y}_t = W_u H^{(t)}$ with mean prediction $\bar{y} = \sum_{t=1}^N p_t \hat{y}_t$ yields an exact bias–variance identity via Jensen's inequality:

$$\begin{aligned} &\underbrace{\sum_{t=1}^{N} p_t (\hat{y}_t - y)^2}_{\mathrm{Bias}^2 + \mathrm{Var}} \;-\; \underbrace{\left(\sum_{t=1}^{N} p_t \hat{y}_t - y\right)^2}_{\mathrm{Bias}^2} \\ &\quad= \sum_{t=1}^{N} p_t \hat{y}_t^2 - 2y\bar{y} + y^2 - (\bar{y}^2 - 2y\bar{y} + y^2) \\ &\quad= \sum_{t=1}^{N} p_t (\hat{y}_t - \bar{y})^2 = \mathrm{Var}_{p}(\hat{y}_t) \ge 0 \end{aligned}$$

Blended-state losses constrain only the squared bias of the mixture while remaining blind to variance across steps. For next-token cross-entropy $\mathcal{L}_{\text{CE}}$, mixing step probabilities $p_{\text{mix}} = \sum p_t\,\mathrm{softmax}(\hat{y}_t)$ preserves convexity via Jensen's inequality ($\mathbb{E}_{p}[\mathcal{L}(\hat{y}_t)] \ge \mathcal{L}(\mathbb{E}_{p}[\hat{y}_t])$, with equality only when intermediate predictions agree), whereas blending raw logits before $\mathrm{softmax}$ inverts the bound through convex $-\log\mathrm{softmax}$ and creates a log-sum-exp lower bound instead.

Scoring every recurrent step independently and weighting by halting probability eliminates cross-step cancellation and enforces an anytime representation: every step $H^{(t)}$ can be reliably read out by the language model head if decoding terminates early.

Interactive · ACT Threshold Cliff vs. PonderNet Smooth Loss
ACT Remainder & Effective Step N N_active 3 R = 1 − Σ 0.020 Ponder ρ 3.02 PonderNet Markov Chain (λ_t=h_t) p₁ 0.450 p₂ 0.292 E[T] 1.81 ACT teleports N and ρ at h₁ + h₂ = 1 − ε (0.99) while ∂ρ/∂h_N = 0
Step 1 halt h₁ 0.45 Step 2 halt h₂ 0.53 Margin ε 0.01 h₁=0.45 + h₂=0.53 = 0.98 (< 0.99) → N=3, ρ=3.02
Figure 4: Nudge h₁ or h₂ across 1−ε=0.99 to observe ACT's step-function cliff in N and ρ versus PonderNet's smooth E[T].

3. PonderNet's Variational Objective and Prior Design#

PonderNet (Banino et al., 2021) replaces threshold remainders with a well-defined Markov halting process. At each iteration $t$, the halting head emits a conditional probability $\lambda_t = \sigma(w_h^\top H^{(t)} + b_h) \in (0, 1)$, interpreted as the probability of stopping at step $t$ given that computation reached step $t$ without halting earlier. Enforcing $\lambda_{N_{\max}} = 1$ at the hard boundary (folding any remaining survival mass into step $N_{\max}$) guarantees a normalized marginal halting distribution $p_n$ across $\{1, \dots, N_{\max}\}$:

$$p_1 = \lambda_1, \quad p_n = \lambda_n \prod_{j=1}^{n-1} (1 - \lambda_j), \quad \sum_{n=1}^{N_{\max}} p_n = 1$$

Unlike ACT's truncated prefix sums, every step $p_n$ is an explicit smooth product of $\lambda_1, \dots, \lambda_n$, leaving no step with an identically zero derivative and no discontinuous jump across step boundaries. In language modeling, each step's cross-entropy loss $\mathcal{L}_{\text{CE}}(\hat{y}_n, y)$ is produced by feeding $H^{(n)}$ into the same shared lm_head. Consider predicting "1643" from "Newton born in": at step 1, before multi-hop factual recall finishes, the shared lm_head might assign only 1% probability ($-\ln 0.01 \approx \mathbf{4.61}$); after deeper loop iterations align the entity attributes at step 3, probability rises to 90% ($-\ln 0.90 \approx \mathbf{0.11}$). Scoring every pass thus supplies direct step-by-step supervision for halting decisions.

Treating the halting index $n \in \{1, \dots, N_{\max}\}$ as a discrete latent variable with a bounded geometric prior $p_G(n; \lambda_p)$ (either renormalizing $\propto \lambda_p (1 - \lambda_p)^{n-1}$ over $1 \dots N_{\max}$ or folding remaining tail mass $(1-\lambda_p)^{N_{\max}-1}$ into $N_{\max}$) and variational posterior $q_\phi(n \mid x) = p_n$, applying Jensen's inequality to $-\log(\cdot)$ produces the negative evidence lower bound (ELBO):

$$\begin{aligned} &-\log p_\theta(y \mid x) \\ &\quad= -\log \sum_{n=1}^{N_{\max}} q_\phi(n \mid x)\, \frac{p_G(n; \lambda_p)\, p_\theta(y \mid x, n)}{q_\phi(n \mid x)} \\ &\quad\le \sum_{n=1}^{N_{\max}} q_\phi(n \mid x) \left[ -\log p_\theta(y \mid x, n) + \log \frac{q_\phi(n \mid x)}{p_G(n; \lambda_p)} \right] \\ &\quad= \underbrace{\sum_{n=1}^{N_{\max}} p_n \mathcal{L}_{\text{CE}}(\hat{y}_n, y)}_{\mathcal{L}_{\text{rec}}} \;+\; D_{\mathrm{KL}}\!\big(q_\phi(\cdot \mid x) \,\|\, p_G(\cdot; \lambda_p)\big) \end{aligned}$$

PonderNet: Top Per-Step Loss Track + Bottom Survival Chain → Negative ELBO Objective H⁽¹⁾ = T_θ(H⁽⁰⁾)ŷ₁ → L₁λ₁=0.2p₁=0.20H⁽²⁾ = T_θ(H⁽¹⁾)ŷ₂ → L₂λ₂=0.5p₂=0.40H⁽³⁾ = T_θ(H⁽²⁾)ŷ₃ → L₃λ₃=1.0p₃=0.40 λ_N = 1 guarantees Σpₙ = 1 Objective: Negative ELBO (Free Energy) L = Σ pₙ Lₙ + β · D_KL(q_φ ‖ p_G) Penalizes both Bias² and Step Variance p=[0.2, 0.4, 0.4], L=[10, 5, 0] → L_rec=4.0
Figure 5: PonderNet Markov halting survival chain and differentiable negative ELBO objective.

Scaling the KL regularizer by $\beta > 0$ gives the complete training loss $\mathcal{L}_{\text{Ponder}} = \mathcal{L}_{\text{rec}} + \beta \, D_{\mathrm{KL}}(q_\phi \| p_G)$. Differentiating $\mathcal{L}_{\text{rec}}$ with respect to any intermediate gate $\lambda_k$ ($k < N_{\max}$) produces an exact Bellman continuation contrast:

$$\frac{\partial \mathcal{L}_{\text{rec}}}{\partial \lambda_k} = \left(\prod_{j=1}^{k-1}(1 - \lambda_j)\right)\Big(L_k - \mathbb{E}[L_n \mid n > k]\Big)$$

where $L_k = \mathcal{L}_{\text{CE}}(\hat{y}_k, y)$. Halting at step $k$ is reinforced only when $L_k$ improves upon the expected future loss $\mathbb{E}[L_n \mid n > k]$; conversely, once an early gate drifts toward $\lambda_1 \to 1$, the survival prefix $\prod_{j<k}(1-\lambda_j)$ decays exponentially and causes deep-step gradient starvation on later gates $\lambda_k$.

Checking a 4-step numerical example with 3 learned gates $\lambda_{1:3} = [0.20, 0.50, 0.50]$, forced boundary $\lambda_4 = 1.0$, and step cross-entropy losses $[10, 5, 2, 1]$: the marginal halting weights are $p = [0.20,\; 0.40,\; 0.20,\; 0.20]$, yielding exact reconstruction loss $0.20\times 10 + 0.40\times 5 + 0.20\times 2 + 0.20\times 1 = \mathbf{4.60}$. Because PonderNet evaluates this expectation analytically over $\{1,\dots,N_{\max}\}$ rather than sampling a single discrete trajectory per forward pass as in REINFORCE, gradient variance remains low and stable.

Note

Training Unroll vs. Inference Halting (Banino Stochastic vs. Ouro CDF): During training, the loop unrolls all $N_{\max}$ steps and evaluates lm_head at every step to compute the exact analytical expectation $\mathcal{L}_{\text{rec}}$. During inference, the model evaluates only the lightweight scalar halting head $\lambda_t$ online and calls lm_head only ONCE at the exit step: Banino et al. (2021) sample $z_t \sim \mathrm{Bernoulli}(\lambda_t)$ stochastically at each step, whereas Ouro (Zhu et al., 2025) eliminates sampling variance by tracking the deterministic CDF $F_t = \sum_{j=1}^t p_j = 1 - \prod_{j=1}^t (1 - \lambda_j)$ and exiting as soon as $F_t \ge q_{\text{exit}}$.

Three subtleties govern how KL regularization and halting priors behave in practice across modern looped language models such as Ouro (Zhu et al., 2025) and Huginn (Geiping et al., 2025):

  1. Easy-token tie-breaking and keeping $\lambda_p$ fixed: On a trivial prompt like "1+1=?", step losses saturate near zero from pass 1 onward ($L_1 \approx L_2 \approx \dots \approx L_{N_{\max}}$), leaving $\mathcal{L}_{\text{rec}}$ indifferent between halting early or running to $N_{\max}$. The KL term $D_{\mathrm{KL}}(q_\phi \| p_G)$ breaks this tie in favor of shorter compute anchored around $1/\lambda_p$ (for example, $\lambda_p = 0.5$ targets $\approx 2$ steps, whereas $\lambda_p = 0.2$ targets $\approx 5$ steps). Making $\lambda_p$ trainable would cause $\nabla_{\lambda_p} D_{\mathrm{KL}}(q_\phi \| p_G)$ to drag the prior toward whatever collapsed distribution $q_\phi$ emits, erasing the compute anchor. With fixed $N_{\max}=2, \lambda_p=0.5$ (tail mass folded into step 2 so $p_G = [0.5, 0.5]$), a balanced posterior $[0.70, 0.30]$ incurs $D_{\mathrm{KL}} \approx \mathbf{0.082}$, whereas single-step collapse $[0.99, 0.01]$ drives the KL penalty up to $\mathbf{0.637}$.
  2. Two-stage warmup and Ouro's frozen-backbone exit-gate caveat: If $\beta$ starts too high, the halting head collapses to $N = 1$ before the shared core learns multi-step refinements; if $\beta$ is too small, easy tokens wastefully saturate at $N_{\max}$. In Ouro, Stage 1 pretraining applies an entropy-regularized uniform prior over depths so every recurrent step trains evenly, and Stage 2 freezes the language model backbone to train only the exit gate. Separating these stages prevents early-exit collapse during pretraining, at a clear cost: because the backbone is frozen in Stage 2, the exit gate can only read—not reshape—the learned step representations.
  3. Training budget-prior KL vs. inference convergence KL: Formally, $D_{\mathrm{KL}}(p \,\|\, q) = \sum_i p_i \ln(p_i / q_i)$. PonderNet compares halting steps against a fixed compute prior during training, whereas gate-free architectures such as Huginn require no ground-truth label y at test time and halt by checking consecutive vocabulary distributions $D_{\mathrm{KL}}(P_t \,\|\, P_{t-1})$. On a 3-token vocabulary, shifting from $P_2=[0.60, 0.10, 0.30]$ to $P_3=[0.95, 0.01, 0.04]$ gives $D_{\mathrm{KL}}(P_3 \| P_2) \approx \mathbf{0.333}$ (continue iterating), whereas moving from $P_3$ to $P_4=[0.951, 0.010, 0.039]$ gives $D_{\mathrm{KL}}(P_4 \| P_3) \approx \mathbf{1.31\times 10^{-5}}$ (converged, safe exit).
Left: Fixed Geometric Prior p_G(n; λ_p); Right: Early Collapse Cuts Deep-Step Gradients 1. Truncated Geometric Prior p_G(n; λ_p) λ_p = 0.5 (E≈2) λ_p = 0.2 (E≈5) n=1n=2n=3n=4n=5n=6 Keep λ_p fixed: learned λ_p chases early collapse 2. Survival Prefix ∏(1 − λⱼ) vs. Step k Balanced λⱼ = 0.25 Collapsed λ₁ = 0.90 1.0 0 k=1k=2k=3k=4k=5k=6 k≥3 grad < 5%: deep steps starve Ouro Stage 1 uses uniform prior + entropy reg
Figure 6: Truncated geometric prior λ_p anchoring expected compute steps, and deep-step gradient starvation under early collapse.

This runnable PyTorch snippet computes ACT's halting step $N$ and remainder $R$ dynamically in a 4-line loop, prints the -0.502 cliff as h[0] crosses 0.489 -> 0.491, and compares ACT's zero gradient at step $N$ against PonderNet's non-zero gradients across all three learned gates (see also David Louapre's interactive Looped Transformers Space):

PYTHON
import torch

def act_rho(h, eps=0.01):
    s = torch.zeros((), dtype=h.dtype)
    for idx, val in enumerate(h):
        if s.item() + val.item() >= 1.0 - eps:
            return (idx + 1) + (1.0 - s)
        s = s + val
    return len(h) + (1.0 - s)

r1 = act_rho(torch.tensor([0.489, 0.50, 0.50])).item()
r2 = act_rho(torch.tensor([0.491, 0.50, 0.50])).item()
print(f"cliff: {r1:.3f} -> {r2:.3f}, d={r2 - r1:.3f}")

h = torch.tensor([0.40, 0.40, 0.50], requires_grad=True)
act_rho(h, eps=0.0).backward()
print("ACT grad:", h.grad.tolist())

lam = torch.tensor([0.20, 0.50, 0.50], requires_grad=True)
s1, s2 = 1.0 - lam[0], (1.0 - lam[0]) * (1.0 - lam[1])
s3 = s2 * (1.0 - lam[2])
p = torch.stack([lam[0], s1 * lam[1], s2 * lam[2], s3])
(p * torch.tensor([10.0, 5.0, 2.0, 1.0])).sum().backward()
print("Ponder grad:", [round(g, 3) for g in lam.grad.tolist()])
MechanismGradient PathLoss AggregationTrain & Inference Overhead
ACT · 2016Prefix sum + $R$; $\partial/\partial h_N = 0$ & jumpsBlend before decode; permits $\mathrm{Var}_p$ cancelFragile $\tau$ tuning; additive pos drift
PonderNet · 2021Smooth chain $p_n = \lambda_n \prod_{j<n}(1-\lambda_j)$Expected step loss; anytime outputsUnrolls $N_{\max}$ at train; scalar $\lambda_t$ stops online & calls lm_head once
Convergence · HuginnTruncated BPTT (TBPTT); inference tracks $D_{\mathrm{KL}}(P_t \Vert P_{t-1})$No trained gate; logit stabilityInference runs lm_head per step; ragged batches
Original figure (Banino et al., 2021, Fig. 1): PonderNet vs. ACT accuracy and compute steps on parity interpolation (a), length extrapolation (b), and training convergence over total compute steps (c) (arXiv:2107.05407).
Figure 7: PonderNet vs. ACT accuracy and compute steps on parity interpolation (a), length extrapolation (b), and training convergence over total compute steps (c) (arXiv:2107.05407). (Source: Banino et al., 2021, Fig. 1)

All three panels quantify the practical separation: on parity interpolation (a), PonderNet hits ~97.4% accuracy in ~2.7 steps versus ACT's ~95.7% in ~3.1 steps; on unseen length extrapolation (b), PonderNet reaches ~93% accuracy while scaling up to ~5 compute steps, whereas ACT stalls at ~51% accuracy and ~2.1 steps; and on training convergence (c), PonderNet (blue) rises smoothly around ~7K–8K total compute steps, while ACT (green) hits a sharp ~11K step cliff jumping from ~0.2 to ~0.98 and wastes ~40K total compute steps.

Across recent LoopLMs, the practical divide between training a frozen-backbone exit gate (Ouro) and relying on gate-free divergence stopping (Huginn) turns on whether the halting head can reshape the backbone's internal compute allocation: a post-hoc exit gate only harvests whatever anytime quality pretraining left behind, and saving tokens dynamically only pays off if the runtime scheduler absorbs ragged exits without stalling synchronous GPU tensor cores—hardware tradeoffs formalized in Why Token Skipping Fails on GPUs: The Roofline Ridge, MoD, CDB, and Null Experts.


References#

  1. Alex Graves (2016). Adaptive Computation Time for Recurrent Neural Networks. arXiv:1603.08983
  2. Mostafa Dehghani et al. (2018). Universal Transformers. arXiv:1807.03819
  3. Andrea Banino, Jan Balaguer & Charles Blundell (2021). PonderNet: Learning to Ponder. arXiv:2107.05407
  4. Jonas Geiping et al. (2025). Scaling up Test-Time Compute with Latent Reasoning: A Recurrent Depth Approach (Huginn-0125). arXiv:2502.05171
  5. Rui-Jie Zhu et al. (2025). Scaling Latent Reasoning via Looped Language Models (Ouro). arXiv:2510.25741
  6. David Louapre. Looped Transformers (Interactive Exploration Space). huggingface.co/spaces/dlouapre/looped-transformers
Cite this note
@misc{liu2026adaptivehaltingact,
  title  = {{Why Adaptive Halting Is Hard to Train: From ACT to PonderNet}},
  author = {Feiyang Liu},
  year   = {2026},
  month  = {nov},
  url    = {https://zaychikliu.github.io/blog/2026/adaptive-halting-act-to-pondernet/}
}