feat: standardized offline A/B benchmark template for feature validation - #60
feat: standardized offline A/B benchmark template for feature validation#60madhugoutham wants to merge 1 commit into
Conversation
8e35baa to
da434ea
Compare
|
mostly looks good. couple of points both i think fixable in this PR: The parity test never tests the thing it exists for. test_parity.py compares production against production. The handwritten fallback, the path CI and external users would actually run, ships completely unvalidated, while the PR checklist says "production parity verified." If the fallback drifts, every CI A/B verdict is computed on the wrong feature set with no signal that it happened. |
|
Good catches, both fixed. Removed the dead TPOT check, strengthened the parity test to verify actual values, and updated the README with the correct trace counts and seed differences. |
593b794 to
6150523
Compare
| "decode_tokens_in_flight", | ||
| "prefix_cache_score", | ||
| "effective_input_tokens", | ||
| "prefill_score_bucket", |
There was a problem hiding this comment.
add encoding related featurs
There was a problem hiding this comment.
did you test this with test_parity.py?
There was a problem hiding this comment.
Yes, tested locally parity check passes with encoder features added.
There was a problem hiding this comment.
i am getting this error:
$ python benchmarks/test_parity.py
2026-08-03 19:03:40,386 - INFO - Initialized LatencyPredictor with model type: xgboost, objective: quantile, quantile: 0.9
PARITY CHECK FAILED — fallback diverged from production:
TTFT column mismatch:
production: ['is_queued', 'kv_cache_percentage', 'input_token_length', 'num_request_waiting', 'num_request_running',
'prefill_tokens_in_flight', 'decode_tokens_in_flight',
'prefix_cache_score', 'effective_input_tokens', 'prefill_score_bucket', 'pod_type_cat']
fallback: ['is_queued', 'kv_cache_percentage', 'input_token_length', 'num_request_waiting', 'num_request_running',
'prefill_tokens_in_flight', 'decode_tokens_in_flight',
'encoder_matched_size', 'encoder_input_size', ← only in fallback
'prefix_cache_score', 'effective_input_tokens', 'prefill_score_bucket', 'pod_type_cat']
Update _add_derived_features_fallback() and resolve*_features() fallback lists to match production.
Fails because production omits the encoder columns when LATENCY_ENABLE_ENCODER_FEATURES is unset (default false) while the benchmark fallback always includes them. It only passes with the flag exported.
Suggested fixes:
Add an _enc_enabled() mirroring LATENCY_ENABLE_ENCODER_FEATURES in the fallback, symmetric with the existing _tif_enabled() — so fallback and production agree in every env.
In test_parity.py, pin both flags explicitly (set the env vars before importing production settings) so the test is deterministic regardless of the caller's shell.
Move the GOLDEN_FILE.write_text(...) to after the comparison succeeds, or behind an explicit --update-golden flag.
There was a problem hiding this comment.
follow up: i made LATENCY_ENABLE_ENCODER_FEATURES true by default so the test_parity.py shold be fien against the default setting. Would still be good to have the _enc_enabled flag
There was a problem hiding this comment.
I updated test_parity.py to pin both feature flags before import and to write golden_columns.json only after the parity check passes. I also kept _enc_enabled() in the fallback, and re-ran python benchmarks/test_parity.py to confirm it passes with the current production default.
|
|
||
| GOLDEN_FILE = Path(__file__).resolve().parent / "golden_columns.json" | ||
|
|
||
| SAMPLE_DF = pd.DataFrame( |
There was a problem hiding this comment.
t needs a handful of rows covering edge values (waiting=0, prefix_score 0 and 1, each pod_type) to actually pin down the formulas.
There was a problem hiding this comment.
Done expanded SAMPLE_DF to 5 rows covering waiting=0, prefix_score 0 and 1, and all three pod_type categories ("", "prefill", "decode").
|
/lgtm |
|
lgtm. leaving approval to @Gregory-Pereira to confirm if this has all the hooks for #15 eventually |
88e7a3e to
332d73d
Compare
|
Unsigned commits detected! Please sign your commits. For instructions on how to set up GPG/SSH signing and verify your commits, please see GitHub Documentation. |
Signed-off-by: Madhu Goutham Reddy Ambati <mambati@redhat.com>
332d73d to
1808b5b
Compare
What does this PR do?
Standardizes how latency predictor feature changes are validated. Every engineered feature PR (addition or removal) can now ship the same before/after evidence on a named workload calibration plots, reliability diagrams, error bars across seeds, convergence analysis, and a significance test so real signal is distinguishable from noise and regressions on the
untouched target are caught.
Includes:
offline_feature_ab.pycontention gate, shuffled-label self-test, N-seed A/B, calibration plots, reliability diagrams, SHAP importance, regression gate (fails on TTFT regression; TPOT contamination prevented by column-level assertion), paired significance testrun_validation.py— single-command runner with exit code 0/1 and machine-readable verdict (IMPROVED/NEUTRAL/REGRESSION)trace_recorder.py— stdlib-only recording proxy for capturing real EPP training entries to JSONLtest_parity.py— drift detection that validates fallback column names AND derived values against production (or column names against a committed golden file in CI)golden_columns.json— committed snapshot of production feature columns, used by CI to validate fallback parity without production codesharegpt-h200(3,400 samples, short conversations, moderate contention)chatbot-synthetic-h200(3,060 samples, long prompts, extreme contention)bimodal-h200(3,400 samples, mixed short+long, extreme contention)feature.env(5 seeds for fast screening; full evidence standard requires ≥10 viarun_validation.py)encoder_matched_size,encoder_input_size)--convergence) showing how feature delta evolves with sample countThis is the benchmarking infrastructure; it starts here and can migrate to llm-d-benchmark as it matures.
Why is this change needed?
As more features get added, we need a way to systematically say it's good or bad. Previously, feature validation was ad-hoc synthetic data, no calibration plots, no error bars, no workload spec. This template standardizes the evidence standard so every feature PR ships the same proof.
Key properties:
--featureis a required arg, any column works--traceaccepts any JSONL with 7 required fields; combine traces withcattest_parity.pyvalidates fallback columns and values against production, or columns against golden file in CIHow was this tested?
test_parity.py— forces fallback path and compares column names AND derived values against production (inside repo) or column names against golden file (CI)effective_input_tokens = 999in fallback correctly triggers parity failuresharegpt-h200.jsonl(3,400 samples, 96% contention),chatbot-synthetic-h200.jsonl(3,060 samples, 99% contention),bimodal-h200.jsonl(3,400 samples, 98% contention) — all gates passed, all artifacts generatedChecklist
git commit -s) per DCO