Trace Comparison for Actionable Diagnostics and Improvement of Agentic Systems

Sergey Zeltyn, Iftach Shoham, Dany Moshkovich, Ido Levy, Inna Skarbovsky, Roy Abitbol, Segev ShlomovarXiv 2026

TL;DR

When you swap an AI agent’s expensive frontier model for a smaller, cheaper one in production, performance often craters—and raw execution logs won’t tell you which part of the system broke. This paper introduces comparison analytics (deployed in IBM AgMentor), which pairs a successful run with a failed run of the same task, deterministically pinpoints the exact step where they first diverge, and pools those divergences to propose concrete, developer-reviewed fixes. Across three agentic systems, this approach recovers roughly 40% of the performance lost during model migration and dramatically boosts run-to-run consistency.

What Problem Does This Paper Address?

Building an AI agent—a system that chains together planning, tool selection, code generation, and reflection—usually starts on a frontier language model like Claude Opus 4.5 or GPT-5.4. Once it works, production reality sets in: frontier models are slow and expensive, so teams swap in a smaller or open-weight model (like GPT-OSS-120B).

Almost immediately, things break. Not necessarily because the smaller model is incapable, but because the surrounding prompts, output schemas, and routing logic were tuned for the original model’s quirks. The same headache happens even without swapping models: because agents are non-deterministic, a task that succeeds today might fail tomorrow.

Benchmark scores only tell you that a run failed, and raw execution traces can span dozens of noisy steps where the final error is just a downstream symptom of an earlier mistake. Developers need to know: which component broke, and what should change?

Methods

The authors introduce comparison analytics, a three-stage diagnostic pipeline built into IBM’s AgMentor platform:

  1. One-Time Onboarding: An "analysis LLM" reads each component’s prompt (and source code, if available) once, offline, to infer its output schema, key behavioral fields, and deterministic comparison rules (ranging from exact match to embedding similarity).
  2. Deterministic Alignment & First Divergence (No LLM Calls): Given a successful "reference" run and a failed "target" run of the same task, the system aligns them step-by-step by component identity and call index, tolerating retried or inserted steps. It then scans forward to find the first divergence—the earliest step where a component’s key output fields materially differ.
  3. Aggregation & Recommendations: Instead of asking an LLM to read massive raw traces pair by pair, all first-divergence records are pooled into a single compact table. An analysis LLM reads the whole table at once, clusters recurring failure patterns, separates root causes from symptoms, and proposes prioritized fixes.

Crucially, recommendations are treated as hypotheses: a developer reviews the evidence, applies the chosen changes (to prompts, parsers, or workflow routing), and re-runs the benchmark to validate them.

Figure 2: Comparison analytics and its inputs. Comparison rules are synthesized once per component at onboarding (1), and traces are collected by running the benchmark under each configuration (2). Each successful–failed pair is then aligned and compared deterministically (3), its first divergence is recorded (4), and the records are aggregated across pairs for an analysis LLM to turn into failure clusters, root causes, and prioritized recommendations (5). Markers 3–5 are Stages 1– 3 of the text.

Datasets

The authors evaluate two settings across three agentic systems:

  • AppWorld (multi-step API use, planning, tool selection, and code generation):
  • CUGA (an enterprise generalist agent): 128 regression tasks (43 Easy, 40 Medium, 45 Hard), migrating from Claude Opus 4.5 to GPT-OSS-120B.
  • LangGraph ReAct: Diagnosed on 43 Test-Easy tasks, then tested for generalization on Test-Normal (168 tasks) and Test-Challenge (417 tasks), migrating from GPT-5.4 to GPT-OSS-120B.
  • GAIA (general AI assistant benchmark, Levels 1 and 3, 10 runs per task):
  • LangGraph ReAct and MiroFlow (a multi-agent deep-research system), both running Claude Sonnet 4.6 in a self-comparison setup to diagnose run-to-run instability.

Key Insights and Ideas

  • Find the first domino, not the last: Pinpointing the earliest behavioral departure cuts through dozens of cascading downstream errors.
  • System adaptation vs. model capability: Trace-guided fixes work best when the smaller model can perform a behavior but does so unreliably (e.g., Medium tasks). When a task is fundamentally beyond the smaller model’s capability (Hard tasks), prompt and workflow tweaks won’t bridge the gap.
  • Fixes go beyond prompt tweaking: In CUGA, the analysis uncovered structural issues—like a find_tools isolation rule that wasn’t enforced by the parser, and a premature-finalization classifier missing task context—leading to code, parser, and routing fixes.
  • Self-comparison tames randomness: Even with the exact same model, comparing successful and failed runs of the same task surfaces stochastic failure modes (like agents looping on web searches instead of extracting an answer).

Key Results

  • CUGA on AppWorld: Swapping Opus 4.5 (60.2% success) for GPT-OSS-120B drops performance to 35.9% (-24.3 percentage points). One round of trace-guided changes brings it back to 45.3% (+9.4 pp)—recovering 39% of the lost performance ($p = 0.017$). Medium tasks jump +17.5 pp (27.5% to 45.0%), nearly closing the gap to Opus 4.5 (47.5%), while Hard tasks gain only +2.2 pp.
  • Generalization (ReAct on AppWorld): Fixes derived solely from the 43 Test-Easy tasks (+7.0 pp) generalize without further tuning to Test-Normal (+10.4 pp, 45.0% to 55.4%) and Test-Challenge (+8.0 pp, 26.0% to 34.0%).
  • GAIA Self-Comparison: On GAIA Level 3, ReAct accuracy rises +5.2 pp (34.0% to 39.2%), while run-to-run consistency skyrockets +34.2 pp (47.0% to 81.2%). MiroFlow Level 1 sees smaller gains (+1.0 pp accuracy, +2.8 pp consistency).
  • Real-World Issue Cross-Check: Cross-referencing 19 distinct CUGA findings against the team’s actual issue repository matched 10 open issues, 3 resolved issues, and uncovered 2 brand-new bugs—while 4 findings were judged doubtful.

Limitations and Future Work

  • Not a substitute for capability: Comparison analytics cannot fix tasks that the target backbone fundamentally lacks the reasoning power to solve.
  • Telemetry dependence: The method requires complete, accurately attributed traces where component identities and outputs are cleanly recoverable; comparison rules must also be regenerated as the agent evolves.
  • Automated diagnoses aren’t ground truth: Because 4 of the 19 CUGA findings misunderstood how the system actually executes, human-in-the-loop review and regression testing remain essential.

Next, the authors plan to validate the workflow across more agent architectures and development teams, tracking developer-confirmed findings and how well recommendations survive regression testing over time.

Summary updated

BibTeX
@misc{zeltyn2026trace,
  author = {Sergey Zeltyn and Iftach Shoham and Dany Moshkovich and Ido Levy and Inna Skarbovsky and Roy Abitbol and Segev Shlomov},
  title = {{Trace Comparison for Actionable Diagnostics and Improvement of Agentic Systems}},
  year = {2026},
  eprint = {2612.04118},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.04118},
}
Figure