Tractable Transformers for Flexible Conditional Generation

Anji Liu, Xuejie Liu, Dayuan Zhao, Mathias Niepert, Yitao Liang, Guy Van den Broeck

Introduction

Generative AI has largely been dominated by Autoregressive (AR) models, which predict tokens sequentially from left to right. While highly effective for standard text generation, AR models are inherently limited when tasks require flexible conditioning, such as "infilling" missing words in the middle of a sentence or predicting data at arbitrary locations. Non-Autoregressive (NAR) models, including discrete diffusion models, were developed to address these limitations. However, these models often suffer from a significant "generalization gap": their performance frequently degrades when provided with specific context, sometimes even performing worse as more conditioning information is added.

The Tracformer Architecture

To overcome these challenges, the authors introduce Tracformer (Tractable Transformer), an encoder-decoder architecture designed for robust and flexible conditional generation. The core innovation lies in its structured attention mechanism, which moves away from standard full-attention patterns to improve both efficiency and generalization.

The Tracformer architecture features a multi-scope encoder and a sparse cross-attention decoder that progressively refines features from global to local scales.

Multi-Scope Sparse Encoder

Unlike standard Transformers where every token attends to every other token, Tracformer utilizes a multi-scope encoder. In this setup, the attention "scope" (the window of context) grows exponentially with each layer. Initial layers capture fine-grained local semantics, while deeper layers integrate these into a global context. This hierarchical approach ensures that local features remain invariant to changes in distant tokens, making the model more robust to varying "mask" patterns during inference.

Sparse Cross-Attention Decoder

The decoder employs a unique top-down refinement strategy. It progressively cross-attends to different layers of the encoder, starting with global features and moving toward local details in later layers. This allows the model to maintain a consistent global theme while refining specific token predictions based on local context.

Efficiency and Training

By utilizing sparse attention, Tracformer achieves linear computational complexity $O(T)$ relative to sequence length, a significant improvement over the quadratic $O(T^2)$ cost of standard Transformers. The model is trained using a Contextual Autoregressive (CAR) objective, which optimizes it for both standard generation and arbitrary-context infilling.

Experimental Results

The researchers evaluated Tracformer against state-of-the-art (SoTA) models, including GPT-2 and modern diffusion models like SEDD and MDLM, across benchmarks such as WikiText103, 1BW, and LAMBADA.

Conditional perplexity comparison on WikiText103 and 1BW datasets. Tracformer demonstrates superior stability and lower perplexity as the proportion of provided prefix increases compared to diffusion-based NAR models.

Superior Conditioning and Quality

Tracformer consistently outperformed diffusion models in zero-shot conditional perplexity. While models like SEDD and MDLM often showed increased perplexity (worse performance) as more context was provided, Tracformer remained stable and accurate. In text infilling tasks, Tracformer achieved higher MAUVE and BERT scores than BART, indicating superior semantic alignment with human-written text.

Scaling and Efficiency

Despite having fewer parameters (109M) than its primary competitors (169M), Tracformer delivered competitive unconditional generation results and maintained its lead in conditional tasks when scaled up on the OpenWebText dataset. This suggests that the architectural priors of Tracformer provide a more efficient path to generalization than brute-force scaling alone.

Conclusion

Tracformer represents a significant step forward in making non-autoregressive generation "tractable." By integrating a multi-scope structural prior, it bridges the generalization gap that plagues existing NAR models. While future work is needed to scale the architecture to multi-billion parameter levels and optimize custom CUDA kernels for maximum speed, Tracformer establishes a robust foundation for the next generation of flexible generative models.

Summary updated

BibTeX
@inproceedings{liu2025tractable,
  author = {Anji Liu and Xuejie Liu and Dayuan Zhao and Mathias Niepert and Yitao Liang and Guy Van den Broeck},
  title = {{Tractable Transformers for Flexible Conditional Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=iCTybKNnqb},
}
Figure