AFM Workshop, NeurIPS 2024Generation and refinement

COrAL: Order-Agnostic Language Modeling for Efficient Iterative Refinement

Yuxi Xie1,2, Anirudh Goyal3, Xiaobao Wu2,4, Xunjian Yin2, Xiao Xu1, Min-Yen Kan1, Liangming Pan5, William Yang Wang2

1 National University of Singapore · 2 University of California, Santa Barbara · 3 Mila · 4 Nanyang Technological University · 5 University of Arizona

COrAL lets a language model predict and revise several token positions within a local window, making the trade-off between reasoning accuracy and decoding speed explicit.

Result
LogiQA accuracy 58.2% vs 55.1% for next-token greedy decoding, at 62.1 vs 33.6 accepted tokens/s (1.8×), both measured without KV cache at batch size 1.
New vs prior
Self-Refine refines through extra prompting passes, and Jacobi and look-ahead decoding parallelize forward decoding only; this work trains the model to predict forward and reconstruct backward within a sliding window.
Limitation
On HumanEval the full method lowers pass@1 from 64.6% to 13.0%, which the paper attributes mainly to syntax errors from inconsistent multi-token predictions.
Scroll sideways to read the figure. Sliding blockwise order-agnostic decoding on the paper's own example: at each step the block is refined with forward and backward multi-token dependencies, the repeated “marine” is revised to “organ”, and verified tokens become fixed as the block advances. Original Figure 2 from the paper. Full size ↗

Why should a token become permanent as soon as it is generated?

Autoregressive decoding commits to each token from left to right; when a later phrase makes an earlier choice look wrong, revising it takes another sequential pass. Parallel decoding cuts latency, but independently proposed tokens can disagree. COrAL keeps the sequential structure while making nearby predictions revisable.

The key restriction is locality: COrAL learns dependencies only within a bounded window, not arbitrary orderings over a whole sequence. A position can be predicted from the prefix or reconstructed with some later text visible, and agreement between these two views helps decide what to keep.

Closest prior work

Iterative refinement in LLMs usually runs on autoregressive models, either through prompting frameworks such as Self-Refine (Madaan et al., 2023) or by using feedback as a training signal, and each refinement adds sequential passes. Parallel decoding methods, such as speculative decoding with a draft model and Jacobi or look-ahead decoding, speed up generation but decode only in the forward direction, while non-autoregressive models often produce inconsistent outputs. COrAL trains the model itself to predict forward and reconstruct backward within a local window, so refinement happens inside the decoding loop.

Train for revision, then decode with several views of each position

Forward training predicts several future positions from clean sequences. Reconstruction training corrupts patches by replacement or repetition and asks the model to recover the original tokens. Refinement is therefore a trained capability, not an instruction given to an unchanged next-token model.

To predict several positions from one context, COrAL applies a generalized RoPE (rotary position embedding) in the last Transformer layer so that the query encodes the target position, avoiding a separate output head for each offset. Training adapts the last layer first and then the whole network, to limit the mismatch with the pretrained model.

At inference, a sliding block holds the positions to predict or revise. The model combines conditional distributions weighted by dependency distance and confidence, builds candidate blocks, and verifies them with next-token and backward probabilities plus a contrastive term. Only the accepted prefix is committed and advances the window; other positions stay revisable.

Published example · Figure 2, step by step

The same example, one decoding step at a time

Figure 2 prints five steps of decoding “What is coral ?” with window k = 3 and block size b = 6. Each step here shows the earlier row above the later one, the arrows printed between them, which tokens became fixed, and where the block slid.

9th step

Whatiscoral?Coralisamarineorganthatintheformofhardskelet,whichisbuiltby

10th step

Whatiscoral?Coralisamarineorganthatintheformofhardskelet,whichisbuiltbysmallanimals.

Prompt tokenFixed response tokenToken in the decoding blockForward multi-token dependencyBackward multi-token dependencyRevised since the earlier row

10th step. 3 tokens were accepted and fixed: “skelet , which”. The block slides to positions 15–20; Algorithm 1 ends it at min(t_s + b − 1, t + k) = min(15 + 6 − 1, 17 + 3) = 20. Kept from the draft: “is built by”. New: “small animals .”. 12 forward arrows; 6 backward arrows re-predict positions 15–17 from the earlier draft. After 10 steps 14 response tokens are fixed and 6 remain in the block. Each step also verifies candidate blocks, so fewer steps is not the same as faster decoding; measured throughput is under Evidence.

Step log of the printed rows

Derived from the printed rows. Block positions count response tokens from 1.

StepAccepted since the previous printed stepBlock positionsSizeBlock change
1st—1–33new “Coral is a”
2nd“Coral is a”4–63new “marine marine living”
3rd“marine”5–95revised “marine” → “organ”, “living” → “that”; new “in the the”
4th–8thnot printed
9th11 fixed in total12–176position 9 “the” → “form” since the 3rd step
10th“skelet , which”15–206kept “is built by”; new “small animals .”

Published example: the tokens, colours and arrows of Figure 2, transcribed exactly, including the subword “skelet” and the gap between the 3rd and 9th steps. Derived: block bounds from Algorithm 1, t_e = min(t_s + b − 1, t + k), which reproduces every printed block; the printed arrows follow the window k = 3 into the new block. The paper’s text names the revision “organism”; the figure prints the token “organ”. Illustrative: the pause between sliding the block and filling it.

  1. 01

    Learn local dependencies

    Train for forward prediction and backward reconstruction within a limited context window.

  2. 02

    Decode in blocks

    Predict and revise multiple positions as a sliding block advances through the response.

  3. 03

    Choose a refinement budget

    Adjust verification and parallel prediction to trade computational cost against answer quality.

Full COrAL gains on three of five benchmarks and fails on code

Measured · Tables 1–2 and §4.1

Five benchmarks, four decoding settings, one pair of axes

Each panel plots one benchmark from the paper: accuracy (pass@1 for HumanEval) against accepted tokens per second. Both axes start at zero and are the same in every panel. The arrow runs from the comparison setting to the highlighted one.

Next-tokenFull COrALNo verifierNo multi-forwardFilled accent: Full COrAL (highlighted). Dark: next-token (comparison).

GSM8KAccuracy · Table 1
100500 Next-token: 74.1% accuracy, 39.7 accepted tokens/sNo verifier: 72.4% accuracy, 156.8 accepted tokens/sNo multi-forward: 78.7% accuracy, 14.9 accepted tokens/sFull COrAL: 75.3% accuracy, 43.4 accepted tokens/s 080160
Accuracy (%)
74.1 → 75.3 (+1.2)
Tokens/s
39.7 → 43.4 (1.09×)
MATHAccuracy · Table 1
100500 Next-token: 21.8% accuracy, 38.7 accepted tokens/sNo verifier: 20.0% accuracy, 139.7 accepted tokens/sNo multi-forward: 24.3% accuracy, 11.5 accepted tokens/sFull COrAL: 22.7% accuracy, 44.4 accepted tokens/s 080160
Accuracy (%)
21.8 → 22.7 (+0.9)
Tokens/s
38.7 → 44.4 (1.15×)
LogiQAAccuracy · Table 2
100500 Next-token: 55.1% accuracy, 33.6 accepted tokens/sNo verifier: 55.7% accuracy, 99.1 accepted tokens/sNo multi-forward: 59.1% accuracy, 8.9 accepted tokens/sFull COrAL: 58.2% accuracy, 62.1 accepted tokens/s 080160
Accuracy (%)
55.1 → 58.2 (+3.1)
Tokens/s
33.6 → 62.1 (1.85×)
ReClorAccuracy · Table 2
100500 Next-token: 63.2% accuracy, 33.2 accepted tokens/sNo verifier: 61.6% accuracy, 72.0 accepted tokens/sNo multi-forward: 64.7% accuracy, 11.3 accepted tokens/sFull COrAL: 62.7% accuracy, 38.2 accepted tokens/s 080160
Accuracy (%)
63.2 → 62.7 (−0.5)
Tokens/s
33.2 → 38.2 (1.15×)
HumanEvalPass@1 · §4.1 table
100500 Next-token: 64.6% pass@1, 42.2 accepted tokens/sNo verifier: 6.5% pass@1, 119.0 accepted tokens/sNo multi-forward: 61.6% pass@1, 28.8 accepted tokens/sFull COrAL: 13.0% pass@1, 45.8 accepted tokens/s 080160
Pass@1 (%)
64.6 → 13.0 (−51.6)
Tokens/s
42.2 → 45.8 (1.09×)

Horizontal: accepted tokens per second, 0–160. Vertical: accuracy or pass@1, 0–100%. Changes in parentheses are percentage points and throughput ratios, computed from the reported values.

Full COrAL vs Next-token: accuracy is higher on 3 and lower on 2 of five benchmarks. Throughput is 1.09× to 1.85× the Next-token rate. HumanEval pass@1 goes from 64.6 to 13.0 (−51.6 points).

All 40 reported values: quality in % and accepted tokens per second for each setting.

SettingGSM8K Table 1MATH Table 1LogiQA Table 2ReClor Table 2HumanEval §4.1 table
AccuracyTok/sAccuracyTok/sAccuracyTok/sAccuracyTok/sPass@1Tok/s
Next-token74.139.721.838.755.133.663.233.264.642.2
Full COrAL75.343.422.744.458.262.162.738.213.045.8
No verifier72.4156.820.0139.755.799.161.672.06.5119.0
No multi-forward78.714.924.311.559.18.964.711.361.628.8

The paper attributes the HumanEval drop mainly to invalid syntax, 70.1% of samples in its no-verifier error analysis (Figure 5). The 61.6 without multi-forward prediction was obtained with a stricter acceptance threshold, ϵ = 0.5. Speeds were measured without a KV cache at batch size 1 on a single GPU, and code generation ran on different GPUs from the reasoning tasks, so compare speeds within a panel.

Measured: Table 1 (GSM8K, MATH), Table 2 (LogiQA, ReClor) and the §4.1 HumanEval table, Mistral-7B-v0.3, greedy next-token baseline, throughput in accepted tokens per second (hardware and ϵ in Appendix D). Derived: differences and ratios. Axes start at zero; points are reported experiments, not interpolations.

Among COrAL’s settings, backward refinement without multi-forward prediction gives the highest accuracy and the lowest throughput, and multi-forward prediction without verification the highest throughput and the lowest accuracy; the full method lies between them on every benchmark. The abstract’s 4.6-point GSM8K gain and 3.9× speedup thus come from two different settings. Throughput is accepted tokens per second, measured for both decoders without a KV cache at batch size 1.

Code is the boundary. The paper attributes the HumanEval drop mainly to invalid syntax; recovering most of the pass rate requires turning off multi-forward prediction and raising the acceptance threshold, which runs slower than the baseline. Local agreement helps refinement but does not ensure well-formed programs.

Scope. Order-agnostic training is applied only during task-specific fine-tuning of Mistral-7B-v0.3, with fixed windows of 4 forward and 8 backward tokens; extending it to pretraining is left to future work. Read the study ↗

Further reading in the paperObjective and target-aware RoPE · §2 ↗Sliding block decoding · Algorithm 1 ↗Measured results and ablations · §4 ↗
Research summary

Iterative refinement has emerged as an effective paradigm for enhancing the capabilities of large language models (LLMs) on complex tasks. However, existing approaches typically implement iterative refinement at the application or prompting level, relying on autoregressive (AR) modeling. The sequential token generation in AR models can lead to high inference latency. To overcome these challenges, we propose Context-Wise Order-Agnostic Language Modeling (COrAL), which incorporates iterative refinement directly into the LLM architecture while maintaining computational efficiency. Our approach models multiple token dependencies within manageable context windows, enabling the model to perform iterative refinement internally during the generation process. Leveraging the order-agnostic nature of COrAL, we introduce sliding blockwise order-agnostic decoding, which performs multi-token forward prediction and backward reconstruction within context windows. This allows the model to iteratively refine its outputs in parallel in the sliding block, effectively capturing diverse dependencies without the high inference cost of sequential generation. Empirical evaluations on reasoning tasks demonstrate that COrAL improves performance and inference speed, respectively, achieving absolute accuracy gains of 4.6% on GSM8K and 4.0% on LogiQA, along with inference speedups of up to 3.9× over next-token baselines. Preliminary results on code generation indicate a drop in pass rates due to inconsistencies in order-agnostic outputs, highlighting the inherent quality–speed trade-off. Our code is publicly available at https://github.com/YuxiXie/COrAL.

Full paper ↗
Citation BibTeX
@misc{xie2024coralorderagnosticlanguagemodeling,
    title={COrAL: Order-Agnostic Language Modeling for Efficient Iterative Refinement},
    author={Yuxi Xie and Anirudh Goyal and Xiaobao Wu and Xunjian Yin and Xiao Xu and Min-Yen Kan and Liangming Pan and William Yang Wang},
    year={2024},
    eprint={2410.09675},
    archivePrefix={arXiv},
    primaryClass={cs.CL},
    url={https://arxiv.org/abs/2410.09675}
}