pi-smart-router 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -568,8 +568,57 @@ At runtime, `ClusterMatcher` prefers `routing_centroids` from the calibration bu
|
|
|
568
568
|
|
|
569
569
|
Below these thresholds the train path returns bootstrap centroids unchanged. The verify script reports `oats_refinement` metadata when refinement ran.
|
|
570
570
|
|
|
571
|
+
These guards match `DEFAULT_OATS_MIN_POSITIVE_SAMPLES` / `DEFAULT_OATS_MIN_NEGATIVE_SAMPLES` in `scripts/lib/oats-centroid-refinement.ts` and `MINIMUM_TRAINING_SAMPLES.routing_centroids` (10) in `scripts/calibration-aggregate.ts`. The same global floors appear under `minimum_training_samples` in [`config/routing-calibration.json.example`](config/routing-calibration.json.example) (`hydra_projection` 100, `triage_thresholds` 50, `p_success_weights` / `isotonic_calibrator` 30, `routing_centroids` 10).
|
|
572
|
+
|
|
571
573
|
See [routing-roadmap.md](docs/routing-roadmap.md) §2 P2 OATS and GitHub [#77](https://github.com/beettlle/pi-smart-router/issues/77).
|
|
572
574
|
|
|
575
|
+
### Privacy-safe label packs + calibration dry-run (SP-189–SP-191 / #102)
|
|
576
|
+
|
|
577
|
+
Offline **label packs** are feature-vector + binary-outcome JSONL (never prompt/message text). Schema: `scripts/lib/label-pack-schema.ts`. Provenance, pins, and field maps: [`tests/eval/corpus/label-packs/PROVENANCE.md`](tests/eval/corpus/label-packs/PROVENANCE.md).
|
|
578
|
+
|
|
579
|
+
**Regenerate packs (offline / no network for CI fixtures):**
|
|
580
|
+
|
|
581
|
+
```bash
|
|
582
|
+
# SWE-Gym verifier-style → pack
|
|
583
|
+
npm run routing:ingest-swe-gym -- \
|
|
584
|
+
--input tests/eval/corpus/label-packs/swe-gym/ci-fixture.jsonl \
|
|
585
|
+
--output /tmp/swe-gym-pack.jsonl
|
|
586
|
+
|
|
587
|
+
# FC-RewardBench preference / flat → pack
|
|
588
|
+
npm run routing:ingest-fc-rewardbench -- \
|
|
589
|
+
--input tests/eval/corpus/label-packs/fc-rewardbench/ci-fixture.jsonl \
|
|
590
|
+
--output /tmp/fc-rewardbench-pack.jsonl
|
|
591
|
+
|
|
592
|
+
# Optional weak TwinRouterBench tier proxy (exclude from holdout ECE)
|
|
593
|
+
npm run routing:ingest-twinrouterbench-weak -- \
|
|
594
|
+
--input tests/eval/corpus/label-packs/twinrouterbench-weak/ci-fixture.jsonl \
|
|
595
|
+
--output /tmp/trb-weak-pack.jsonl
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
**Calibration dry-run (holdout ECE):**
|
|
599
|
+
|
|
600
|
+
```bash
|
|
601
|
+
# CI fixtures (ingests packs in-memory; sample-starved → report-only)
|
|
602
|
+
npm run routing:calibration-dry-run
|
|
603
|
+
|
|
604
|
+
# Operator packs (schema-valid JSONL)
|
|
605
|
+
npm run routing:calibration-dry-run -- --packs /tmp/swe-gym-pack.jsonl /tmp/fc-rewardbench-pack.jsonl
|
|
606
|
+
|
|
607
|
+
# Soft ECE advisory fail (threshold 0.25 calibrated ECE; not a release-gate absolute)
|
|
608
|
+
npm run routing:calibration-dry-run -- --packs /tmp/swe-gym-pack.jsonl --enforce-soft-ece
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
Dry-run behavior:
|
|
612
|
+
|
|
613
|
+
| Condition | Result |
|
|
614
|
+
|-----------|--------|
|
|
615
|
+
| < 30 ECE-eligible rows | `SAMPLE_STARVED` report-only (exit 0); no soft pass/fail |
|
|
616
|
+
| ≥ 30 ECE-eligible rows | Fit logistic + isotonic; report `holdout_ece_raw` / `holdout_ece_calibrated` |
|
|
617
|
+
| Rows with `exclude_from_holdout_ece` | Counted separately; **never** enter holdout ECE metrics (weak TwinRouterBench) |
|
|
618
|
+
| Soft threshold | Advisory `0.25` calibrated ECE — **does not** change `config/release-gates.json` |
|
|
619
|
+
|
|
620
|
+
**#96 / `modernbert_k4` advisory:** when deciding whether to enable ModernBERT K=4 heads, use **pack holdout ECE / Top-1 error on verifier-grade packs** (SWE-Gym + FC-RewardBench), not fixture-only QR. Weak TwinRouterBench rows are warm-start only. This task does **not** flip `modernbert_k4` defaults.
|
|
621
|
+
|
|
573
622
|
### Operator tuning (frugality slider)
|
|
574
623
|
|
|
575
624
|
The multi-objective scoring weights control the cost-vs-quality tradeoff:
|
|
@@ -793,6 +842,10 @@ Contributors must run `npm run build` before publishing or consuming the library
|
|
|
793
842
|
| `npm run routing:train-calibration` | Train routing calibration artifact bundle |
|
|
794
843
|
| `npm run routing:train-p-success` | Train standalone `config/p-success-weights.json` (synthetic fixture by default) |
|
|
795
844
|
| `npm run routing:verify-calibration` | Verify calibration bundle against benchmark prompts |
|
|
845
|
+
| `npm run routing:calibration-dry-run` | Pack-fed isotonic dry-run: holdout ECE on label packs (CI fixtures by default) |
|
|
846
|
+
| `npm run routing:ingest-swe-gym` | Convert SWE-Gym verifier-style JSONL → privacy-safe label pack |
|
|
847
|
+
| `npm run routing:ingest-fc-rewardbench` | Convert FC-RewardBench JSONL → privacy-safe label pack |
|
|
848
|
+
| `npm run routing:ingest-twinrouterbench-weak` | Convert TwinRouterBench weak tier labels → pack (exclude from ECE) |
|
|
796
849
|
| `npm run routing:ingest-benchmarks` | Regenerate `config/benchmark-profiles.json` from leaderboard fixtures |
|
|
797
850
|
| `npm run routing:verify-benchmark-profiles` | CI smoke: assert checked-in profiles match fixture ingest |
|
|
798
851
|
| `npm run routing:eval-replay` | Counterfactual replay on eval trace fixtures |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-smart-router",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Auto-model router middleware for the pi.dev coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,12 +67,16 @@
|
|
|
67
67
|
"routing:ingest-benchmarks": "tsx scripts/ingest-benchmark-profiles.ts",
|
|
68
68
|
"routing:verify-benchmark-profiles": "vitest run tests/unit/ingest-benchmark-profiles.test.ts -t \"checked-in artifact matches fixture ingest\"",
|
|
69
69
|
"routing:verify-calibration": "bash -c 'if [[ \" $* \" == *\" --skip-embed \"* ]]; then vitest run tests/unit/train-routing-calibration.test.ts -t \"verifyRoutingCalibration passes|evaluates benchmark triage gates\"; else npm run build && tsx scripts/verify-routing-calibration.ts \"$@\"; fi' --",
|
|
70
|
+
"routing:calibration-dry-run": "tsx scripts/verify-routing-calibration.ts --dry-run-packs",
|
|
70
71
|
"routing:eval-replay": "tsx scripts/eval/counterfactual-replay.ts",
|
|
71
72
|
"routing:eval-harness": "tsx scripts/eval/run-harness.ts",
|
|
72
73
|
"routing:eval-harness:smoke": "tsx scripts/eval/run-harness.ts --summary-only",
|
|
73
74
|
"routing:eval-harness:corpus-smoke": "tsx scripts/eval/run-harness.ts --fixtures tests/eval/corpus/twinrouterbench --summary-only",
|
|
74
75
|
"routing:assert-release-gates:corpus-report": "tsx scripts/eval/assert-release-gates.ts --fixtures tests/eval/corpus/twinrouterbench --report-only",
|
|
75
76
|
"routing:ingest-twinrouterbench": "tsx scripts/eval/ingest-twinrouterbench-corpus.ts",
|
|
77
|
+
"routing:ingest-swe-gym": "tsx scripts/ingest-swe-gym-labels.ts",
|
|
78
|
+
"routing:ingest-fc-rewardbench": "tsx scripts/ingest-fc-rewardbench-labels.ts",
|
|
79
|
+
"routing:ingest-twinrouterbench-weak": "tsx scripts/ingest-twinrouterbench-weak-labels.ts",
|
|
76
80
|
"routing:capture-baseline": "tsx scripts/eval/capture-baseline.ts",
|
|
77
81
|
"routing:test-projection": "npm run build && node --experimental-strip-types scripts/test-hydra-projection.ts",
|
|
78
82
|
"benchmark:encoder": "tsx scripts/benchmark-encoder-latency.ts",
|