Blockwise and Semi-Autoregressive Generation › What "Semi-Autoregressive" Actually Relaxes

Michael BrenndoerferNovember 17, 20267 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 137Blockwise and Semi-Autoregressive Generation › What "Semi-Autoregressive" Actually Relaxes
Reading section 3 of 11 · What "Semi-Autoregressive" Actually Relaxes · 7 minSection 3 of 11 · 7 min

Section 3 of 11 · 7 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Here is the standard autoregressive factorization. For an output sequence y=(y1,…,yT)y = (y_1, \dots, y_T) conditioned on some input xx,

p(y∣x)=∏t=1Tp(yt∣y<t,x),p(y \mid x) = \prod_{t=1}^{T} p(y_t \mid y_{<t}, x),

where y<t=(y1,…,yt−1)y_{<t} = (y_1, \dots, y_{t-1}). Each next-token conditional can use all preceding output tokens. An ordinary left-to-right sampler forms the prefix before sampling at the next position.

Now partition a fixed-length output into GG contiguous groups g1,…,gGg_1, \dots, g_G of at most kk tokens, with only the last group allowed to be shorter. There are G=⌈T/k⌉G = \lceil T / k \rceil groups. A semi-autoregressive model with independent intragroup predictions defines its joint probability by

pSAT(y∣x)=∏j=1G∏t∈gjpSAT(yt∣y<gj,x),p_{\mathrm{SAT}}(y \mid x) = \prod_{j=1}^{G} \prod_{t \in g_j} p_{\mathrm{SAT}}\bigl(y_t \mid y_{<g_j}, x\bigr),

where y<gjy_{<g_j} denotes all tokens in groups 1,…,j−11, \dots, j-1. Read this carefully, because the two products mean very different things:

  • The outer product generates groups in order. Each group can condition on all the earlier groups.
  • The inner product over t∈gjt \in g_j conditions each token on the group prefix and the common input xx. Tokens inside a group are conditionally independent given what came before.

The independent predictions let the model generate a group in parallel. This choice limits the conditional dependence the model can express within one group.

Group size kk controls the number of sequential groups and the information available to each prediction.

kkBehaviorDependencies within each group
11Token-autoregressiveNo within-group pairs
1<k<T1 < k < TGroup-autoregressiveIndependent given the earlier groups and input
k=Tk = TOne-shot predictionIndependent given the input

Table: Dependency pattern at three group sizes.

Changing the width moves group boundaries and changes which preceding tokens are visible to each prediction. In the fourth position, groups of width two expose the first two tokens, and groups of width three expose the first three. Increasing group width reduces or preserves the number of group decisions at a fixed output length. These settings control which tokens the model can condition on. An empirical quality or latency comparison still depends on how each model is trained and decoded.

Training a Semi-Autoregressive Model

Wang, Zhang, and Chen start from a Transformer encoder-decoder. They shift decoder inputs by a group and relax causal masking across the known inputs in the shifted group. The information carried by the decoder inputs matters alongside their positions. A mask over unshifted gold target tokens could leak the answers through the diagonal.

The following diagram uses explicit prediction queries to show which information each position can use. Query tt reads token content supplied for earlier groups and a target-free key at its own position. The target-free key can encode the position and other information available during inference. For g(t)=1+⌊(t−1)/k⌋g(t)=1+\lfloor(t-1)/k\rfloor, the binary mask has entries

Mt,s={1if g(s)<g(t) or s=t,0otherwise.M_{t,s} = \begin{cases} 1 & \text{if } g(s)<g(t) \text{ or } s=t,\\ 0 & \text{otherwise}. \end{cases}

A 11 marks visibility from query tt to key ss. With groups of width three, the query at position four can read token content from positions one through three and its own target-free key. The token at position four can supply content to queries in later groups. The two roles at position four use distinct representations. During teacher forcing, token content comes from the reference. During generation, it comes from completed groups. The diagram leaves source attention and the start symbol implicit.

The mask is easier to read as a picture than as a piece of pseudocode. In the heatmap below, rows are query positions and columns are key positions, so a filled cell means the query is allowed to attend to that key. The diagonal shows each query's access to its own target-free representation.

VisualizationOut [3]
CollapseExpand
Twelve-by-twelve visibility mask with earlier-group blocks and a separate self diagonal.
Logical visibility for 12 prediction positions in groups of three. Colored cells show earlier-group token content and diagonal access to a target-free self key. The same position has separate token and query representations.

Under the independent within-group product, the negative log-likelihood sums the per-position cross-entropies. A single teacher-forced pass can compute all of them using the group-shifted inputs of Wang et al. or an explicit query construction with separately supplied earlier-group token content. Using unshifted gold embeddings on the diagonal would give queries their own labels. A token-autoregressive Transformer can also parallelize teacher-forced training. The group model reduces sequential decisions during generation, when each group waits for completed earlier groups.

What the Relaxation Costs

Consider a name with two plausible two-token forms. Predicting both tokens independently in one group can combine halves from different forms. If the boundary falls between the halves, the next group can use the first sampled token when choosing the second.

Wang, Zhang, and Chen (2018) studied this trade-off on English–German and Chinese–English translation. Table 3 compares the WMT 2014 English–German baseline of 27.11 BLEU at 346 ms per sentence to the k=2k=2 model at 26.90 BLEU and 229 ms, with beam size four for both rows. The k=6k=6 model at beam size four reached 24.83 BLEU and 116 ms. These comparisons use the paper's data, fitted models, hardware and decoding settings. They show that larger groups helped latency and hurt BLEU across those settings. The magnitude of either change is workload-specific.

A small probability table makes the restriction visible. Suppose the reference distribution gives probability 1/21/2 to “North Court” and 1/21/2 to “South Park” at one prefix. The words stand for two token positions in this example. The first position's distribution gives probability 1/21/2 each to “North” and “South”. The second position gives probability 1/21/2 each to “Court” and “Park”. Multiplying those marginals gives 1/41/4 to each of four names. Two of them had probability zero under the reference. The combined mass on those two cross-pairs is 1/21/2.

PairReference probabilityIndependent prediction probability
North Court1/21/21/41/4
North Park001/41/4
South Court001/41/4
South Park1/21/21/41/4

Table: Two within-group token decisions at a fixed prefix.

The per-position marginals in the table are correct. The error arises when the model samples the two positions independently. If the group boundary comes between these positions, the second prediction can instead put all its mass on “Court” after “North” and on “Park” after “South”. That particular dependency then fits the factorization, at the cost of waiting for the first group. In a translation example, a clearer source sentence might determine the whole name and remove this uncertainty even for independent predictions. The dependence that matters here is what remains after conditioning on the source and preceding groups.

Auxiliary heads that predict several future positions can supply a draft to another decoder. Their training objective alone does not determine which distribution the final decoder follows. For example, when an exact greedy verifier still checks their proposals, it can use their predictions to save steps while preserving the baseline's sequence.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy