ReMe/benchmark
xyf2020 6b035c6553
Some checks are pending
Pre-commit / run (ubuntu-latest) (push) Waiting to run
Tests ReMe / Unit Tests - py3.11 (push) Waiting to run
Tests ReMe / Unit Tests - py3.12 (push) Waiting to run
Tests ReMe / Unit Tests - py3.13 (push) Waiting to run
Windows Smoke / CLI smoke - py3.11 (push) Waiting to run
feat(evaluation): track job calls and agent token usage in benchmarks (#406)
* feat(counter): extend counter tree utils and record job call statistics

- replace global_counter_next with fetch-and-add style global_counter_add/inc, plus read-only global_counter_get and global_counter_get_all
- record per-job call counts in app_context.metadata via BaseJob._record_call, covering background/cron/stream jobs
- update agentic_answer step and utils exports; add unit tests for job counting and counter utils

* feat(evaluation): add check_job_count interface and report search calls in benchmarks

- Extract _counter_key from BaseJob._record_call for reusable counter lookup
- Add reme.utils.evaluation_interface.check_job_count read-only helper
- Track and report average search calls per query in beam and longmemeval benchmarks

* job counter

* token消耗量统计

* benchmark输出完整token消耗统计

* benchmark统计输出改用标准差

- beam/longmemeval 的工具调用与 token 统计由方差改为标准差输出
- 修复 lint: 局部变量遮蔽 importlib.metadata、补充测试 docstring
- black 格式化

* fix(evaluation): preserve complete token usage metrics

* fix: exclude stream replies from token accounting

* Revert "fix: exclude stream replies from token accounting"

This reverts commit 85bf32064d.

* Reapply "fix: exclude stream replies from token accounting"

This reverts commit 6722c24dc5.

* support agent scope 2.0.5

* feat: support injection_config to disable runtime state injection in benchmarks

- Add InjectionConfig passthrough in AsAgentWrapper.reply()
- Disable inject_runtime_state in BaseAgenticAnswerStep to avoid
  wall-clock time conflicting with benchmark query_time anchors
- Disable inject_runtime_state in beam/lme llm_judge calls

* feat: agentscope dual-version compat & benchmark improvements

- Add version_tuple utility for semantic version comparison
- AsAgentWrapper: version-aware InjectionConfig, max_iters doubling,
  and token usage collection (reply vs reply_stream) for AS>=2.0.5/<2.0.5
- Default inject_runtime_state=False in wrapper to avoid benchmark
  time-anchor conflicts; remove per-callsite injection_config overrides
- longmemeval run.py: support question_ids filter in dataset config
- Fix unused import in test_evaluation_interface; format fixes

* chore: remove temporary flip-test benchmark config

* revert: pin agentscope to 2.0.4.post1 and drop dual-version compat

* fix(evaluation): clarify usage semantics and atomic counters

---------

Co-authored-by: sa-buc <jiangniurou.xyf@dail-algo011164204033.ET135>
Co-authored-by: jinli.yl <jinli.yl@alibaba-inc.com>
2026-08-04 11:42:18 +08:00
..
beam feat(evaluation): track job calls and agent token usage in benchmarks (#406) 2026-08-04 11:42:18 +08:00
datasets feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
longmemeval feat(evaluation): track job calls and agent token usage in benchmarks (#406) 2026-08-04 11:42:18 +08:00
kill.sh feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
README.md feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
README_ZH.md feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
result-beam.md feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
result-longmemeval.md feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00

中文版 / Chinese version

ReMe Benchmarks

Reproduction guide for the two memory benchmarks shipped with ReMe:

  • LongMemEval — long-term memory over multi-session chat histories.
  • BEAM — memory capability over long-context chat cases with rubric-based judging.

Each benchmark runs its own end-to-end pipeline: ingest sessions into an isolated per-item workspace, answer probing questions via an agentic (ReAct) mode, then score answers with an LLM-as-judge.

1. Prerequisites

Install ReMe with dev + core extras (Python 3.11+):

pip install -e ".[dev,core]"

Configure model credentials in a project-root .env file (copied from example.env). The runners auto-load .env from the repository root. Required variables typically include:

LLM_API_KEY=...
LLM_BASE_URL=...
EMBEDDING_API_KEY=...
EMBEDDING_BASE_URL=...

Model names and component wiring live in the ReMe configs referenced by each benchmark (reme/config/lme.yaml and reme/config/beam.yaml).

2. Download Datasets

See datasets/README_EN.md for full details.

LongMemEval (downloaded from a HuggingFace mirror):

cd benchmark/datasets/longmemeval
python download.py            # downloads the cleaned-S dataset; skips if already present

BEAM (public repository, cloned into benchmark/datasets/):

cd benchmark/datasets
git clone https://github.com/mohammadtavakoli78/BEAM.git

3. Run LongMemEval

From the repository root:

python benchmark/longmemeval/run.py
python benchmark/longmemeval/run.py --config benchmark/longmemeval/config.yaml
python benchmark/longmemeval/run.py -q                        # quiet: only eval-level logs
python benchmark/longmemeval/run.py --log-level WARNING       # reduce eval runner logs
python benchmark/longmemeval/run.py --reme-log-level WARNING  # reduce reme internal logs
python benchmark/longmemeval/run.py --eval_only               # reuse existing workspaces, query + judge only

Pipeline

  1. Load the dataset (ground truth is embedded in the data file).
  2. For each item, create an isolated workspace and ingest sessions in chronological order.
  3. Trigger auto_dream when consecutive sessions cross the configured hour (default 23:00).
  4. Answer each question via agentic (ReAct) mode.
  5. Judge the answer (binary yes/no) with the answer_judge job and print per-type accuracy.

Key config — benchmark/longmemeval/config.yaml

Key Meaning
dataset.path Dataset file to evaluate (e.g. longmemeval_s_reme_cleaned.json); ground truth is included.
dataset.start_index / num_items Slice of items to evaluate.
dataset.question_types Filter by question type; empty = all.
dataset.workspace_root Per-item workspace root (benchmark/memory_workspaces/longmemeval-s).
evaluation.num_workers 0 = auto (cpu-2), 1 = sequential, >1 = parallel.
evaluation.filter_future_sessions Only ingest sessions with timestamp ≤ question_date.
reme.config ReMe config used (lme.yaml).
reme.dream_trigger_hour / dream_scan_days / dream_max_units Dream triggering behavior.
output.dir Results directory (benchmark/results/longmemeval).

4. Run BEAM

From the repository root:

python benchmark/beam/run.py
python benchmark/beam/run.py --config benchmark/beam/config.yaml
python benchmark/beam/run.py -q                        # quiet
python benchmark/beam/run.py --eval_only               # reuse existing workspaces, query + judge only

Pipeline

  1. For each case, load chat.json and convert each batch into a ReMe session.
  2. Ingest sessions in chronological order into an isolated workspace, then digest_update.
  3. Answer each probing question via agentic (ReAct) mode.
  4. Score answers with BEAM's rubric-based answer_judge job and print per-type averages.

Key config — benchmark/beam/config.yaml

Key Meaning
dataset.beam_root BEAM dataset root (benchmark/datasets/BEAM).
dataset.chat_size Variant to run: 100K / 500K / 1M / 10M.
dataset.case_ids Specific cases (e.g. ["1","2"]); empty = all cases.
dataset.start_index / num_items Case pagination (num_items 0 = all).
dataset.workspace_root Per-case workspace root (benchmark/memory_workspaces/beam).
evaluation.num_workers 0 = auto, 1 = sequential, >1 = parallel.
reme.config ReMe config used (beam.yaml).
output.dir Results directory (benchmark/results/beam).

5. Outputs & Logs

  • Results: JSON files written to output.dir (results_<timestamp>.json for LongMemEval, results_<chat_size>_<timestamp>.json for BEAM). A summary with per-type accuracy/score is also printed to the console.
  • Logs: when output.log_to_file is enabled, per-run logs are written to logs/<log_prefix>_<timestamp>/ (a runner.log plus one worker-<pid>.log per worker process).

6. Stopping a Run

Parallel runs spawn a process tree. To terminate a run and all its workers cleanly:

bash benchmark/kill.sh <PID>

The script gracefully sends SIGTERM to the whole process tree, then escalates to SIGKILL for any process that does not exit within 5 seconds.

7. Reference Results

Recorded evaluation results are available in: