Alab-NII/BenchTrace

Code for BenchTrace

Python

7

3 commits

updated May 27, 2026

See the code

README

BenchTrace Code

This repository contains the code for BenchTrace, a benchmark for evaluating self-evolution ability in LLM agents. BenchTrace consists of a snapshot-reflection dataset of 1,821 annotated episodes spanning six tasks, paired with two evaluation suites: Reflection Evaluation and Evolution Evaluation.

πŸ“Š Dataset: huangjh16/BenchTrace on Hugging Face

BenchTrace Overview

Repository Structure

benchrogue_code/
β”œβ”€β”€ data_generation/        # Dataset construction pipeline
β”œβ”€β”€ evaluation/
β”‚   β”œβ”€β”€ reflection/         # Reflection Evaluation
β”‚   └── evolution/          # Evolution Evaluation
└── analysis/               # Analysis and plotting scripts

Note on Jericho game files: Zork and other Infocom game data (ROMs and .qzl saved-game files) are proprietary and are not included in this repository for copyright reasons. To run the Jericho evaluation, obtain the game files separately (see the Jericho project) and place them under evaluation/evolution/jericho/.

Each of the three top-level modules contains a subdirectory per task:

  • jericho β€” Jericho text adventure games
  • alfworld β€” ALFWorld embodied household tasks
  • babyai β€” BabyAI grid-world navigation
  • bundled_web_shopping β€” Bundled Web Shopping
  • group_travel_planning β€” Group Travel Planning
  • science_world β€” ScienceWorld

Requirements

Install dependencies:

pip install -r requirements.txt

An api_key.json file is required in the root directory with the following format:

{"openai": "<your-openai-key>", "anthropic": "<your-anthropic-key>"}

Modules

1. data_generation/

Scripts for constructing the BenchTrace snapshot-reflection dataset.

ScriptDescription
annotate_episodes.pyCollect raw episodes from agent runs (Jericho only)
format_draft.pyGenerate rule-based draft annotations from episodes (Jericho only)
ai_annotate.pyRun AI annotators (Claude Sonnet + Gemini Flash) to produce failure annotations
build_dataset.pyAssemble the final dataset from AI and human annotations
compute_agreement.pyCompute inter-annotator agreement between AI annotators
annotation_ui.pyWeb UI for human annotation and adjudication (Jericho only)
prompts/Task-specific annotation prompt for the AI annotator

Usage (example for Jericho):

python data_generation/jericho/ai_annotate.py
python data_generation/jericho/build_dataset.py

2. evaluation/

evaluation/reflection/

Scripts for running and scoring Reflection Evaluation β€” measuring whether a model can correctly answer detection, localization, and diagnosis questions given an episode snapshot.

ScriptDescription
run_reflect_task.pyRun reflection evaluation on a dataset split
score_reflect_task.pyCompute per-question metrics (Accuracy, Jaccard, Token F1, LLM-Judge)
llm_judge.pyLLM-as-judge scoring for diagnosis
cascade_analysis.pyCascade (funnel) analysis across detection β†’ localization β†’ diagnosis
prompts/Task-specific prompts for all three questions

Usage:

python evaluation/reflection/jericho/run_reflect_task.py --model Qwen/Qwen3-32B
python evaluation/reflection/jericho/score_reflect_task.py

evaluation/evolution/

Scripts for running and scoring Evolution Evaluation β€” measuring whether an agent avoids a target failure instance after being exposed to relevant past snapshots.

Baselines included:

ScriptBaseline
run_non_evolution.pyReAct (no evolution)
run_naive.pyNaive (full history concatenation)
run_evotest.pyEvoTest
run_reflexion.pyReflexion
run_remem.pyReMemory
run_rag.pyRAG
run_memrl.pyMemoryRL
run_autoskill.pyAutoSkill
run_agentR.pyAgent-R (Jericho only)
score_evol_eval.pyCompute score and FAR across all results

Usage:

python evaluation/evolution/jericho/run_evotest.py --game balances --model Qwen/Qwen3-32B
python evaluation/evolution/score_evol_eval.py

3. analysis/

Scripts for reproducing figures and analysis results in the paper.

ScriptDescription
plot_cascade_crossenv.pyFigure 2: funnel analysis across all six tasks
cascade/plot_cascade_<task>.pyPer-task funnel breakdown
correlation_analysis.pyTable 9: FAR conditioned on cumulative reflection correctness
cumulative_funnel.pyCumulative funnel statistics
funnel_corr.pyCorrelation between funnel levels and FAR
all_correct_corr.pyFAR for fully correct reflections
detection_corr.pyDetection-level correlation analysis
strategy_corr.pyStrategy failure correlation analysis

Usage:

python analysis/plot_cascade_crossenv.py
python analysis/correlation_analysis.py

Citation

@inproceedings{benchrogue2026,
  title     = {BenchTrace: Benchmarking Self-Evolution in LLM Agents},
  booktitle = {Proceedings of ACL},
  year      = {2026}
}

Alab-NII/BenchTrace

Code for BenchTrace

Python

7

3 commits

updated May 27, 2026

See the code

README

BenchTrace Code

This repository contains the code for BenchTrace, a benchmark for evaluating self-evolution ability in LLM agents. BenchTrace consists of a snapshot-reflection dataset of 1,821 annotated episodes spanning six tasks, paired with two evaluation suites: Reflection Evaluation and Evolution Evaluation.

πŸ“Š Dataset: huangjh16/BenchTrace on Hugging Face

BenchTrace Overview

Repository Structure

benchrogue_code/
β”œβ”€β”€ data_generation/        # Dataset construction pipeline
β”œβ”€β”€ evaluation/
β”‚   β”œβ”€β”€ reflection/         # Reflection Evaluation
β”‚   └── evolution/          # Evolution Evaluation
└── analysis/               # Analysis and plotting scripts

Note on Jericho game files: Zork and other Infocom game data (ROMs and .qzl saved-game files) are proprietary and are not included in this repository for copyright reasons. To run the Jericho evaluation, obtain the game files separately (see the Jericho project) and place them under evaluation/evolution/jericho/.

Each of the three top-level modules contains a subdirectory per task:

  • jericho β€” Jericho text adventure games
  • alfworld β€” ALFWorld embodied household tasks
  • babyai β€” BabyAI grid-world navigation
  • bundled_web_shopping β€” Bundled Web Shopping
  • group_travel_planning β€” Group Travel Planning
  • science_world β€” ScienceWorld

Requirements

Install dependencies:

pip install -r requirements.txt

An api_key.json file is required in the root directory with the following format:

{"openai": "<your-openai-key>", "anthropic": "<your-anthropic-key>"}

Modules

1. data_generation/

Scripts for constructing the BenchTrace snapshot-reflection dataset.

ScriptDescription
annotate_episodes.pyCollect raw episodes from agent runs (Jericho only)
format_draft.pyGenerate rule-based draft annotations from episodes (Jericho only)
ai_annotate.pyRun AI annotators (Claude Sonnet + Gemini Flash) to produce failure annotations
build_dataset.pyAssemble the final dataset from AI and human annotations
compute_agreement.pyCompute inter-annotator agreement between AI annotators
annotation_ui.pyWeb UI for human annotation and adjudication (Jericho only)
prompts/Task-specific annotation prompt for the AI annotator

Usage (example for Jericho):

python data_generation/jericho/ai_annotate.py
python data_generation/jericho/build_dataset.py

2. evaluation/

evaluation/reflection/

Scripts for running and scoring Reflection Evaluation β€” measuring whether a model can correctly answer detection, localization, and diagnosis questions given an episode snapshot.

ScriptDescription
run_reflect_task.pyRun reflection evaluation on a dataset split
score_reflect_task.pyCompute per-question metrics (Accuracy, Jaccard, Token F1, LLM-Judge)
llm_judge.pyLLM-as-judge scoring for diagnosis
cascade_analysis.pyCascade (funnel) analysis across detection β†’ localization β†’ diagnosis
prompts/Task-specific prompts for all three questions

Usage:

python evaluation/reflection/jericho/run_reflect_task.py --model Qwen/Qwen3-32B
python evaluation/reflection/jericho/score_reflect_task.py

evaluation/evolution/

Scripts for running and scoring Evolution Evaluation β€” measuring whether an agent avoids a target failure instance after being exposed to relevant past snapshots.

Baselines included:

ScriptBaseline
run_non_evolution.pyReAct (no evolution)
run_naive.pyNaive (full history concatenation)
run_evotest.pyEvoTest
run_reflexion.pyReflexion
run_remem.pyReMemory
run_rag.pyRAG
run_memrl.pyMemoryRL
run_autoskill.pyAutoSkill
run_agentR.pyAgent-R (Jericho only)
score_evol_eval.pyCompute score and FAR across all results

Usage:

python evaluation/evolution/jericho/run_evotest.py --game balances --model Qwen/Qwen3-32B
python evaluation/evolution/score_evol_eval.py

3. analysis/

Scripts for reproducing figures and analysis results in the paper.

ScriptDescription
plot_cascade_crossenv.pyFigure 2: funnel analysis across all six tasks
cascade/plot_cascade_<task>.pyPer-task funnel breakdown
correlation_analysis.pyTable 9: FAR conditioned on cumulative reflection correctness
cumulative_funnel.pyCumulative funnel statistics
funnel_corr.pyCorrelation between funnel levels and FAR
all_correct_corr.pyFAR for fully correct reflections
detection_corr.pyDetection-level correlation analysis
strategy_corr.pyStrategy failure correlation analysis

Usage:

python analysis/plot_cascade_crossenv.py
python analysis/correlation_analysis.py

Citation

@inproceedings{benchrogue2026,
  title     = {BenchTrace: Benchmarking Self-Evolution in LLM Agents},
  booktitle = {Proceedings of ACL},
  year      = {2026}
}