-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PredictionEngine benchmark test #1013
Comments
Adds a benchmark test to measure performance of doing many single predictions with PredictionEngine. Closes #1013
Edit: Adding prediction runtimes for the legacy BenchmarksIn the ML.NET 0.6 release, we made a couple of performance improvements in making single predictions from a trained model. The first improvement comes from moving from the legacy Here is a comparison of runtimes for single predictions between the old
Predictions with
|
Method | Mean | Error | StdDev |
---|---|---|---|
MakeIrisPredictions | 9.879 s | 0.1461 s | 0.1295 s |
MakeSentimentPredictions | 10.225 s | 0.0915 s | 0.0856 s |
MakeBreastCancerPredictions | 8.850 s | 0.1622 s | 0.1518 s |
Predictions with Estimators
API, old PredictionFunction
:
Method | Mean | Error | StdDev |
---|---|---|---|
MakeIrisPredictions | 338.0 ms | 4.951 ms | 4.389 ms |
MakeSentimentPredictions | 447.7 ms | 7.453 ms | 6.607 ms |
MakeBreastCancerPredictions | 148.2 ms | 2.317 ms | 2.054 ms |
Predictions with Estimators
API, new improved PredictionFunction
:
Method | Mean | Error | StdDev |
---|---|---|---|
MakeIrisPredictions | 3.019 ms | 0.0388 ms | 0.0363 ms |
MakeSentimentPredictions | 51.575 ms | 0.3298 ms | 0.3085 ms |
MakeBreastCancerPredictions | 1.353 ms | 0.0059 ms | 0.0055 ms |
@najeeb-kazmi , is this |
This is old |
@Zruty0 @GalOshri @shauheen @TomFinley @justinormont I've updated the numbers with prediction runtimes with the |
Um wow. Still, 1.353 ms per 10k on BC means, 135 nanoseconds per cycle, which will correspond on a typical machine to around a few hundred CPU cycles. A few hundred CPU cycles for 9 multiplies, followed by 9 multiply-adds, followed by the application of a logistic function, is at least somewhat understandable, but suggests to me that there may be some additional speedups here and there to be had. But at least the situation is not ridiculous. |
@adamsitnik curious whether the traces you shared earlier are of the fast case above. @TomFinley dowe have profile evidence that the time spent is dominated by "9 multiplies, followed by 9 multiply-adds, followed by the application of a logistic function"? If so that seems like something that may be amenable to eg @tannergooding looking at such factors as code gen and whether there is possibly another intrinsic we could use. |
Add benchmark test to measure performance of single predictions made by PredictionEngine.
The text was updated successfully, but these errors were encountered: