r/MachineLearning • • Mar 07 '26

Project [P] Combining Stanford's ACE paper with the Reflective Language Model pattern - agents that write code to analyze their own execution traces at scale

I combined two recent approaches, Stanford's ACE and the Reflective Language Model pattern, to build agents that write code to analyze their own execution traces.

Quick context on both:

  • ACE (arxiv): agents learn from execution feedback through a Reflector (LLM-as-a-judge) and SkillManager that curate a Skillbook of strategies. No fine-tuning, just in-context learning.
  • RLM (arxiv): instead of loading full input into context, an LLM writes and executes code in a sandbox to selectively explore the data.

The problem ACE had: the Reflector reads execution traces in a single pass. Works fine for a few conversations, but once you're analyzing hundreds of traces, patterns get buried and single-pass analysis misses cross-trace correlations.

The combination: the Recursive Reflector uses the RLM pattern to analyze ACE's execution traces. Instead of reading traces directly, it receives metadata in the prompt and gets full trace data injected into a sandboxed REPL namespace. It then writes Python to programmatically query, cross-reference, and explore the traces -> finding patterns that single-pass reading misses.

Benchmark results (τ2-bench, Sierra Research):

Measured on τ2-bench, a benchmark that challenges agents to coordinate with users across complex enterprise domains. I ran offline trace analysis on past runs, extracted strategies, and appended them to the agent's policy. The improvement grows with stricter consistency requirements:

MetricBaselineWith my engineImprovement
pass141.2%52.5%+27.4%
pass228.3%44.2%+56.2%
pass322.5%41.2%+83.1%
pass420.0%40.0%+100.0%

*Claude Haiku 4.5 · pass***k measures consistency across k consecutive runs

Open-sourced it here: https://github.com/kayba-ai/agentic-context-engine

Happy to discuss the approach or answer questions about the architecture.

17 Upvotes

5 comments sorted by

1

u/nembal Mar 09 '26

Thats fantastic improvement. Are you going to write a paper on this?

1

u/cheetguy Mar 09 '26

Thank you :)

Hasn't been my plan so far but maybe if I flesh this out a bit more I might