|
| 1 | +# BEAM 1M Benchmark for XMem Python |
| 2 | + |
| 3 | +This harness benchmarks the Python XMem API on the BEAM dataset, defaulting to |
| 4 | +the `1M` split from `Mohammadta/BEAM` on Hugging Face. It does not run or |
| 5 | +compare the Go implementation. |
| 6 | + |
| 7 | +BEAM rows contain long `chat` histories and stringified `probing_questions`. |
| 8 | +The dataset card lists ten memory ability types: abstention, contradiction |
| 9 | +resolution, event ordering, information extraction, instruction following, |
| 10 | +knowledge update, multi-session reasoning, preference following, summarization, |
| 11 | +and temporal reasoning. |
| 12 | + |
| 13 | +## Dependencies |
| 14 | + |
| 15 | +BEAM is distributed as parquet. Install `pyarrow` before reading the downloaded |
| 16 | +dataset: |
| 17 | + |
| 18 | +```bash |
| 19 | +pip install pyarrow |
| 20 | +``` |
| 21 | + |
| 22 | +## Smoke Check |
| 23 | + |
| 24 | +```bash |
| 25 | +python -m benchmarks.beam.run \ |
| 26 | + --split 1M \ |
| 27 | + --download \ |
| 28 | + --dry-run \ |
| 29 | + --limit 1 |
| 30 | +``` |
| 31 | + |
| 32 | +This downloads the BEAM 1M parquet file, validates parsing, counts ingest items, |
| 33 | +and does not call XMem. |
| 34 | + |
| 35 | +## Run Against XMem |
| 36 | + |
| 37 | +```bash |
| 38 | +export XMEM_API_KEY="..." |
| 39 | + |
| 40 | +python -m benchmarks.beam.run \ |
| 41 | + --split 1M \ |
| 42 | + --dataset-path benchmarks/beam/data/1M-00000-of-00001.parquet \ |
| 43 | + --api-base-url https://api.xmem.in \ |
| 44 | + --output-dir benchmarks/beam/results/beam-1m |
| 45 | +``` |
| 46 | + |
| 47 | +To run a balanced slice, sample an equal percentage from each BEAM question |
| 48 | +type: |
| 49 | + |
| 50 | +```bash |
| 51 | +python -m benchmarks.beam.run \ |
| 52 | + --split 1M \ |
| 53 | + --dataset-path benchmarks/beam/data/1M-00000-of-00001.parquet \ |
| 54 | + --sample-percent-per-question-type 1 \ |
| 55 | + --api-base-url https://api.xmem.in \ |
| 56 | + --output-dir benchmarks/beam/results/beam-1m-1pct |
| 57 | +``` |
| 58 | + |
| 59 | +Outputs: |
| 60 | + |
| 61 | +- `results.jsonl`: full per-question records with local proxy metrics |
| 62 | +- `predictions.jsonl`: `question_id` and `hypothesis` |
| 63 | +- `summary.json`: local exact/contains/token-F1 grouped by BEAM question type |
| 64 | + |
| 65 | +## Judge Evaluation |
| 66 | + |
| 67 | +The benchmark runner writes the BEAM rubric for each question into |
| 68 | +`results.jsonl`. To compute BEAM-style pass rate and average judge score with an |
| 69 | +OpenAI judge model: |
| 70 | + |
| 71 | +```bash |
| 72 | +export OPENAI_API_KEY="..." |
| 73 | + |
| 74 | +python -m benchmarks.beam.evaluate \ |
| 75 | + --results-path benchmarks/beam/results/beam-1m-1pct/results.jsonl \ |
| 76 | + --output-dir benchmarks/beam/results/beam-1m-1pct |
| 77 | +``` |
| 78 | + |
| 79 | +This writes: |
| 80 | + |
| 81 | +- `evaluations.jsonl`: per-question rubric judge scores and reasons |
| 82 | +- `evaluation_summary.json`: pass rate and average judge score overall and by |
| 83 | + question type |
| 84 | + |
| 85 | +The pass threshold is `judge_score >= 0.5`, matching the usual BEAM pass-rate |
| 86 | +interpretation over rubric scores. |
0 commit comments