Reinforced Context Order Recovery (ReCOR)
- ReCOR is a framework that recovers favorable context orders to enhance model performance in tasks such as in-context learning, multi-hop reasoning, and adaptive generation.
- It formulates order selection as an optimization problem over permutations or partial orders using techniques like reinforcement, sampling, or consistency regularization.
- Empirical results show that optimized ordering can significantly improve metrics like accuracy, F1 score, and BLEU compared to fixed, heuristic, or random orderings.
Searching arXiv for the cited ReCOR-related papers and adjacent work to ground the article. Reinforced Context Order Recovery (ReCOR) is a family of formulations for recovering or inducing an effective order over contextual elements when model behavior is sensitive to sequence arrangement. Across recent work, the term spans several distinct but related settings: few-shot example ordering in in-context learning, support-document ordering in multi-hop reasoning and retrieval-augmented generation, and adaptive token generation order in reasoning and planning. In each case, the central claim is that model quality depends not only on which context elements are present, but also on how they are ordered, and that explicit order recovery can improve downstream performance relative to fixed, heuristic, or random orderings (Batorski et al., 22 Mar 2026, Ma et al., 18 Aug 2025).
1. Conceptual scope and problem formulation
ReCOR denotes the recovery of a favorable context order under model-specific order sensitivity. The relevant “context” differs by domain: in few-shot prompting it is the sequence of demonstrations; in multi-hop question answering it is the ordering of supporting documents; in retrieval-augmented generation it is the ranked list of retrieved passages; and in adaptive generation it is the order in which output token positions are filled (Batorski et al., 22 Mar 2026, Yu et al., 2024, Zhang et al., 2024, Ma et al., 18 Aug 2025).
A shared motivation across these settings is that exhaustive search over all candidate orders is usually infeasible. For in-context examples or retrieved documents, the permutation space is , and direct evaluation of all orders is therefore intractable beyond very small (Batorski et al., 22 Mar 2026). In long-context settings, ordering interacts with positional bias, especially the “lost-in-the-middle” phenomenon, in which LLMs underutilize information appearing in middle positions relative to the beginning or end of the prompt (Yu et al., 2024, Zhang et al., 2024, Lee et al., 2024).
In the broadest sense, ReCOR treats order selection as an optimization problem over permutations or partial orders. The optimization target is task-dependent: few-shot accuracy, F1, exact match, pairwise occlusion accuracy, or token-level predictive utility, depending on the application (Batorski et al., 22 Mar 2026, Yu et al., 2024, Saleh et al., 26 Sep 2025, Ma et al., 18 Aug 2025). This suggests that ReCOR is best understood not as a single algorithm, but as a unifying perspective on sequence-order recovery under task-level feedback.
2. ReCOR for in-context learning: distributional optimization over permutations
A direct and explicit ReCOR instantiation appears in "PLR: Plackett-Luce for Reordering In-Context Learning Examples" (Batorski et al., 22 Mar 2026). In this setting, a fixed set of few-shot demonstrations is given, and the objective is to learn an ordering that improves ICL performance without enumerating all permutations. The method replaces discrete search with a probability distribution over permutations using the Plackett–Luce model.
For a permutation with positive utilities , the distribution is defined as
and with ,
The log-likelihood is
The optimization target is the expected task metric over sampled orders,
The paper presents a reinforcement-style interpretation via policy gradients,
0
but in implementation follows a cross-entropy-method-style procedure: sample permutations, score them under the task metric, keep elites, and refit the Plackett–Luce distribution by maximum likelihood or a heuristic exponential-moving-average rank update (Batorski et al., 22 Mar 2026).
Candidate permutations are sampled efficiently with Gumbel perturb-and-sort. Independent noise 1 is added to 2 or 3, and the items are sorted by descending perturbed score. This yields 4 sampling per permutation rather than stepwise sampling (Batorski et al., 22 Mar 2026).
The method optionally uses a mixture
5
motivated by the fact that a single Plackett–Luce component obeys independence-of-irrelevant-alternatives and may miss interaction structure across ranks. The paper states that mixtures of Plackett–Luce models are dense in the set of all distributions over permutations when 6 is large (Batorski et al., 22 Mar 2026).
Empirically, PLR reports gains on classification benchmarks and mathematical reasoning tasks where label-based heuristics are not applicable. On Qwen2.5-7B, averaged over classification datasets, PLR-EMA achieves 76.93 versus 75.95 for Top-K at 7, and 76.15 versus 74.71 at 8. On Llama-3.1-8B, PLR-EMA achieves 79.84 versus 78.03 at 9, and PLR-1 achieves 78.35 versus 76.95 at 0 (Batorski et al., 22 Mar 2026). On mathematical reasoning with Qwen2.5-7B, reported results include GSM8K 1: 42.85 versus 40.40 for PLR-1 against Top-K, DeepMath 2: 46.36 versus 45.13 for PLR-4, and MATH500 3: 33.40 versus 29.80 for PLR-4 (Batorski et al., 22 Mar 2026).
These results frame ReCOR as distributional policy optimization over permutations with bandit-style task feedback rather than label-probe heuristics. A plausible implication is that order recovery becomes especially useful as 4 grows and unguided sampling covers an ever smaller fraction of the factorial search space.
3. Misordered context and repetition-based order recovery in multi-hop reasoning
A different ReCOR interpretation appears in "Unleashing Multi-Hop Reasoning Potential in LLMs through Repetition of Misordered Context" (Yu et al., 2024). Here the focus is not on learning a parametric permutation policy, but on the misordered context problem: decoder-only LLMs are sensitive to both absolute position and relative order of supporting documents in multi-hop reasoning.
The paper formalizes a context as
5
where 6 are supporting documents and 7 are arbitrary noisy blocks. For a permutation 8 of the supports, the class of contexts containing supports in that order is
9
The model-specific optimal order is defined as
0
This explicitly characterizes order recovery as maximizing expected answer probability over support permutations (Yu et al., 2024).
The proposed method, Context Repetition (CoRe), repeats the entire context 1 times:
2
The paper proves that for any initial order 3 and any target permutation 4,
5
and therefore the repeated context always contains the optimal order:
6
The intuition is that by choosing supporting documents from different repetitions, a contiguous left-to-right reasoning segment realizing any desired order can be embedded inside the prompt (Yu et al., 2024).
The empirical evidence is substantial. On clean MuSiQue contexts with only supporting documents, the best–worst permutation gap reaches at least 26 F1 percentage points as the number of hops increases. CoRe then improves multi-hop QA performance, including 2WikiMultihopQA bridge-comparison where Llama-3.1-8B improves from 34.86 to 65.11 F1 and Qwen2.5-7B from 39.45 to 64.54 F1, and HotpotQA bridge where Qwen2.5-7B improves from 61.66 to 70.33 F1 and GPT-4o-mini from 68.66 to 72.67 F1 (Yu et al., 2024). On a synthetic order-sensitive task, accuracy improves by at least +30 percentage points and up to +70 percentage points with repetition (Yu et al., 2024).
The paper explicitly notes that this is “reinforcement” in the sense of repetition and order coverage rather than reinforcement learning. This distinction is important. In this usage, ReCOR is non-parametric and prompt-based: it recovers favorable internal reasoning orders by making them available within the repeated prompt rather than by updating a learned policy (Yu et al., 2024).
4. Retrieval-augmented generation: reinforced reordering versus consistency regularization
In retrieval-augmented generation, ReCOR addresses the interaction between retriever order, model position bias, and downstream answer quality. Two papers represent contrasting strategies: the reinforcement-oriented "R4: Reinforced Retriever-Reorder-Responder for Retrieval-Augmented LLMs" (Zhang et al., 2024) and the training-regularization method "CORD: Balancing COnsistency and Rank Distillation for Robust Retrieval-Augmented Generation" (Lee et al., 2024).
R4 operationalizes ReCOR explicitly. It retrieves top-7 documents, constructs a heterogeneous query–document graph, and learns to assign each document to one of three slots: beginning, mid, or end. The motivation is the “lost in the middle” effect, which makes beginning and end positions disproportionately valuable (Zhang et al., 2024). Document and query interactions are modeled by graph attention, and a reinforcement-style policy 8 chooses a slot for each document. The reward for document 9 is
0
with cumulative reward
1
and objective
2
The framework further incorporates feedback from generated answer quality via
3
while the responder LLM remains frozen (Zhang et al., 2024).
Reported results show gains across knowledge-intensive tasks. Averaged across 4, R4 reports on NQ ROUGE-1 46.2 versus best baselines up to 44.8 and BLEU-4 8.20 versus baselines around 7.53–7.64; on TriviaQA ROUGE-1 29.0 versus baselines up to 28.0; on MultiDoc2Dial ROUGE-1 25.7 versus baselines up to 24.4; and on MMLU accuracy 90.4 versus baselines up to 89.2 (Zhang et al., 2024). Ablations show degraded performance when removing reinforced order adjustment, graph document learning, or document enhancement, with the reinforced order adjustment identified as critical (Zhang et al., 2024).
CORD addresses the same ordering problem from a different direction. Rather than explicitly learning a permutation policy, it regularizes the generator to be less sensitive to perturbations while preserving useful retriever rank priors (Lee et al., 2024). Given retrieved contexts 5, CORD synthesizes perturbations and trains on both the original order and a selected perturbation. Its consistency loss uses Jensen–Shannon divergence between token-level predictive distributions:
6
The overall loss is
7
with 8 in the reported experiments (Lee et al., 2024).
The interpolation parameter 9 preserves the top-ranked 0 fraction and randomizes the tail, encoding a controlled trade-off between invariance and respect for retriever scores (Lee et al., 2024). Empirically, on Phi-3 3B with LoRA, CORD reports MS MARCO ROUGE-L 44.74 versus 44.52 for an In2-like baseline and 41.34 for no finetuning; HotpotQA EM 63.55 versus 58.62 and 42.86; NQ accuracy 58.55 versus 55.60 and 52.18; Multi-Needle F1 58.71 versus 56.25 and 56.52; and MN-IDK accuracy 98.83 versus 95.78 and 54.82 (Lee et al., 2024).
Taken together, these papers show two interpretations of ReCOR in RAG. R4 treats order recovery as reinforced reordering guided by downstream generation quality (Zhang et al., 2024). CORD, by contrast, seeks robustness to order perturbation while preserving retriever rank priors, and is presented as complementary to RL-style approaches rather than a direct order-search method (Lee et al., 2024).
5. Adaptive token generation order as ReCOR in reasoning and planning
A more general and arguably more abstract formulation appears in "Reinforced Context Order Recovery for Adaptive Reasoning and Planning" (Ma et al., 18 Aug 2025). Here ReCOR is not about reordering input context elements, but about recovering an adaptive, data-dependent generation order for output token positions.
The paper argues that fixed left-to-right generation in causal LLMs and random masking in discrete diffusion models are often suboptimal for tasks such as Sudoku, Zebra logic puzzles, and arithmetic with carries. It formalizes tractability through predictive 1-information. For random variables 2 and predictive function class 3,
4
and
5
In the ReCOR setting, 6 is the prompt together with already-filled output positions, and 7 is the next token to fill (Ma et al., 18 Aug 2025).
The method casts order recovery as a sequential decision problem. At state 8, the action 9 chooses the next position to fill. The RL objective is
0
1
The paper uses soft Q-learning with
2
and the soft Bellman MSE loss
3
A BCE-style alternative is also given (Ma et al., 18 Aug 2025).
The rewards are self-supervised by the token predictor 4. A dense reward is
5
and a sparse reward is
6
The token predictor is trained on-policy under the learned order distribution:
7
The reported experiments use 8, yielding a contextual-bandit formulation (Ma et al., 18 Aug 2025).
This version of ReCOR reports strong results on structured reasoning tasks. On arithmetic, ReCOR achieves 0.987±0.007 on ARG and 0.964±0.007 on MUL, compared with CLM at 0.017±0.002 and 0.594±0.018, MDM at 0.035±0.010 and 0.943±0.006, and AdaMDM at 0.174±0.036 and 0.951±0.038; AR-GT, the oracle using ground-truth order, attains 0.994±0.003 and 0.999±0.001 (Ma et al., 18 Aug 2025). On puzzles, ReCOR attains 0.9017±0.0004 on Sudoku and 0.9905±0.0021 on Zebra, exceeding AR-GT at 0.8718 and 0.9117, and also outperforming AdaMDM at 0.8949 and 0.985 (Ma et al., 18 Aug 2025).
This formulation generalizes ReCOR beyond prompt ordering into adaptive generation order. A plausible implication is that “context order recovery” here refers to the order in which the model conditions on partially generated solution state, rather than the arrangement of externally supplied context.
6. Beyond text: order recovery in visual occlusion reasoning
The phrase “order recovery” also appears in vision, though not under an RL-based ReCOR framework. "GPT-4 for Occlusion Order Recovery" considers a set of detected instances and seeks a directed occlusion relation 9, represented by an occlusion matrix 0 where 1 means object 2 occludes object 3 (Saleh et al., 26 Sep 2025).
The relation is constrained by irreflexivity 4, anti-symmetry 5 for 6, and transitivity. The corresponding directed graph must be acyclic for a strict partial order (Saleh et al., 26 Sep 2025). GPT-4 is prompted with an image and a category-constrained vocabulary to list objects from foreground to background and emit lines of the form “Object A occludes Object B.” These outputs are parsed into the matrix 7, after which optional consistency processing can enforce anti-symmetry, cycle removal, transitive closure, and topological sorting (Saleh et al., 26 Sep 2025).
On COCOA, reported pairwise accuracies are Area 65.43%, Y-axis 61.36%, BBBD 69.53%, and GPT-4 82.26%. On InstaOrder, reported accuracies are Area 52.23%, Y-axis 62.02%, BBBD 47.72%, and GPT-4 73.05% (Saleh et al., 26 Sep 2025). The paper also reports all-zero matrix failure rates of 7.71% on COCOA and 7.05% on InstaOrder (Saleh et al., 26 Sep 2025).
Although the paper states that the term “ReCOR” is not used, it presents the method as context-driven order recovery via prompt constraints and potential iterative re-prompting (Saleh et al., 26 Sep 2025). This suggests that the ReCOR idea can be extended from sequence permutations to more general order structures such as strict partial orders over objects in a scene.
7. Limitations, distinctions, and open directions
Several limitations recur across ReCOR formulations. First, many approaches require labeled feedback or task-specific scoring. PLR needs a task metric such as few-shot accuracy on a validation split, which limits fully unsupervised use and makes scoring the dominant cost despite cheap permutation sampling (Batorski et al., 22 Mar 2026). R4 relies on BLEU, ROUGE, and string-distance feedback (Zhang et al., 2024). CORD requires supervised ground-truth answer likelihood for teacher selection and consistency training (Lee et al., 2024).
Second, order recovery may interact unfavorably with noise. CoRe shows that over-repetition in noisy contexts can re-amplify distractors, and some models degrade at high repetition counts (Yu et al., 2024). CORD identifies that strong consistency regularization can be counterproductive when retriever rank prior is crucial, motivating its adaptive interpolation and teacher selection design (Lee et al., 2024).
Third, different papers use “reinforced” in materially different senses. In PLR and the adaptive reasoning paper, the term is tied to RL-style or bandit-style policy optimization over order choices (Batorski et al., 22 Mar 2026, Ma et al., 18 Aug 2025). In CoRe, reinforcement refers to repetition-induced coverage of candidate reasoning orders rather than policy learning (Yu et al., 2024). In the occlusion paper, a ReCOR interpretation is proposed as context re-weighting and re-prompting rather than optimization of a learned policy (Saleh et al., 26 Sep 2025). This semantic variability is central to the literature and can be a source of confusion.
Fourth, the scope of the recovered order differs sharply by application. R4 learns coarse placement into beginning, mid, and end slots rather than a full permutation (Zhang et al., 2024). PLR learns a full permutation distribution over demonstrations (Batorski et al., 22 Mar 2026). CoRe does not reorder explicitly at all; it embeds all orders by repetition (Yu et al., 2024). The adaptive reasoning formulation learns a generation order over token positions (Ma et al., 18 Aug 2025). Occlusion order recovery targets a strict partial order over scene instances (Saleh et al., 26 Sep 2025).
Open directions stated in these works include transferable ordering priors across tasks rather than task-specific optimization (Batorski et al., 22 Mar 2026), integration of repetition with noise suppression or adaptive repetition counts in multi-hop reasoning (Yu et al., 2024), broader backbone and task validation for consistency-based RAG training (Lee et al., 2024), and larger-scale adaptive generation with richer planning structures for RL-based token-order recovery (Ma et al., 18 Aug 2025). A plausible synthesis is that future ReCOR research will increasingly combine explicit order optimization, robustness regularization, and structural priors rather than relying on a single mechanism.
ReCOR therefore names an emerging research motif rather than a single canonical technique. Its common thesis is that ordering is a latent control variable in modern model behavior, and that recovering a favorable order—whether through stochastic permutation policies, repetition-based coverage, graph-based slot assignment, consistency regularization, or adaptive token scheduling—can materially alter performance on tasks whose difficulty is otherwise attributed only to retrieval, reasoning, or generation quality (Batorski et al., 22 Mar 2026, Yu et al., 2024, Zhang et al., 2024, Lee et al., 2024, Ma et al., 18 Aug 2025).