Enabling Autoregressive Models to Fill In Masked Tokens
Daniel Israel, Aditya Grover, Guy Van den Broeck
TL;DR
Autoregressive (AR) models are highly scalable and benefit from KV caching but struggle with infilling between contexts, whereas masked language models (MLMs) handle infilling but are less scalable. MARIA (Masked and Autoregressive Infilling Architecture) unifies a frozen pretrained MLM and a frozen AR by training a lightweight linear decoder on their concatenated hidden states to enable masked infilling while preserving AR-style inference. The method initializes the fusion layer with W3 = [W1/2; W2/2], equivalent to a product-of-experts, and optimizes an autoregressive distribution conditioned on unmasked context via the MARIA objective L_MARIA. Empirically, MARIA achieves state-of-the-art masked infilling compared with discrete diffusion baselines, delivering strong perplexity, sample quality (as judged by LLM-based assessments), and high throughput due to KV caching; it also enables flexible test-time strategies like simulated annealing for unconditional generation.
Abstract
Historically, LLMs have been trained using either autoregressive (AR) or masked language modeling (MLM) objectives, with AR models gaining dominance in recent years. However, AR models are inherently incapable of masked infilling, which is the ability to predict masked tokens between past and future context. In contrast, MLM models suffer from intrinsic computational inefficiencies during both training and inference that hinder their scalability. This work introduces MARIA (Masked and Autoregressive Infilling Architecture), a novel approach that leverages the strengths of both paradigms to achieve state-of-the-art masked infilling performance. MARIA combines a pre-trained MLM and AR model by training a linear decoder that takes their concatenated hidden states as input. This minimal modification enables the AR model to perform infilling while retaining its inherent advantages in terms of faster inference with KV caching. Our results demonstrate that MARIA significantly outperforms existing methods, namely discrete diffusion models, on masked infilling tasks.
