Benchmark CLI follow-ups: clarify --backend help and include evaluator config in eval cache key#2552
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the olive benchmark CLI UX and fixes a correctness issue in Engine evaluation caching by ensuring cached evaluation results are keyed by the evaluator configuration (preventing stale cache reuse when evaluation parameters change).
Changes:
- Clarifies
olive benchmark --backendhelp text to describe lm-eval backend selection and requirements. - Updates
Engine._evaluate_modelevaluation cache key to incorporate a hash ofevaluator_config, preventing incorrect cache hits across differing eval settings. - Adds/updates tests to assert backward-compatible benchmark config output (no
model_classwhen--backend auto) and to validate cache hit/miss behavior based on evaluator config changes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
olive/engine/engine.py |
Includes evaluator-config hash in evaluation cache key to avoid stale cached evaluation reuse. |
olive/cli/benchmark.py |
Rewords --backend help text to clarify lm-eval scope and ONNX/ORTGenAI requirements. |
test/engine/test_engine.py |
Adds a unit test verifying evaluation cache hit/miss depends on evaluator config changes. |
test/cli/test_cli.py |
Adds assertions ensuring model_class is absent when backend is default/auto for HF and ONNX benchmark configs. |
jambayk
approved these changes
Jul 2, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
- Clarify --backend help text: lm-eval scope, ort/ortgenai require ONNX input, and ortgenai requires GenAI-packaged assets (genai_config.json). - Include a hash of the evaluator config in the evaluation cache key so changing the backend/model_class, lm-eval tasks/limit/batch_size, or metrics no longer reuses a stale cached result for the same model + accelerator. - Add model_class backward-compat assertions to test_benchmark_command_hfmodel/onnxmodel and a new engine cache-key test. Follow-ups to #2420.
2c0f495 to
2999ae8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Follow-ups to #2420 addressing the remaining (non-blocking) review comments.
olive benchmark--backendhelp text — Reworded to clarify it applies to lm-eval evaluation (not just "ONNX model evaluation"):ort/ortgenairequire ONNX input,ortgenaiadditionally requires GenAI-packaged model assets (e.g.genai_config.json), andautoinfers the backend from the model type.Evaluation cache key now includes the evaluator config —
Engine._evaluate_modelpreviously keyed the evaluation cache onmodel_id+ accelerator only, so re-running the same model with a different--backend(i.e.model_class), or different lm-evaltasks/limit/batch_size/metrics, would silently reuse a stale cached result. The key now folds inhash_dict(evaluator_config.to_json()), so any change to the evaluation parameters produces a distinct cache entry. The key is internal to_evaluate_model(only_load_evaluation/_cache_evaluationconsume it); footprints still record the rawmodel_id.Tests — Added
model_class-absent backward-compat assertions totest_benchmark_command_hfmodel/test_benchmark_command_onnxmodel, and a newtest_evaluate_model_cache_key_includes_evaluator_configengine test (same config → cache hit; different config → cache miss).Checklist before requesting a review
lintrunner -aolive benchmarkno longer reuses a cached evaluation result when re-running the same model with a different--backendor different lm-eval parameters; the--backendhelp text was also clarified.(Optional) Issue link
Follow-up to #2420.