# Why PyTorch is faster than sklearn models?

Recently, I get to know about the hummingbird library for Python. I trained a RandomForest on a 10M-sized dataset with 2 labels. With sklearn it was taking 450 ms for inference. But after converting the same model to PyTorch, now it takes 128ms on CPU inference.

If both are running on the CPU, then why hummingbird's Pytorch model is faster than sklean model?

I am not getting what hummingbird does to my sklearn model to increases speed.

• Are you using all cores? Jun 23 '20 at 13:46

• The idea is to use the profiler to dig around and isolate the bottlenecks deeper in the call graph of your program than the .profile method. Jun 23 '20 at 8:17
• Sorry, not .profile, I meant .predict. Jun 23 '20 at 8:50