Abstract
Autoregressive models have driven remarkable progress in language modeling. Their foundational reliance on discrete tokens, unidirectional context, and single-pass decoding, while central to their success, also inspires the exploration of a design space that could offer new axes of modeling flexibility. In this work, we explore an alternative paradigm, shifting language modeling from a discrete token space to a continuous latent space. We propose a novel framework TarFlowLM, that employs transformer-based autoregressive normalizing flows to model these continuous representations. This approach unlocks substantial flexibility, enabling the construction of models that can capture global bi-directional context through stacked, alternating-direction autoregressive transformations, support block-wise generation with flexible token patch sizes, and facilitate a hierarchical multi-pass generation process. We further propose new mixture-based coupling transformations designed to capture complex dependencies within the latent space shaped by discrete data, and demonstrate theoretical connections to conventional discrete autoregressive models. Extensive experiments on language modeling benchmarks demonstrate strong likelihood performance and highlight the flexible modeling capabilities inherent in our framework.
Introduction
Modern Large Language Models (LLMs) are predominantly discrete and unidirectional, predicting tokens sequentially from a fixed vocabulary. While highly effective, this paradigm imposes rigidity: it struggles with bi-directional context, faces computational bottlenecks due to sequence length, and is tied to specific tokenization schemes. While alternative frameworks like diffusion models operate in continuous spaces, they often sacrifice the sequential factorization that empowers autoregressive (AR) models.
TarFlowLM addresses these limitations by moving language modeling into a continuous latent space without abandoning the benefits of autoregressive modeling. This shift enables "impossible" features in standard discrete models, such as global bi-directional context and block-wise generation.
Methodology: The TarFlowLM Framework
TarFlowLM integrates Variational Autoencoders (VAEs) with Normalizing Flows to create a flexible generative model.
- Continuous Latent Bridge: A VAE encoder maps discrete token sequences into a continuous latent space, while a tied decoder performs the inverse mapping.
- Transformer-based Autoregressive Flows: The complex joint distribution of the latent sequence is modeled by a stack of Transformer-based autoregressive normalizing flows.
- Mixture-based Couplings: To handle the "clumpy" or multi-modal nature of discrete data in latent space, the authors introduced 1D Mixture-CDF and d-D Mixture-Rosenblatt flows. These utilize Mixture-of-Gaussians to transform complex latent distributions into standard Gaussians, significantly outperforming standard affine flows.
- Architectural Flexibility: The continuous and invertible nature of the space allows for stacking flows in alternating directions (e.g., Left-to-Right followed by Right-to-Left) and generating tokens in patches (blocks) simultaneously.
Key Insights
- Continuous Refinement: Unlike discrete models where editing is a discrete jump, each layer in TarFlowLM acts as a "soft editor," gradually refining latent representations from coarse global structures to fine-grained text.
- Theoretical Generalization: The framework is a mathematical generalization of discrete models. In the limit of zero variance for Gaussian components, the TarFlowLM objective converges to the standard cross-entropy loss used in models like GPT-4.
- Multi-token Consistency: By modeling the joint distribution in continuous space, TarFlowLM maintains high coherence even when generating multiple tokens (patches) simultaneously, avoiding the consistency issues common in discrete multi-token prediction.
Experimental Results
The model was evaluated on Text8 (character-level) and OpenWebText (word-level). On Text8, TarFlowLM achieved a test BPC of 1.30, surpassing many recent diffusion and continuous-space models. On OpenWebText, it reached a validation perplexity of 22.64, representing a major step forward for continuous-space generative modeling.
Ablation studies highlighted the critical role of mixture-based couplings and progressive training in achieving these results.
Conclusion
TarFlowLM demonstrates that language modeling in continuous space is not only viable but offers unique advantages in flexibility and efficiency. While sampling speed remains a challenge compared to non-autoregressive diffusion models, the use of patching significantly reduces FLOPs. Future research will focus on distillation techniques to accelerate sampling and exploring further flow parametrizations for tasks like style transfer and controlled generation.
Summary updated