ReMe/benchmark
xyf2020 7b1da5a9ee
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(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375)
* feat(eval): add LongMemEval evaluation framework with tool_defaults date injection

- Add evaluation/longmemeval/ with run.py, config.yaml, and test scripts
- Add reme/config/longmemeval.yaml for evaluation-specific model config
- Add tool_defaults mechanism to as_agent_wrapper for injecting default
  tool kwargs (uses setdefault so LLM-provided values take priority)
- Pass tool_defaults={'daily_write': {'date': day}} in auto_memory to
  ensure notes always use the correct historical date
- Add timestamp interpolation (_interpolate_timestamps) in auto_memory
  for filling missing created_at fields via linear interpolation
- Evaluation pipeline: ingest sessions -> dream -> search -> answer -> judge
- Uses qwen3.6-flash for memory, qwen3.7-max for answer/judge

* chore: gitignore logs/results/demo.py, keep empty dirs

* chore: update .gitignore

* feat(eval): add multiprocessing and session time filtering to longmemeval runner

- Replace async execution with synchronous + multiprocessing for parallel item evaluation - Add filter_future_sessions option to only ingest sessions <= question date - Add question_types filtering in config - Add result summary with binary accuracy and avg score - Update config defaults (oracle variant, 50 items, 32 workers) - Minor code style fixes in agent_wrapper and auto_memory

* feat: add bench_query_step with ReAct agent for benchmark query phase

- Add BenchQueryStep using agent_wrapper with search job tool
- Replace manual search+LLM answer in run.py with bench_query_job
- Remove unused answer LLM config from longmemeval.yaml
- Register benchmark step module in steps/__init__.py

* feat: add start_date/end_date time filter support for search job

- Add _extract_date_from_path to extract validated YYYY-MM-DD from chunk paths
- Add start_date/end_date filtering in _matches_search_filter
- Implement progressive recall in FaissLocalFileStore.vector_search
- Promote start_date/end_date from context to search_filter in SearchStep
- Add start_date/end_date parameters to search job in default.yaml
- Add unit tests for date filter functionality

* fix: validate/normalize date filters and harden _extract_date_from_path

Address three code-review comments on the time_filter search feature:

1. Validate/normalize start_date and end_date before string comparison.
   _matches_search_filter does lexicographic comparison against path_date
   (always canonical YYYY-MM-DD). Raw caller values like '2026-2-28' or
   'abc' would produce silently wrong results. Now SearchStep normalizes
   valid dates via extract_daily_date (with strptime fallback for
   non-zero-padded input) and silently ignores invalid dates with a
   logger.warning, removing them from the filter.

2. Clarify behavior for paths without embedded dates.
   Added optional strict_date_filter parameter (default False). When True
   and at least one date bound is active, chunks whose path yields no date
   (e.g. digest/personal/topic.md) are excluded. When False (default),
   the existing behavior is preserved — dateless paths pass through.

3. Harden _extract_date_from_path against non-standard suffixes.
   Previously parts[1].split('.')[0] accepted '2026-05-18.anything' as a
   valid date. Now only exact 'YYYY-MM-DD' (dir) and 'YYYY-MM-DD.md'
   (day-index) forms are accepted.

* feat(eval): LLM-as-Judge per-type prompt routing, binary-only, progress tracking

- Remove 0-5 score metric, keep only binary (yes/no) classification
- Load per-question-type judge prompts from llm-as-judge.json
  (temporal-reasoning, knowledge-update, single-session-preference, __default__)
- Replace SCORE_JUDGE_PROMPT with type-specific BINARY_JUDGE_PROMPT template
- judge_response(): parameter 'metric' -> 'question_type', returns single 'judgment'
- Summary output: add per-type accuracy breakdown, remove score stats
- Add progress tracking: background thread prints PROGRESS every 10min
- Add FINAL progress line and total elapsed time on completion
- Add --log-level, --reme-log-level, -q CLI arguments
- Parallel mode: pool.map -> pool.imap_unordered for real-time progress
- config.yaml: full oracle (10000 items), 32 workers, all question types
- Add kill.sh (process cleanup) and run_async.sh (background eval launcher)

* docs: add LongMemEval oracle evaluation results (61.6% accuracy)

* feat(bench): add MAX_ITERATION limit to BenchQueryStep and add _auto_memory.yaml

* feat: add golden session benchmark & eval_only mode with refined prompt

- Add benchmark/longmemeval/run_golden_session.py for golden session evaluation
- Refine PROMPTED_SYSTEM_PROMPT: concise answer rule, remove 'Information not found' fallback
- Add eval_only mode to run.py (--eval_only flag)
- Add multiple eval config variants (evalonly, full, test5)
- Add analyze_results.py for result parsing
- Update auto_memory.yaml, longmemeval.yaml, application_config
- Update result-longmemeval.md with latest evaluation results
- Add benchmark results to .gitignore

* update: refine answer prompts and increase max iteration to 6 - Tighten prompted-answer system prompt for more concise output - Comment out 'Information not found' fallback rule - Increase MAX_ITERATION from 5 to 6 in bench_query - Add recall_eval.py - Update evaluation results

* feat(chunker): add dedicated JSON and JSONL file chunkers (cherry-pick from upstream #325)

- Add JsonFileChunker: structure-aware chunking preserving nested key paths,
  optional list-to-dict conversion, size measured by json.dumps() char count
- Add JsonlFileChunker: line-aligned sliding-window chunking with configurable
  overlap, supports char/byte mode switching
- Register both chunkers in default.yaml (json for .json, jsonl for .jsonl)
- Add comprehensive unit tests (21 + 20 test cases)

* feat(service): add CLI service for local job execution (from upstream #334)

- Introduce CliService to execute single jobs locally without serving ports
- Add prepare_start_config and should_precheck_start functions for CLI job setup
- Update reme start command to use CLI service when job argument is provided
- Add show_metadata to client kwargs for optional CLI metadata output
- Add unit tests for CLI service functionality and configuration handling

* feat(steps): add BM25/vector search steps, Python execute step, and draft steps (from upstream #334)

- Add Bm25SearchStep for plain BM25 keyword search with tool_context deduplication
- Add VectorSearchStep for plain vector search with tool_context deduplication
- Add PythonExecuteStep to run Python code in subprocess with timeout handling
- Add AddDraftStep/ReadAllDraftStep for draft accumulation scoped by tool context
- Update SearchStep with tool_context dedup, dynamic default limit via REME_SEARCH_LIMIT env,
  and candidate_multiplier default changed from 3.0 to 5.0
- Add comprehensive unit tests for all new steps

* feat(search): add tool context deduplication and improve search configuration (#321)

* feat(search): add tool context deduplication and improve search configuration

- Modify _make_tool methods to accept and inject tool_context_id parameter
- Add tool_context_id handling in AS and CC agent wrappers
- Increase search candidate multiplier from 3.0 to 5.0 in default config
- Extend HTTP client timeout from 30s to 3600s
- Add tool context deduplication logic to prevent duplicate search results
- Implement TTL-based expiration for seen chunks in tool contexts
- Add comprehensive unit tests for tool context deduplication behavior
- Update .gitignore to exclude longmemeval directory
- Add time import for timestamp functionality in search step

* refactor(search): replace time module with datetime for timestamp generation

- Removed unused time import
- Added static method _now_ts using datetime.timestamp
- Updated clock parameter to use _now_ts method instead of time.time
- Maintained same timestamp precision and functionality

* fix(file_io): fix risk of out-workspace paths (#322)

* fix(file_io): fix risk of out-workspace paths

* chore(file_io): remove unused unittest file

* fix(as_embedding): support both agentscope 2.0.2 and 2.0.3 (#323)

2.0.3 promoted `dimensions` to a required first-class constructor
argument while keeping a backfill from `parameters.dimensions`; 2.0.2
has no such argument and reads `dimensions` from `Parameters`. Keep
`dimensions` in `Parameters` for both versions and, when the model
constructor accepts `dimensions`, pass `dimensions=None` so 2.0.3's
backfill promotes it out of `parameters`.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* Bump version to 0.4.0.7

* refactor: delegate LLM-as-Judge to answer_judge_step and update eval config/results

- run.py: replace inline judge logic with judge_response_via_job using app.run_job('answer_judge')
- longmemeval.yaml: expand benchmark configuration
- bench_query.py: enhance benchmark query step
- result-longmemeval.md: update evaluation results
- judge_all_plus_results.json: add judge all-plus results

* refactor: split longmemeval.yaml into lme.yaml/beam.yaml and unify job names

- Split reme/config/longmemeval.yaml into lme.yaml (LongMemEval) and beam.yaml (BEAM)
- Unify job names across both configs: agentic_answer, answer_judge, context_answer
- Update evaluation/longmemeval/run.py and evaluation/beam/run_beam_eval.py to use unified job names
- Update all evaluation config YAMLs to reference lme.yaml
- Add BEAM benchmark step implementations (agentic_answer, context_answer, llm_judge)
- Remove obsolete config_test5.yaml and test_5sessions.py

* eval: BEAM 100K & LongMemEval cleaned-S 评测结果记录

- BEAM 100K eval-only (32并发, 20 case): Agentic 0.631, Prompted 0.468
- LongMemEval final GT (500题): Agentic 89.0%, Prompted 83.6%
- 新增 benchmark/result-beam.md, benchmark/result-longmemeval.md
- benchmark/beam/config.yaml: num_workers=32

* refactor: restructure benchmark directory and clean up gitignore rules

- Consolidate benchmark outputs to benchmark/results/ with .gitkeep
- Remove old benchmark scripts, configs and result files from benchmark/beam/ and benchmark/longmemeval/
- Add datasets/README.md and datasets/README_EN.md with download instructions
- Add datasets/longmemeval/download.py and final_groundtruth_cleaned_s.json
- Add memory_workspaces .gitkeep placeholders
- Restructure .gitignore: fix duplicate entries, add BEAM dataset exclusion, refine logs/results ignore patterns
- Remove stale result-beam.md and result-longmemeval.md from project root

* chore: clean up longmemeval benchmark scripts and update dataset docs

- Remove obsolete longmemeval benchmark runner/stats scripts

- Update datasets/longmemeval README and add Chinese translation

- Clean up final_groundtruth_cleaned_s.json

* docs(benchmark): add reproduction guide for LongMemEval and BEAM

- Add bilingual README for benchmark runners (EN/ZH)

- Cover prerequisites, dataset download, run commands, configs, outputs, logs, and kill.sh

* refactor: migrate auto_memory steps from evolve to benchmark-specific modules

- Split auto_memory into beam and lme benchmark-specific implementations
- Add auto_memory.py and auto_memory.yaml under steps/benchmark/beam and steps/benchmark/lme
- Slim down evolve/auto_memory.py and auto_memory.yaml to shared base only
- Remove obsolete evolve/_auto_memory.yaml
- Update benchmark run.py, config YAMLs, and step __init__.py registrations
- Update llm_judge and context_answer minor adjustments
- Remove outdated test_lme_final_answer_review.py

* revert(as_agent_wrapper): sync with upstream/main

Remove local-only comment to keep file identical with upstream/main.

* style: add trailing commas in benchmark __init__.py __all__ lists

* chore: disable vector_weight range assertion in SearchStep

* chore: add tests/integration/logs/ to .gitignore

* refactor: replace scipy.stats.kendalltau with pure numpy implementation

scipy is not listed in project dependencies. Implement Kendall's tau-b
rank correlation using only numpy to remove the undeclared dependency.

* feat(benchmark): add binary score metrics, update BEAM 1M results, and improve LLM retry/prompt config

- benchmark/beam/run.py: add binary score calculation per rubric item and per-type/overall binary stats
- benchmark/beam/config.yaml: switch to 1M dataset, reduce workers to 18
- benchmark/result-beam.md: add 1M evaluation results with binary scores
- benchmark/result-longmemeval.md: minor formatting
- reme/config/beam.yaml: increase max_retries to 5 and add retry_delay 5.0 for all LLM components
- reme/config/lme.yaml: increase max_retries to 5 and add retry_delay for judge/prompted/bench components
- reme/steps/benchmark/lme/agentic_answer.yaml: improve search strategy and answer rules prompts

* fix(benchmark): fix line-too-long and add pylint disable for main()

* refactor(longmemeval): use single cleaned-S dataset with embedded ground truth

- Switch to agentscope-ai/ReMe_longmemeval_clean_s_v2 HuggingFace source
- Remove separate final_groundtruth_cleaned_s.json (ground truth now in data file)
- Simplify download.py to fetch only longmemeval_s_reme_cleaned.json
- Remove dataset.variant and dataset.ground_truth_path config options
- Update benchmark and datasets READMEs to reflect new workflow
- Update .gitignore for new dataset filename

* fix: rename loop variable to avoid pylint redefined-outer-name warning

* refactor(benchmark): restructure datasets/memory_workspaces into benchmark and simplify auto_memory steps

* refactor(benchmark): extract BaseAgenticAnswerStep into base module

- Add reme/steps/benchmark/base/agentic_answer.py with shared agentic answer logic
- Refactor beam/lme AgenticAnswerStep to inherit from BaseAgenticAnswerStep
- Simplify lme/context_answer.py and update context_answer.yaml
- Update result-longmemeval.md with latest evaluation results (agentic 91.0%)

* refactor(benchmark): remove context_answer steps and unused configs

- Remove beam/lme context_answer job definitions and step implementations
- Remove prompted LLM component from beam.yaml and lme.yaml
- Delete jinli_lme.yaml (no longer needed)
- Simplify benchmark run.py scripts
- Clean up .gitkeep files and update .gitignore
- Remove unused import in search.py

* chore: remove benchmark/results/.gitkeep

---------

Co-authored-by: sa-buc <jiangniurou.xyf@dail-algo011164204033.ET135>
Co-authored-by: jinliyl <6469360+jinliyl@users.noreply.github.com>
Co-authored-by: imrewce <wce@pku.edu.cn>
Co-authored-by: Sen Huang <48879559+ployts@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-21 19:09:50 +08:00
..
beam feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
datasets feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +08:00
longmemeval feat(benchmark): add BEAM & restructure LongMemEval evaluation framework (#375) 2026-07-21 19:09:50 +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: