kefirski.me
NeurIPSPaper 1620228 min read

PALBERT: Teaching ALBERT to Ponder

We turn PonderNet into a practical early-exit method for ALBERT: a deterministic Q-exit rule plus a dynamics-aware halting layer, outperforming PABEE across GLUE.

Why run all twelve layers every time

ALBERT reuses one transformer block: evaluation is hi=S(hi1)h_i = S(h_{i-1}), the same layer applied twelve times, with a classifier CC reading the final state. That weight sharing makes the model a recurrence in disguise, and for a recurrence the number of iterations is a choice, not a constant. Stopping early is architecturally free; the question is when.

Running to the end is not even always the best choice. Zhou and colleagues showed that stopping ALBERT-Base at ten iterations can beat all twelve on MRPC while prediction entropy keeps falling, a failure they call overthinking: more computation makes the model more confident, including in its mistakes. Their PABEE exits when several per-layer classifiers agree in a row. We wanted a mechanism that learns when to stop instead of voting.

Treat the exit layer as a latent variable

PonderNet, introduced by Banino and colleagues, treats the exit layer as a latent variable. After each iteration a small Lambda layer reads the hidden state and emits a halting probability λi=Λ(hi)\lambda_i = \Lambda(h_i), which induces a generalized geometric distribution over exit depths, p(ix)=λij<i(1λj)p(i\mid x)=\lambda_i\prod_{j<i}(1-\lambda_j). Training maximizes a variational lower bound on the likelihood:

L(x,y)=Eip(ix)[logp(yx,i)]βKL(p(x)p(λ))    logp(yx)L(x,y)=\mathbb{E}_{i\sim p(i\mid x)}\big[\log p(y\mid x,i)\big]-\beta\,\mathrm{KL}\big(p(\cdot\mid x)\,\big\|\,p(\cdot\mid\lambda)\big)\;\le\;\log p(y\mid x)

The KL term pulls the learned exit distribution toward a geometric prior with parameter λ\lambda, the knob that says how early exits should happen a priori; we use λ=0.1\lambda=0.1 and β=0.5\beta=0.5. We keep this training objective intact in PALBERT. What we change is everything around it: how the model decides to leave at inference time, and what the halting layer gets to see.

One pass through the pondering stack

Mechanism
Every iteration of the shared block feeds two heads: the classifier and the halting layer. Green marks our changes: the Lambda layer is a three-layer MLP with its own learning rate, and it reads the current and previous hidden states, so it can react to how the computation is moving.

Sampling wastes what the model knows

At inference, PonderNet samples: at each layer it flips a coin with probability λi\lambda_i. Even a well-trained model pays for that randomness, because λ1=0.1\lambda_1=0.1 still aborts at the first layer once in ten runs. Our cleanest evidence is a closed-form control that evaluates predictions in expectation over p(ix)p(i\mid x), removing sampling while changing nothing else: CoLA climbs from 50.8 to 55.9, and SST-2 from 91.1 to 92.3.

Q-exit makes the decision deterministic and keeps the early exit. We accumulate the exit distribution into its CDF, ikp(ix)\sum_{i\le k} p(i\mid x), and leave at the first layer where it crosses a threshold qq. Zero variance, and qq becomes an interpretable dial between underthinking and overthinking; q=0.5q=0.5 performed best across tasks in our sweeps.

Coin flips versus a threshold on the CDF

Exit criterion
A worked example with illustrative probabilities. Sampling scatters the exit depth across runs of the same input; Q-exit accumulates the same distribution and always stops at the first layer whose CDF clears q, never executing the layers past it.

We also rebuilt the halting layer itself. Whether to stop should depend on how the computation is moving, not only on where it is, so our Lambda layer reads the concatenation [hi,hi1][h_i, h_{i-1}] instead of hih_i alone, is a three-layer MLP with tanh\tanh activations rather than a single projection, and trains with its own learning rate.

Which change buys what

CoLA under each modification

Matthews correlation
plain fine-tuningPonderNet variantsour stepsfull PALBERT
CoLA under each modification CoLA Matthews correlation, mean over five seeds. Sampling costs PonderNet 6.2 points against plain ALBERT; evaluating in expectation recovers most of it but runs every layer. Q-exit recovers nearly as much while actually exiting early, and the rebuilt halting layer carries the full model past ALBERT. ALBERT: plain ALBERT 57.0 PonderNet: PonderNet sampling 50.8 expectation: closed-form expectation 55.9 Q-exit: Q-exit 55.7 + Λ LR: Q-exit plus Lambda learning rate 56.5 PALBERT: full PALBERT 57.4 015304560 57.0plain ALBERT: ALBERT, 57.0ALBERT50.8PonderNet sampling: PonderNet, 50.8PonderNetsampling exit55.9closed-form expectation: expectation, 55.9expectationno early exit55.7Q-exit: Q-exit, 55.7Q-exit56.5Q-exit plus Lambda learning rate: + Λ LR, 56.5+ Λ LR57.4full PALBERT: PALBERT, 57.4PALBERT Matthews correlation
CoLA Matthews correlation, mean over five seeds. Sampling costs PonderNet 6.2 points against plain ALBERT; evaluating in expectation recovers most of it but runs every layer. Q-exit recovers nearly as much while actually exiting early, and the rebuilt halting layer carries the full model past ALBERT.

The ablation stacks the same way on the other tasks: Q-exit alone recovers most of the sampling gap, the separate Lambda learning rate adds a little, and the dynamics-aware input pushes the full model to 92.9 on SST-2, 77.8 on RTE, and 57.4 on CoLA, ahead of PonderNet's 91.1, 73.5, and 50.8 everywhere, and ahead of plain ALBERT on RTE and CoLA.

Across GLUE, determinism pays

PABEE to PALBERT, task by task

GLUE dev score
PABEEPALBERT (ours)
92.7 93.1
SST-2
76.9 78.3
RTE
91.5 91.0
QNLI
55.6 58.1
CoLA
88.3 89.3
MRPC
84.5 84.7
MNLI
88.9 88.9
QQP
89.9 89.9
STS-B
GLUE dev scores. PALBERT wins or ties PABEE on seven of eight tasks, with the largest gains on the small datasets CoLA and RTE, where PABEE's independent per-layer classifiers starve for signal.

On dev macro across the eight tasks PALBERT reaches 84.2 against 83.5 for PABEE and 84.0 for plain ALBERT; on the test split it holds 80.6 against 79.3 and 80.3. The pattern transfers to RoBERTa: PRoBERTa's dev macro of 85.6 beats PABEE's 85.0, and on test 82.1 beats 81.3, with plain RoBERTa at 86.0 and 83.2.

PABEE struggles exactly where data is scarce. Its per-layer classifiers are independent, and on CoLA and RTE they simply do not get enough signal to train well; PABEE lands below even plain ALBERT there. Our shared classifier and shared halting layer reuse everything across depths, which is where we believe the small-data advantage comes from.

The prior is the price

The honest cost of the variational frame is the prior. The exit behavior a model learns tracks λ\lambda closely: sweeping it across 0.1, 0.15, 0.25, and 0.5 reshapes the exit histograms outright, and the metric-best RTE setting we found, λ=0.08\lambda=0.08, mostly exits at the last layer, which defeats the purpose. Choosing the prior is really choosing the behavior.

The same histograms indict sampling one more time: even when the learned distribution's mode is layer twelve, almost half of sampled runs would exit within the first ten layers. A deterministic read of the distribution is not a convenience; it is the difference between using what the model learned and gambling on it.

Two loose ends we state plainly. First, q=0.5q=0.5 works well without a theory of why. Second, a PALBERT forced to always exit at layer twelve still beats vanilla ALBERT on SST-2, so part of our gain is the auxiliary per-layer supervision rather than early exiting itself. We suspect the next step is a trainable stopping rule that does not lean on an explicit prior at all.

Treating the exit layer as a latent variable works once the exit decision stops being a coin flip; the prior over depths is now the part that needs rethinking.