Repository navigation
Read the prediction stage for predict rows in the roadmap (#481) - #514
Merged
Merged
Conversation
The optimization roadmap gave every operation of an estimator the same end-to-end speedup. End to end is dominated by fit wherever fit is the slower stage, so SVC.predict was listed at 2.20x while the prediction stage of the same two headline rows ran at 6.87x and 3.33x. rank_optimization_opportunities.py now reads the fit stage for fit and the prediction stage for predict, predict_proba, decision_function and transform. Each row records which stage its number came from, and the end-to-end mean is kept beside it without feeding the ranking. A stage with no resolved timing yields no evidence. benchmarks/bench_predict_kernel_svc.flow and its .py counterpart time KernelSVC prediction alone across batch size, training-set size and feature count, and report the support-vector count on each side. No regime measured loses; the thinnest is 7.86x. benchmarks/test_rank_optimization_stages.py pins the stage mapping and runs in the existing validation step. The roadmap JSON and Markdown are regenerated from the committed inputs.
Owner
Author
|
CI on this PR, runs 44429778111 and 44429777955. Passing: Run all tests and examples (117 of 117), Canonical benchmark contract, Canonical 19/19 KMeans parity, FLOW syntax and imports, Python native package, sklearn execution architecture map, disparity-audit. The FLOW syntax and imports job ran the new Two jobs fail, and both fail the same way on unmodified
This PR changes no file under |
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.
Closes #481
Reproduction
There is no remaining inference loss to reproduce. On
mainat 645e6e4, one machine (Apple M4 Max, Accelerate, Flow toolchain at the CI pin 88aac509,-O3), withpython benchmarks/run_headline.py --repeats 7:The frozen CI artifact agrees in direction: predict at 6.87x on Iris and 3.33x on Digits. A CI run from today on the same prediction code (run 44422898477, AMD EPYC 9V45) measured 3.09x on Iris and 4.37x on Digits.
This PR changes no prediction code, so there is no before and after timing for the estimator. It adds the prediction-only evidence the issue asks for and fixes the generator that reported fit time as predict evidence.
Prediction-only curves
benchmarks/bench_predict_kernel_svc.flowandbenchmarks/bench_predict_kernel_svc.pybuild bit-identical float32 inputs, fit outside the timing window, and timepredictalone. Three classes,C=1,gamma = 1 / n_features,max_iter=1000on both sides. The training-set size moves the support-vector count, and each row reports the count each side ended with.No regime measured here loses. The thinnest is 7.86x. The two sides keep the same support vectors in ten of eleven cases and differ by one row in the other, and accuracy matches to three places everywhere.
The stale claim
benchmarks/OPTIMIZATION_ROADMAP.mdlistedSVC.predictat 2.20x. That number was the mean end-to-end speedup of the two KernelSVC rows, and end to end is dominated by fit.rank_optimization_opportunities.pygave every operation of an estimator the same end-to-end figure.The generator now reads the stage that times the operation:
fitreads the fit stage,predict,predict_proba,decision_functionandtransformread the prediction stage,observed_flow_speedup_basis, and the Markdown table has a Basis column,end_to_end_flow_speedupand is not used for ranking,Regenerated from the committed inputs with
python benchmarks/rank_optimization_opportunities.py:SVC.predictSVC.predict_proba,SVC.decision_functionSVC.fitKernelRidge.predictKernelRidge.fitGaussianNB.predictGaussianNB.fitThe correction runs in both directions.
KernelRidge.predictandGaussianNB.predictwere overstated by a fast fit.predict_probaanddecision_functionare not timed by the headline benchmark. They take the prediction-stage ratio as the nearest measured evidence, and the basis field says so.Tests
benchmarks/test_rank_optimization_stages.pypins the operation to stage mapping, the separation of stages on a row where fit loses and prediction wins, the exclusion of parity-unresolved rows, the handling of an unresolved stage, and runs the generator on the committed inputs to confirmSVC.predictcarries the prediction-stage mean. Against the generator onmainit fails at import. On this branch all 24 checks pass.It is added to the existing validation step in
.github/workflows/flow.yml, one line. No workflow is added.The other checks in that step all pass locally:
fixtures.py,verify_fixtures.py,test_generate_headline_summary.py,test_disparity_regression_policy.py,test_config_equivalence.py,publish_headline_v2.py --check,validate_execution_substrate.py, andvalidate_published_claims.py.No file under
lib/,tests/orexamples/changes, so the Flow test suite is the same as onmain, where it passed 106 of 106.Not done here
architecture_performance_map.jsonis left as committed. It reports one end-to-end figure per headline row against the fit substrate and makes no predict claim. Regenerating it locally would also move the substrate means thatREADME.mdquotes, which is the freeze job's work.optimization_roadmap.jsonandOPTIMIZATION_ROADMAP.mdare regenerated here. The freeze job onmainwill rewrite both from the CI run.exponce per query and support-vector pair. The vectorizable exponential added for [Perf #478] KernelRidge RBF predict: eliminate ~7.7x inference gap with batched kernel evaluation #488 would apply here once that lands. It is left out so this PR does not depend on that one.scaled_ci_history.jsonlost in two of five CI runs. Fit dominates those rows and belongs to [Perf #478] KernelSVC fit: match libsvm training efficiency without changing semantics #480.