Eight tied-weight steps cut Reddit perplexity from 26.2 to 22.6

Staircase Attention for Recurrent Processing of Sequences

Da Ju, Stephen Roller, Sainbayar Sukhbaatar, Jason Weston

cs.LG, cs.CL

2021-06-08

One shared Transformer core, looped in time or depth. At 117M params and 8 steps, Reddit test ppl falls from 26.2 to 22.6; state-tracking tasks a Transformer fails are solved.

What problem this solves

A Transformer runs a fixed stack of self-attention over the whole sequence. Each update moves a hidden state up one layer, so in an L-layer model that state is rewritten at most L times and then drops out of later computation. Tasks that must revise an internal state for hundreds of steps, such as tracking an agent or executing a short program, break this feedforward pattern. Transformer-XL keeps a cache of earlier segments to extend context, but it does not run new computation on that old state. The Feedback Transformer adds step-by-step recurrence, yet its step is a single token, so training loses parallelism and gets slow.

Two knobs are separate. Recurrence in time lets the state be rewritten without a layer cap. Recurrence in depth reapplies the same weights, so the parameter count stays fixed while effective depth grows.

Method

Staircase splits the input into chunks of C tokens. Each step ingests one new chunk and runs one shared Transformer core on N chunks in parallel. Only the newest chunk is a fresh embedding. The other N−1 chunks are backward tokens carried over from the previous step, the recurrent memory. Every token passes through that core N times before the output head. Raising N adds nonlinearities without adding parameters. Because the window advances only C tokens per step, information can travel to the end of the sequence, and computation depth scales with length instead of with L. The memory lives across many token vectors, so it can hold more than an RNN's single state vector, and attention stays parallel.

Cached Staircase separates how far the model can look from how much it recomputes. With M < N, a state freezes after M passes. It then appears only as keys and values in self-attention, not as a query, and it skips the feed-forward sublayer. Attention cost drops from O(N²C²) to O(NMC²). At M = 1 the compute is about 1/N, while the context can still be NC tokens. Global Cached grows N by one each step so the cache holds the entire history. It did not help in the main experiments and was dropped.

Ladder sets the forward step to 0. The model reads the full sequence once, then reapplies the same core for N−1 further passes with tied weights. That is depth recurrence only. It generalizes the full weight tying in the Universal Transformer and ALBERT. Long inputs follow Transformer-XL: each token attends to a fixed window of S past positions, with a segment cache. A Ladder with N = 1 is an ordinary Transformer. A Cached Staircase with C = 1 and M = 1 is the Feedback Transformer.

Results

With parameter count matched, the gap is how many recurrent steps you buy. On Random Walk an agent turns or moves on a small grid and the model must predict its cell. The sequence is lengthened from 100 to 400. Algorithm is a three-variable program whose later ops depend on current values. LSTMs do not solve it either. The two tracking columns are the best validation seed among several runs.

ModelRandom Walk errorAlgorithm errorEnwik8 test bpcReddit test pplBASE valid ppl
Transformer-XL84.1%48.7%1.1526.228.0
Feedback Transformer0.1%0.2%1.1225.526.6
Staircase0.1%0.2%1.1422.623.0
Cached Staircase0.1%1.2%1.1326.127.8
Ladder0.1%45.1%1.1122.522.9

Staircase solves both tracking tasks with two recurrent steps. Each step rewrites the previous output and passes it forward, so the number of updates is limited by sequence length, not by L. Ladder multiplies the layer count by N. It needs 8 steps to solve Random Walk and still fails Algorithm, at 45.1% error against 48.7% for Transformer-XL. Extra depth without a time axis is not enough. Cached Staircase was run at M = 1 and reaches 1.2% on Algorithm.

On Pushshift.io Reddit, comments are trained as language modeling, about 1.5 billion examples, at 117M parameters. Eight-step Staircase reaches 22.6 test perplexity, Ladder 22.5, Transformer-XL 26.2. A twice-as-deep XL at 218M scores 23.4, still above 22.6. Four-step Staircase also scores 23.4, at half the parameter count. On BASE, about 100B tokens, validation perplexity is 28.0 for XL, 23.0 for Staircase, and 22.9 for Ladder. The Cached numbers in the table are M = 1: 26.1 on Reddit and 27.8 on BASE, essentially level with XL. In the detailed table the Feedback Transformer has 102M parameters, a bit under 117M.

Enwik8 is character-level modeling on 100M characters. Table 1 gives Ladder 1.11 bpc, XL 1.15, and Staircase 1.14. At a matched step count Ladder is better. Staircase has to pack history into a fixed set of backward tokens, which hurts when the context is long.

Batch time on Reddit: XL 178 ms, 2x XL 359 ms, Feedback 3260 ms, Cached at M = 1 246 ms, 8-step Staircase 1147 ms, 8-step Ladder 1232 ms. Feedback is slow because it consumes one token at a time. Larger forward chunks add parallelism, and perplexity slips if they get too big. A Universal Transformer with the same layer width still sits at 32.0 test perplexity after 8 steps, but it has only about 29M parameters, so that comparison is not parameter-matched.

Layer order was tested too, and these figures are validation perplexity. An 8-layer AB baseline scores 26.5. ABAB drops to 25.0. Four passes, ABABABAB, reach 23.6, matching the 218M ABCD model at 23.7. Eight passes reach 22.8. AABB, repeating one layer several times before moving on, lands at 24.8 and 23.8 for 2 and 4 passes, close to repeating the whole block. A weight set trained in one layout tests poorly if you drop it into the other.

Why it matters

At a fixed parameter budget, the extra fit comes from reusing one stack and, when the task needs it, keeping a state that later steps can rewrite. When memory is tighter than compute, that trade is the practical one. Four steps at 117M match a 218M Transformer-XL on Reddit, both at 23.4 test perplexity.

The two branches are for different jobs. Language modeling that does not revise a state at every step can use Ladder. It is simpler to run, and it wins on Enwik8. Tracking a variable across a long sequence needs Staircase, with M to cap how often states are recomputed.

The gain is incremental, and it is not free. Eight-step Staircase takes about 6.4 times the batch time of the same-size XL, 1147 ms versus 178 ms, to move Reddit perplexity from 26.2 to 22.6. If the compute budget cannot pay for those extra passes, the gain does not show up.

Limitations

The comparison fixes parameters, not FLOPs. Eight steps simply compute more, so part of the gap versus the 117M XL is extra work. The cleaner pair is 4 steps versus the 218M model: perplexity ties, parameters are halved, and batch time is 580 ms versus 359 ms, still slower. No curve at matched compute is reported.

The 0.1% and 0.2% tracking numbers are the best validation seed, not the mean. Figure 2 plots means and standard deviations, but those means are not written out.

Cached Staircase at M = 1 barely beats XL on language modeling. Global Cached is described as no better, with no failure analysis in the main text. Enwik8 moves only from 1.15 bpc to 1.11 bpc, and Staircase loses to Ladder there, so a fixed-size recurrent memory hurts long context.

There is no generation eval and no downstream finetune. Forward-size robustness shows up on only a few Reddit settings. The conclusion states the boundary directly: without a memory component, these systems stay limited to short-term reactive tasks. Step count and chunk size are tunable, and the operating range is not fully measured.

Terms

Source

What people are saying

Related papers

All paper explainers