ContraPrompt: Contrastive Prompt Optimization via Dyadic Reasoning Trace Analysis
On the map: LLM reasoning → Prompting and chain-of-thought reasoning
Abstract (arXiv)
Prompt optimization methods either analyze individual failures in isolation or compare prompt variants across examples, operating on single execution traces with no access to the reasoning process distinguishing success from failure on the same input. We introduce ContraPrompt, built on the observation that when a model fails but succeeds on a retry with feedback, the difference between its two chain-of-thought traces constitutes an optimization signal not captured by prior methods. Unlike prior contrastive methods, we compare complete intermediate reasoning processes: the two traces share model, input, and base prompt, so remaining differences reflect reasoning strategy and appended error feedback -- we call this dyadic reasoning trace analysis. The multi-attempt solving phase is an instrumented agentic retry loop that generates contrastive data automatically without human annotation. Extracted rules are organized into an input-aware decision tree routing instructions by observable input characteristics. On four reasoning and compliance benchmarks, ContraPrompt outperforms GEPA (Agrawal et al., 2026) on all four, with absolute gains of +8.29 pp on HotPotQA (+20.8% rel.), +2.21 pp on GDPR-Bench (+18.2% rel.), +7.14 pp on GPQA Diamond (+10.6% rel.), and +0.74 pp on BBH (+0.85% rel.). Ablations confirm dyadic trace contrastivity is the critical component, with a -16% relative average drop upon its removal. On 53 EvalSet black-box optimization problems, ContraPrompt beats GEPA on 11, ties on 41, and loses on 1 at equal budget. On FiNER-139 financial named entity recognition (Loukas et al., 2022), ContraPrompt achieves +7.77 pp over the unoptimized baseline (+11.6% rel.) and +1.94 pp over GEPA (+2.66% rel.), with branch conditions aligning with standard US GAAP financial-instrument categories.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in Prompting and chain-of-thought reasoning, one of 17 directions in LLM reasoning. Builds on 8 of its 17 references that are in the map. First posted on arXiv 20 Apr 2026.
Builds on
8 of 17 references.
Closest ancestors · 1
Same direction, newest first
Other references · 7
- 2023Let's Verify Step by Stepcited by 3,598
- 2023GPQA: A Graduate-Level Google-Proof Q&A Benchmarkcited by 2,748
- 2023Large Language Models as Optimizerscited by 830
- 2025Agentic Context Engineering: Evolving Contexts for Self-Improving Language Modelscited by 349
- 2024TextGrad: Automatic "Differentiation" via Textcited by 250
- 2024Learning from Contrastive Prompts: Automated Optimization and Adaptationcited by 7
- 2025GDPR-Bench-Android: A Benchmark for Evaluating Automated GDPR Compliance Detection in Androidcited by 1
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026SPEAR: Code-Augmented Agentic Prompt Optimizationcited by 0
- 2026SPEAR: Code-Augmented Agentic Prompt Optimization25 May 2026
Similar, not cited
Close in wording, no citation either way
- 2025ProRefine: Inference-Time Prompt Refinement with Textual Feedback
- 2026The Optimizer Is the Agent: Reasoning-Driven Search across Prompts, Programs, and ML Workflows
- 2026Coding Agents are Strong Prompt Optimizers
- 2025Better by Comparison: Retrieval-Augmented Contrastive Reasoning for Automatic Prompt Optimization
- 2023PromptAgent: Strategic Planning with Language Models Enables Expert-level Prompt Optimization
- 2026Targeted Tests for LLM Reasoning: An Audit-Constrained Protocol
- 2026STEVE: Stabilizing Textual Gradient-Based Prompt Optimization via Error-Driven Refinement and Regularized Verification
- 2026Beyond Prompt or Skill? Attribution-Guided Optimization of Modular LLM Programs