Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ jobs:
persist-credentials: false
- run: python3 -B -m unittest discover -s examples/decisions -p 'test_*.py'

eval-scripts:
name: python eval self-tests
runs-on: ubuntu-latest
# Stdlib only: no Cargo build and no model download. The sweep profile's
# one-knob check lives in e0_eval.py --self-test; retrieval_eval.py
# --self-test repeats it and checks the bench profile.
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: python eval self-tests
run: |
python3 scripts/e0_eval.py --self-test
python3 scripts/retrieval_eval.py --self-test
python3 scripts/prepare_e0_data.py --self-test
python3 scripts/experiments/e0s/memcap.py --self-test
bash scripts/experiments/e0s/run_e0s.sh --self-test

fmt:
name: rustfmt
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@
memories-export*.json

target-linux/

# Default data and output for scripts/experiments/e0s/run_e0s.sh.
/e0-data/
/e0s-results/
38 changes: 37 additions & 1 deletion scripts/e0_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,42 @@ def self_test() -> int:
raise SystemExit(f"bench lexical patch: {lexical}")
if "fused_rerank_floor_0.3" not in bench["arms"]:
raise SystemExit(f"bench arms: {bench['arms']}")
sweep = plan(fixture, "fixture", "bench-sweep", 0)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must-fix: this self-test is the PR's only test, and ci never runs it. .github/workflows/ci.yml runs check-version-sync, test-assemble-npm and the examples/decisions unittest, but nothing under scripts/e0_eval.py or scripts/retrieval_eval.py. with merge-on-green, that leaves the sweep profile untested at merge.

i ran python3 scripts/e0_eval.py --self-test at cc7b729 and it passes (e0 bench self-test ok). it's stdlib only and needs no binary.

passing means a ci step runs python3 scripts/e0_eval.py --self-test, plus python3 scripts/retrieval_eval.py --self-test if it's equally cheap, and it goes green on the head.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI job eval-scripts now runs e0_eval.py, retrieval_eval.py, prepare_e0_data.py and memcap.py with --self-test, plus run_e0s.sh --self-test. d4c4ac9

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closed at d4c4ac9. eval-scripts runs all 5 self-tests and went green on the merge ref. i ran the same 5 locally and all passed.

if sweep["arms"] != profiles.SWEEP_ARMS + ["vector (script extra)"]:
raise SystemExit(f"bench-sweep arms: {sweep['arms']}")
if sweep["mcp_args"] != bench["mcp_args"] or sweep["base"] != bench["base"]:
raise SystemExit("bench-sweep must share the bench base and MCP args")
patches = {arm: patch for arm, patch, _ in rs.BINARY_ARMS}
defaults = patches["fused_defaults"]
if defaults.get("broker.rerank_min_score") != "0.3" or defaults.get("embedder.reranker") in (None, '"off"'):
raise SystemExit(f"bench-sweep fused_defaults: {defaults}")
# lexical is the FTS baseline, not a one-knob fused variant. The vector arm
# is appended by plan() and has no config patch. Every other arm changes
# exactly the key named here.
expected_diff = {
"rerank_off": {"embedder.reranker"},
"tinybert_floor_0_fill_to_cap": {"broker.rerank_min_score"},
"tinybert_floor_0.1": {"broker.rerank_min_score"},
"tinybert_floor_0.2": {"broker.rerank_min_score"},
"semantic_floor_0": {"broker.min_semantic_score"},
"rrf_k60": {"broker.fusion"},
}
for arm, patch in patches.items():
if arm in ("lexical", "fused_defaults"):
continue
diff = {key for key in patch.keys() | defaults.keys() if patch.get(key) != defaults.get(key)}
if diff != expected_diff.get(arm):
raise SystemExit(
f"bench-sweep arm {arm} changes {sorted(diff)}, expected {sorted(expected_diff.get(arm, []))}"
)
if set(expected_diff) != set(patches) - {"lexical", "fused_defaults"}:
raise SystemExit(f"bench-sweep arms drifted from the one-knob set: {sorted(patches)}")
if patches["rerank_off"].get("embedder.reranker") != '"off"':
raise SystemExit(f"bench-sweep rerank_off: {patches['rerank_off']}")
if patches["tinybert_floor_0_fill_to_cap"].get("broker.rerank_min_score") != "0.0":
raise SystemExit(f"bench-sweep fill-to-cap: {patches['tinybert_floor_0_fill_to_cap']}")
if patches["rrf_k60"].get("broker.fusion") != '"rrf"' or patches["semantic_floor_0"].get("broker.min_semantic_score") != "0.0":
raise SystemExit("bench-sweep rrf/semantic arms lost their knob")
script = plan(fixture, "fixture", "script", 0)
if script["mcp_args"].get("min_semantic_score") != 0.0:
raise SystemExit(f"script plan dropped min_semantic_score: {script['mcp_args']}")
Expand All @@ -278,7 +314,7 @@ def main() -> int:
parser.add_argument("--bin")
parser.add_argument("--dataset", type=Path)
parser.add_argument("--name")
parser.add_argument("--profile", choices=("bench", "script"), default="bench")
parser.add_argument("--profile", choices=("bench", "bench-sweep", "script"), default="bench")
parser.add_argument("--out", type=Path, help="JSONL rows (retrieval_eval format + dataset/scored)")
parser.add_argument("--config-only", action="store_true")
parser.add_argument("--limit", type=int, default=0)
Expand Down
Loading
Loading