Skip to content

test(longmemeval): temporal date-window boost (#1119) - #1126

Merged
ajianaz merged 3 commits into
developfrom
test/1119-temporal-boost
Aug 27, 2026
Merged

ajianaz merged 3 commits into
developfrom
test/1119-temporal-boost

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

What

  • temporal.py: regex-based temporal expression parser resolving phrases ("last month", "10 days ago", "four weeks ago", "last week", "between February and April", "in March", "before/after June") into a concrete (lo, hi) window anchored on question_date
  • boost_ranking(): additive RRF boost (+0.0022 default) for sessions inside the window
  • run_eval.py: --temporal flag (default OFF), --temporal-boost knob
  • modal_fast50.py: temporal flag propagated via shard spec (env vars don't reach Modal workers); volume cache variant-keyed (hybrid vs hybrid_temporal) to prevent stale resume
  • test_temporal.py: 21 unit tests (parser + boost math), all passing

Supersedes #1125 (auto-closed when its base branch merged; same head, retargeted to develop).

Why

Temporal reasoning is the single largest measured gap (12.8 Q-worth of k10→k5 loss in the 500Q run). Sessions with relevant dates systematically lose to old distractors because embeddings cannot see dates. A harness-side date-window boost is zero-model post-processing — consistent with the single-model (EmbeddingGemma) decision; no new downloads, no runtime deps. Default OFF preserves baseline behavior for A/B.

Testing

  • python3 test_temporal.py → 21/21 PASS (incl. between-wrap fix, boost boundary math)
  • python3 run_eval.py --help → flags present
  • Offline risk audit on fast50: 3/50 questions parseable, all answers in-window (0 danger cases), 1 rescue target at rank ~15 (r@50=1.0, r@5=0.0)
  • Modal fast50 A/B (paired, 43Q, same binary v0.15.0 + EmbeddingGemma):
    • Overall R@5: 0.9200 → 0.9267 (+0.67pp)
    • Overall R@10: 0.9767 → 0.9923 (+1.56pp)
    • temporal-reasoning R@5: 0.7821 → 0.8077 (+2.56pp)
    • Questions improved: 1 (gpt4_8279ba03 rescued from r@5=0.0 → 1.0), regressed: 0

- temporal.py: temporal expression parser -> (lo,hi) window; patterns:
  last-N, N-days/weeks-ago (digits+words), last week/month, between X-Y,
  before/after month, in-month, this month/year
- boost_ranking(): additive RRF boost for in-window sessions
- run_eval.py: --temporal flag (default OFF) + --temporal-boost (0.0022)
- modal_fast50.py: bake temporal.py into image; LMEVAL_TEMPORAL=1 passthrough
- test_temporal.py: 21 unit tests (parser + boost math), all passing
…volume cache

Two bugs in the A/B harness found before burning Modal credits:
- LMEVAL_TEMPORAL was read at module level inside the container, so the
  env var never reached the worker: a --temporal run would silently
  execute the baseline. The flag now travels through the shard spec.
- Shard cache keyed only by strategy: a temporal shard would resume
  from the stale 470Q baseline volume entry. Volume paths are now
  variant-keyed (hybrid vs hybrid_temporal).
@ajianaz
ajianaz force-pushed the test/1119-temporal-boost branch from db6b5ff to ba76118 Compare August 27, 2026 05:17
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (1)

  • benchmarks/longmemeval/run_eval.py:368 — The diff deletes store_path = args.store and replaces it with only a # Load data comment. recall_and_evaluate(args, store_path, entry, ...) (visible in the cross-file context at line ~276) takes store_path as a parameter, so if no other assignment to store_path exists in main(), running the harness will raise NameError. The replacement comment suggests the deletion was accidental rather than a refactor moving the assignment.

Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit e65f36a into develop Aug 27, 2026
16 checks passed
@ajianaz
ajianaz deleted the test/1119-temporal-boost branch August 27, 2026 05:50
ajianaz added a commit that referenced this pull request Sep 6, 2026