skip to content

At generation time, what does a recurrent model's fixed-size state buy over a position-parallel model?

level: seniorimportance: should knowfreq 36%

answer

  1. where did the serialisation go
  2. one vector versus a growing history
  3. cost per step, not cost per sequence
  4. training knows the sequence, generation does not
  5. bounded and lossy versus exact and growing

basics

~20 s

Constant cost per emitted token. A recurrent cell folds all history into one hidden vector, so step 1,000 costs what step 1 costs and memory stays flat. Without recurrence, each new position is computed against every earlier one, so per-step cost grows.

solid answer

~50 s

A recurrent cell carries the entire past in a single vector of size d, so producing token t costs roughly the same fixed matrix work no matter how long the sequence already is, and memory is O(d) forever. That is the second thing recurrence gave for free: per-step cost bounded by the hidden size regardless of how far back the model looks. Remove recurrence and there is no summary — each new position must be computed against the stored representations of every earlier position, so both per-step work and retained state grow with the length generated so far. The trade is a shift in where the cost sits: you moved serialisation out of training, where the whole sequence is known in advance and can be processed at once, into generation, where you were going to be serial in tokens anyway. For an endless stream on a fixed memory budget, the bounded state is still genuinely attractive.

go deeper

for a junior

Be ready to say that a recurrent cell keeps one fixed-size vector of history, so each step costs the same, and that a model keeping every past position instead does more work as the sequence grows.

for a middle

Explain both cost profiles with their scaling in sequence length and hidden size, and state the flip clearly: recurrence means more steps but not more work per step, and losing it makes each step grow too.

for a senior

Demonstrate that you have operated this: memory as a function of session length, latency drifting upward within one request, concurrency falling as sessions age, and the need for a history cap or eviction policy the bounded design never required.

for a principal

Own the framing that the serialisation moved rather than vanished — out of training, where the sequence was already known, into generation, where it was unavoidable anyway. Be ready to argue which deployments still justify a bounded, lossy state.

## Two cost profiles, side by side Take hidden size d and a sequence of length T. **Recurrent.** One step performs a handful of matrix multiplies against fixed-size weight matrices, so its cost is on the order of d-squared and does not depend on t. Memory carried between steps is a single vector of size d (plus a cell state for a gated cell). Generating T tokens costs about T times d-squared, and peak state stays constant. Crucially, the cost is the same whether the answer depends on the token just emitted or on one from a thousand steps ago — reaching further back costs *nothing extra per step*, because everything the model retained is already in the state. **Position-parallel.** There is no carried summary. Producing the output at position t requires combining that position against the representations of positions 1 through t-1, so per-step work grows with t and the retained representations grow with t as well. Summed over a full generation, total work grows faster than linearly in T and peak memory grows with T. So the profile flips. For a recurrent model a longer sequence means *more steps but not more work per step*. Without recurrence a longer sequence means more steps *and* more work in each of them. ## Why this does not undo the training win The key asymmetry is between training and generation. During training on a known sequence, every target position is available in advance, so a position-parallel layer can compute all of them at once — that is the whole wall-clock argument. A recurrent layer cannot, because its own outputs are its inputs. During autoregressive generation, neither design can escape being serial in tokens: you must emit token t before you can condition on it. Removing recurrence buys *nothing* in that dimension. What differs is only what one step costs. That is why a model can be dramatically cheaper to train and simultaneously more expensive per emitted token than the recurrent design it replaced — and why 'it removes the sequential bottleneck' is only true of training. ## The quality side of the same trade A fixed-size state is a lossy compression of the past. Everything the model wants to remember competes for the same d numbers, and anything overwritten is irrecoverable, which is what makes very long dependencies hard for a recurrent model however well it is gated. Keeping every position's representation is the opposite bargain: exact, nothing forgotten, and unbounded. So the choice is not merely cheap-versus-expensive; it is bounded-and-lossy versus exact-and-growing. A candidate who names only the compute axis has seen half of it. ## Operating consequences a senior engineer should raise - **Memory becomes a function of session length.** With growing per-position state, a long conversation or a long document is not just slower, it can exhaust memory mid-stream. You need a cap, an eviction policy, or a hard session limit — decisions the constant-memory design never forces on you. - **Latency drifts within a single request.** Early tokens are fast and late tokens are slower, so a p99 measured on short outputs does not predict long ones. Benchmark at the output length you actually serve. - **Batching economics change.** When retained state per sequence grows with length, the number of concurrent sequences you can hold falls as they progress, which complicates throughput planning. - **Streaming and small targets favour bounded state.** For an indefinite stream where quality demands are modest and the memory ceiling is hard, constant per-step cost and flat memory remain a real argument for recurrence. ## How to answer State the two profiles with their scaling, name the flip (more steps versus more steps *and* more work per step), then make the senior point: the serialisation did not disappear, it moved from training — where it was pure waste, because the sequence was already known — to generation, where token-by-token serialisation is unavoidable regardless of architecture. Close with the memory and latency consequences you would plan for in a deployment, and with the lossy-versus-exact framing, which shows you see the compute trade and the modelling trade as the same decision.

  • Doesn't autoregressive generation force both designs to run one token at a time anyway?
    Yes, and that is the point. The serial chain over emitted tokens is unavoidable in both, because token t must exist before it can be conditioned on. Removing recurrence buys nothing there. The difference is purely what one step costs: fixed for a recurrent cell, growing with the tokens already produced when the past is kept explicitly.
  • How does this change how you size hardware for a streaming deployment?
    With bounded state, memory is a constant per session and you size for concurrency alone. With growing state, memory is a function of session length, so you must budget for the longest sessions, cap or evict history, and expect concurrency to fall as sessions age. Latency also drifts upward within a request, so benchmark at your real output lengths.
  • What quality cost does the fixed-size state impose?
    It is a lossy summary. Everything worth remembering competes for the same d numbers, so writing in something new can overwrite an earlier detail permanently, which is why long-range dependencies stay hard even with gating. Keeping every position is exact and forgets nothing, at the price of state that never stops growing.

A running total fits on one sticky note no matter how many receipts you add; keeping every receipt lets you audit any line exactly, but the shoebox keeps getting heavier.

saying these in an interview costs you the question

  • Says removing recurrence speeds up generation as much as training
  • Assumes per-token cost stays constant once recurrence is gone
  • Ignores that retained state grows with tokens already produced
  • Treats a fixed hidden state as lossless memory
  • Claims the sequential bottleneck disappears entirely

context