Manuscript Offprint

arXiv:2610.22160

EMO: A Closed-Loop Test-Time Computation Framework via Alternating Context Optimization and Logits Steering

Wei Xia, Yehui Tang, Zhi-Hong Deng

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Test-time context optimization adapts frozen language models through textual feedback, but ordinary conditional generation provides no separate control over how strongly to reinforce the distributional changes induced by a context update. We introduce EMO, a training-free framework inspired by expectation-maximization that alternates question-specific context estimation (E-step) and distribution refinement (M-step). The E-step revises a system context using textual gradients from an external judge without access to gold answers. The M-step contrasts next-token distributions under the revised and preceding contexts at a shared prefix to construct a confidence-constrained logit correction. Feedback on the steered response drives the next context update, coupling adaptation across rounds with intervention within each generation. Theoretically, we connect parameter and context optimization through a shared target-KL objective and additive logit representations, and derive the steering vector from context-induced logit displacements. Under context-improvement and faithful-steering assumptions, we prove a one-round decrease in target KL divergence for sufficiently small steering strength. Under greedy decoding across eight models and six benchmarks, EMO improves the zero-shot baseline in 39 of 40 aggregated settings, averaging +9.10 percentage points. With the same judge, it adds +1.53 points on average over context-only optimization (TextGrad), with consistent MMLU-Pro gains across models. At matched target-model generation budgets, accuracy advantages over best-of-N are strongest on Llama, while oracle coverage is higher in most comparisons despite fewer candidates. The coverage-selection gap motivates allocating test-time computation jointly to candidate generation and verification.

1 Introduction

Parameter updates and context refinement provide complementary routes to adapting a large language model (LLM). Parameter optimization, including fine-tuning, reinforcement learning, and preference alignment, incorporates task data or feedback into model weights (Hu et al., 2021; Shao et al., 2024; Rafailov et al., 2023). For an individual test question, context optimization adapts a frozen model by using feedback to revise its textual instructions before generating a new response (Yuksekgonul et al., 2024; Zhang et al., 2026; Madaan et al., 2023). We study how to translate such question-specific feedback into explicit control of the decoding process.

A revised context already changes the next-token distribution at every prefix. Ordinary conditional generation, however, provides no separate control over the strength or token support of those changes. Comparing the distributions before and after a context update

September, 2026

reveals how the revision changes token preferences at the current prefix. This motivates our central question: how can feedback-driven context updates supply a controllable intervention on the generation they guide?

We propose EMO, which alternates context optimization and distribution refinement for each question. The E-step revises a system context using textual gradients (Yuksekgonul et al., 2024) from an external judge without access to gold answers. The M-step compares the revised and preceding contexts at a shared generated prefix, constructs a steering vector from their distribution contrast, and applies a confidence-constrained correction to the revised context's logits. The resulting response is evaluated to provide feedback for the next E-step. Each context update thus determines a decoding intervention whose output informs the next update, closing the loop while model weights remain fixed.

A logit-space view explains the relationship between the two steps. Parameter and context updates both admit additive logit representations, while EMO uses the context-induced displacement to construct its additional steering correction. Context edits induce finite logit changes through a frozen model, whereas parameter updates also alter the model's response to subsequent contexts and prefixes. This representation links adaptation to decoding, while our one-round analysis identifies sufficient conditions for improvement toward a target distribution.

Across eight models and six benchmarks, EMO improves over Base in 39 of 40 aggregated settings, averaging +9.10 percentage points, with benefits spanning model scale, generation, family, and thinking mode. With the judge and candidate count held fixed, adding the M-step yields +1.53 points on average over context-only optimization and improves MMLU-Pro for all eight models. At matched target-model generation budgets, EMO also achieves higher oracle coverage than independent sampling in seven of nine settings despite producing fewer candidates, indicating benefits in candidate generation alongside improvements in selected accuracy.

Our contributions are summarized as follows:

• EMO: coupled context optimization and steering. A training-free framework that turns successive context updates into prefix-dependent decoding interventions and uses the steered responses to drive further context adaptation.

• Logit-space interpretation and conditional analysis. We relate the context-induced logit displacement to the implemented steering vector (Eq. 5) and establish one-round target-KL improvement under context-improvement and faithful-steering assumptions (Theorem 1).

• Empirical evidence across four model axes. Broad improvements over Base and additional gains over context-only optimization, supported by component ablations, decoding comparisons, and generation-budget analyses that distinguish candidate coverage from answer selection.

References (30)