Skip to content

Contrastive Reflection for Iterative Prompt Optimization

Jun 2026 · arXiv.org · Vol abs/2606.30840 · 1 citation · 18 references
Computer Science

Abstract

LLM agents are becoming central to information retrieval: they issue retrieval queries, synthesize answers, and increasingly serve as judges for IR evaluation. Improving the prompts that control these agents is an optimization problem, but in applied IR settings it often looks less like blind search and more like debugging. Engineers need to know which behavior failed, which nearby behavior still worked, what distinguishes the two, and whether a prompt edit improves held-out quality without introducing regressions. We present Contrastive Reflection, an iterative prompt-optimization framework for agentic IR workflows. The framework starts from a task-centric quality definition: QA agents expose retrieval or reasoning traces, and grading agents expose dimension-level scores and rationales. These structured traces are used to identify error-anchored behavioral slices, add nearby successful examples from the same region, and ask a Teacher LLM to propose a targeted prompt edit. Candidate edits are accepted only when validation performance improves, optionally subject to regression checks. We instantiate the framework with a tree-based slice selector, but the contribution is the contrastive reflection loop rather than the tree itself. On a public HotpotQA retrieval-augmented QA setup, one tree-selected contrastive repair improves held-out exact-match accuracy from 51.4% to 60.4%. Failure-only and random-evidence variants improve less and break more previously correct examples. A light instruction-only comparison places the method near modern prompt optimizers: MIPROv2 reaches 59.4% and GEPA 57.0%. The result is an interpretable optimization loop for IR agents, aimed at making prompt repair more inspectable and validation-driven.

View source

Similar papers

Preprint Aug 2026

RLMOpt: Adaptive Prompt Optimization via Recursive Language Models

RLMOpt is introduced, a prompt optimizer that makes the search policy itself language-model-driven through a recursive language model (RLM), which operates over a tool-based environment, inspecting task information, analyzing failures, generating candidates, allocating evaluation budget, and deciding when to stop.

Subhash Bangalore Satheesha, Nirvik Pande, Deepthi Duddempudi et al. · 0 citations
Preprint Aug 2026

The Optimizer Is the Agent: Reasoning-Driven Search across Prompts, Programs, and ML Workflows

Recent systems for optimizing prompts, programs, and ML workflows typically rely on explicit outer-loop controllers such as evolutionary search, bandits, or textual-gradient methods. We ask a fundamentally different question: how much of this search policy can be internalized by a single tool-using agent? We present ReASearch, a unified framework for reasoning-driven optimization in which the agent autonomously decides what to evaluate, how to diagnose failures, which edits to make, and when to verify or restart. Rather than serving only as a proposal generator guided by hand-designed heuristics, the agent actively analyzes outcomes, allocates budget, and refines its strategy over long horizons through persistent memory. With a shared agent loop and domain-specific tools, ReASearch instantiates the exact same scaffold to optimize prompts, programs, and ML workflows. Across 14 diverse tasks, it is competitive with and mostly better than specialized optimization systems, achieving gains of 2% to 40% over strong domain-specific baselines, and in some cases discovering solutions that improve on prior human best-known results. Crucially, we observe that complex search behaviors, which are typically implemented by explicit controllers, emerge naturally from the agent's reasoning process.

Junbo Li, Boyi Liu, Canwen Xu et al. · 0 citations
Conference Jul 2026

A Collaborative Version-Controlled Framework for Evolutionary Optimization of AI Prompts

Prompt engineering is now a significant aspect of large language models (LLMs) to make them as effective in applications like conversational agents, educational assistants, automated code-generating systems, and content generation systems. Nonetheless, urgent design is frequently done in informal and solitary fashion devoid of systematic processes of collective enhancement, quality evaluation, or evolutionary monitoring. This paper suggests NeuroPrompt, an open-source prompt engineering system, which combines version tracking with evolution, directed acyclic graph (DAG) based lineage modeling, and community-based quality assessment. Users can create prompts, fork better prompts, and assess the performance of prompts with a multi-rater consensus system to assess the prompts based on clarity, creativity, and usefulness. The forking is directed by a utility-based decision model that ensures that unnecessary prompt duplication is avoided, and the effectiveness of optimization is enhanced. Experimental analysis reveals that collaborative prompt evolution is more effective in prompt quality and the overall accuracy of prompt generation in providing relevant and useful responses to tasks is 96.3% in comparison against baseline prompt design methods which has a score of about 88-91. There are also the results of the improved consensus reliability and lesser variance of ratings among the community evaluators. The suggested system will change timely engineering into a transparent and organized evolutionary process allowing sharing of knowledge systematically and optimizing prompt through collaborative optimization to large-scale AI initiatives.

D. Ragunath, Vaishak C J · 0 citations
Preprint Aug 2026

MemeMind: Reference-Guided Trace Construction for Offline Context Optimization

Offline context optimization improves an agent by revising its instructions and examples while keeping the model frozen. This approach learns from rollouts on an adaptation set, but some queries produce only failed rollouts. In these cases, the optimizer sees no successful example of how the available tools can reach the correct answer. We introduce MemeMind, which uses an offline reference answer to recover this missing experience. TraceBuilder identifies the evidence required by the reference, executes text search, image retrieval, and visual grounding, and verifies the resulting tool trace before adding it to the adaptation buffer. ToolGuide then summarizes the collected traces into a shared guide and separate instructions for each tool. The reference answers and constructed traces are used only during adaptation, while inference uses the learned guides with a frozen model. We study this problem through Anime, Comic, and Game meme interpretation. These memes combine edited and ambiguous visual content, overlaid text, long tail franchise knowledge, and culture specific references. Their interpretation can require coordinated visual grounding, image retrieval, and text search, making them a demanding setting in which native rollout groups may fail together. We evaluate MemeMind on MemeX, a benchmark of 1,000 such memes annotated by experts. Across two Qwen3-VL models, two language partitions, and two independent judges, MemeMind improves over the strongest context optimization baseline by 22.0% and 21.1% on Qwen3-VL-30B-A3B, and by 8.1% and 8.0% on Qwen3-VL-235B-A22B under GPT-5 judging. Ablations and held out traces show that constructing successful tool use for failed groups provides the largest component gain and produces more effective evidence acquisition at inference time.

Run Yang, Weihang Wang, Boheng Sheng et al. · 1 citation
Preprint Aug 2026

CAPO: Constraint-Aware Prompt Optimization for LLM Agents

This work introduces CAPO (Constraint-Aware Prompt Optimization), a primal-dual method that combines pool-based rewrites with adaptive constraint weighting to optimize system prompts under explicit operational constraints.

Victor Ye Dong, Reid Pryzant, Yi Liu et al. · 0 citations
Preprint Jul 2026

PromptPack: Scaling LLM Annotation Agents for Online Recommendation

Online recommendation platforms increasingly use Large Language Models (LLMs) to extract structured features from ad creatives. While deploying a single-call LLM annotation agent yields significant Click-Through Rate (CTR) improvements in our live production environment, per-creative prompting is prohibitively expensive to scale. The redundant system instructions sent in every request account for 94% of billed input tokens. To break this cost bottleneck, we introduce PromptPack, a scalable, high-throughput LLM annotation agent. PromptPack achieves this scale via in-context batching, combining a shared system prompt, a strict XML structural envelope, and an output correction layer to ensure deterministic, pipeline-ready feature extraction across multiple creatives simultaneously. We evaluate PromptPack via an offline retrieval benchmark using a downstream logistic-regression ranker. To deeply profile the agent's behavior, we measure AUC and introduce Volume-Weighted Absolute Lift (VWAL), a novel metric capturing the signal quality of the generated features. Compared to our live, unbatched production baseline, PromptPack at batch size 20 cuts our LLM costs by 89% and accelerates throughput by 2.5x while fully preserving AUC.

Sebastian Koralewski, Merwan Barlier, Yulia Stolin et al. · 0 citations