Blockwise and Semi-Autoregressive Generation › What "Semi-Autoregressive" Actually Relaxes
Language AI HandbookAll chapters Here is the standard autoregressive factorization. For an output sequence conditioned on some input ,
where . 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 contiguous groups of at most tokens, with only the last group allowed to be shorter. There are groups. A semi-autoregressive model with independent intragroup predictions defines its joint probability by
where denotes all tokens in groups . 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 conditions each token on the group prefix and the common input . 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 controls the number of sequential groups and the information available to each prediction.
| Behavior | Dependencies within each group | |
|---|---|---|
| Token-autoregressive | No within-group pairs | |
| Group-autoregressive | Independent given the earlier groups and input | |
| One-shot prediction | Independent 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 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 , the binary mask has entries
A marks visibility from query to key . 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]Expand

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 model at 26.90 BLEU and 229 ms, with beam size four for both rows. The 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 to “North Court” and to “South Park” at one prefix. The words stand for two token positions in this example. The first position's distribution gives probability each to “North” and “South”. The second position gives probability each to “Court” and “Park”. Multiplying those marginals gives to each of four names. Two of them had probability zero under the reference. The combined mass on those two cross-pairs is .
| Pair | Reference probability | Independent prediction probability |
|---|---|---|
| North Court | ||
| North Park | ||
| South Court | ||
| South Park |
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!