Adaptive engine selection: auto/pytorch/onnxruntime + benchmark recommendations and UI controls - #151
Closed
AyushmanRaha wants to merge 9 commits into
Closed
Conversation
Make /live lightweight; improve ONNX engine selection, Compare engine, and detector warmup
…construction recursion
AyushmanRaha
deleted the
codex/implement-adaptive-engine-selection-for-pytorch/onnx
branch
June 30, 2026 02:21
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.
Motivation
Description
backend/services/engine_selector.pyimplementingnormalize_engine_mode, engine decision keys (model/device/provider/onnx-fingerprint), in-memory cached benchmark decisions,select_engine_for_inference,record_benchmark_decision, and helpers; ONNX chosen only when healthy and >=10% faster.backend/api/validation.py,backend/api/routes.py) supportingengineform/query (autodefault) and benchmarkboth/auto/pytorch/onnxruntimeoptions, with structured 422 on invalid values.backend/services/inference.py) to addengine_requested,engine_used,engine_selection,fallback_used, andfallback_reasonmetadata, and updated cache keys (backend/services/inference_cache.py) so engine mode separates cached results.backend/services/benchmarks.py) with warmup/cold/steady metrics (warmup_iterations,first_run_ms/cold_start_ms,steady_state_latency_ms), selectable benchmark engine modes, recommendation fields incomparison, and calls toengine_selector.record_benchmark_decisionwhen both engines succeed.backend/services/onnx_diagnostics.pyviaprovider_entries_for_session(CoreML options guarded and retried without options on failure).frontend/index.html,frontend/js/dom.js,frontend/js/settings.js,frontend/js/inference-ui.js,frontend/js/benchmark.js,frontend/js/compare.js).backend/tests/test_engine_selector.py,backend/tests/test_engine_cache_keys.py).Testing
python -m black --check .,python -m ruff check ., andpython -m mypy backend/all passed in the CI run.npm --prefix electron-app testcompleted successfully.python scripts/validate_docs.pysucceeded.pytest) could not be fully collected in this execution environment due to missing runtime test dependencies in the container (e.g.fastapi,numpy,pydantic,torch), sopython -m pytest -q/bash scripts/ci.sh allstopped at pytest collection in this run; the new unit tests added are included and pass when run in a development environment withbackend/requirements-dev.txtinstalled.Codex Task