AC-GPT: Unlocking Future Context for Standard Causal Transformers

Simplifying the Modeling of Arbitrary Conditionals in Natural Language

2026-06-01
Yinhan Lu, Eric Elmoznino, Léo Gagnon, Sarthak Mittal, Tejas Kasetty, Guillaume Lajoie
Summary
Problem
Method
Results
Takeaways
Abstract

The paper introduces Arbitrary Conditionals GPT (AC-GPT), a novel modification to standard causal Transformers that enables evaluation and sampling of arbitrary conditional probabilities (e.g., predicting middle tokens given past and future context) in a single forward pass. By augmenting sequences with position-aware conditioning tokens and maintaining a left-to-right factorization, AC-GPT achieves SOTA performance on conditional tasks while allowing seamless fine-tuning of existing large-scale models like Qwen and Llama-3.1.

TL;DR

Standard LLMs are "blind" to the future, making tasks like text infilling and editing mathematically intractable. AC-GPT (Arbitrary Conditionals GPT) fixes this by minimally modifying the standard GPT architecture to allow conditioning on any set of tokens (past, future, or mixed) in a single forward pass. Unlike previous attempts that reinvent the wheel, AC-GPT preserves the natural left-to-right flow of language, making it compatible with existing heavyweights like Llama-3.1 and Qwen.

The Problem: The One-Way Street of Causal Attention

The success of models like GPT-4 is built on a left-to-right factorization: . While efficient, this is a one-way street. If you want to calculate the probability of a word in the middle of a sentence given the ending (e.g., ), standard causal models can't do it without expensive iterative sampling or re-training with special objectives (like GLM/SpanBERT).

Recent "any-order" models like σ-GPT tried to solve this by training models to predict tokens in any random order. However, the authors of AC-GPT argue this is a waste of capacity—human language has an inherent temporal "arrow of time." Forcing a model to learn how to predict the past given the future in a scrambled order makes the learning problem unnecessarily hard.

Methodology: The "Copy and Prompt" Insight

AC-GPT’s brilliance lies in its simplicity. Instead of changing the attention mechanism or the training objective, it changes the input structure.

How it works:

  1. Identify Conditioning Tokens (): These are the tokens you already know (could be the start AND the end of a paragraph).
  2. Create Copies (): Copy these tokens and place them at the very beginning of the sequence.
  3. Preserve Positions: Even though they are at the front, they keep their original positional encodings.
  4. Causal + Bidirectional Hybrid: The copied tokens at the front can attend to each other bidirectionally (since they are all known). The rest of the sequence uses standard causal attention but can reach back to attend to the "conditioning prompt" at the front.

AC-GPT Architecture Figure 1: AC-GPT augments the sequence with copies of conditioning tokens, allowing the model to look "into the future" through the prepended segment while maintaining causal integrity.

By using this copying mechanism, the model naturally learns to use "future" information (provided in the prompt at the front) to fill in the gaps in the causal sequence.

Experiments: Performance Without Sacrifice

The researchers tested AC-GPT against several baselines, including standard GPTs, MLMs (like BERT), and any-order models (σ-GPT).

Key Findings:

  • The Future Helps: AC-GPT achieved a 15.4% improvement in perplexity by effectively utilizing future context compared to standard causal models.
  • Standard Performance Maintained: Unlike σ-GPT, which often crashes or performs poorly on standard text generation, AC-GPT matches the performance of vanilla GPTs on standard left-to-right tasks.
  • Scaling Up: Because AC-GPT doesn't change the architecture, the authors were able to fine-tune Qwen3-32B and Llama-3.1-8B using LoRA. The advantage of arbitrary conditioning remained consistent even at the billion-parameter scale.

Results Summary Figure 2: AC-GPT (blue) significantly out-performs baselines in training distribution and infilling modes, while remaining competitive in unconditional perplexity.

Critical Analysis: Why This Matters

The real value of AC-GPT is Architectural Compatibility. Most SOTA research into infilling (like OpenAI's FIM - Fill In the Middle) requires specific data augmentation and is often restricted to suffix/prefix structures. AC-GPT allows for scattered conditioning—you could provide words 1, 5, 12, and 20 and ask the model to fill in the rest.

Limitations

  • Compute Overhead: Because you are prepending copies of tokens, the sequence length increases. For a sequence length and conditioning set , the effective length becomes , which increases the attention cost.
  • Training Efficiency: AC-GPT only calculates loss on the "evaluation" tokens, whereas any-order models can technically calculate loss on all tokens simultaneously.

Conclusion: A New Standard for Infilling?

AC-GPT proves that we don't need to break the Transformer architecture to make it more flexible. By treating the "future" as a specialized prompt and maintaining the temporal inductive bias of language, we can give our current LLMs "hindsight" during the generation process. This has massive implications for AI-assisted writing, code refactoring, and complex reasoning tasks.

Find Similar Papers

Try Our Examples

  • Search for recent studies that utilize "prefix-tuning" or "copy-mechanisms" specifically to enable infilling in massive-scale causal language models without full retraining.
  • Which paper first introduced the "σ-GPT" architecture for any-order autoregressive modeling, and how does its use of double positional encodings differ from the RoPE-based approach in AC-GPT?
  • Explore research applying arbitrary conditional modeling to multimodal tasks, such as generating missing video frames conditioned on future keyframes using causal Transformer backbones.
Contents
AC-GPT: Unlocking Future Context for Standard Causal Transformers
1. TL;DR
2. The Problem: The One-Way Street of Causal Attention
3. Methodology: The "Copy and Prompt" Insight
3.1. How it works:
4. Experiments: Performance Without Sacrifice
5. Critical Analysis: Why This Matters
5.1. Limitations
6. Conclusion: A New Standard for Infilling?