Live data from Hacker News

Python vs. Rust for Neural Networks

ngoldbaum.github.io

11–20 of 149 posts

Re: Python vs. Rust for Neural Networks

#11
post #2

>> Is rust suitable for data science workflows? >> Right now I have to say that the answer is “not yet”. I’ll definitely reach for rust in the future when I need to write optimized low-level code with minimal dependencies. However using it as a full replacement for python or C++ will require a more stabilized and well-developed ecosystem of packages. I'm not sure rust is really aiming to be something used for data sc…

There is this https://www.arewelearningyet.com/

Re: Python vs. Rust for Neural Networks

#12
Nobody writing NN in Python, they are just describing it.

For NN or DL in general, the correctness doesn't really lie too much on the code quality level, like ownership Rust people love to talk about. It is more about Numeric stability under/overflow and such. Choice of programming language offers limited help here.

I don't think Rust has a killer app for ML/DL community to offer as of now, the focus is vastly different.

Re: Python vs. Rust for Neural Networks

#13

This approach I think is missing the point. You will write highly optimized libraries in Rust, and then use those in Python. This is why Python has eaten the world. Not because its the best at any one thing, except bringing all those things together - at which it is unparalleled, and is unlikely to be surpassed anytime soon. numpy, scipy, pandas, tensorflow all those have very little actual Python code, its c++ and e…

Tensorflow is now having Swift support and then there is XLA.

Thanks to ML.NET, I can enjoy .NET JIT/AOT compilers performance, while binding to the same Tensorflow C++ libraries that are wrapped for Python.

Swift and Kotlin enjoy similar bindings on their respective mobile platforms.

Then there is Julia.

Python might have gotten there first, but its kingdom is already getting slowly eroded.

Re: Python vs. Rust for Neural Networks

#15
post #13

This approach I think is missing the point. You will write highly optimized libraries in Rust, and then use those in Python. This is why Python has eaten the world. Not because its the best at any one thing, except bringing all those things together - at which it is unparalleled, and is unlikely to be surpassed anytime soon. numpy, scipy, pandas, tensorflow all those have very little actual Python code, its c++ and e…

Tensorflow is now having Swift support and then there is XLA. Thanks to ML.NET, I can enjoy .NET JIT/AOT compilers performance, while binding to the same Tensorflow C++ libraries that are wrapped for Python. Swift and Kotlin enjoy similar bindings on their respective mobile platforms. Then there is Julia. Python might have gotten there first, but its kingdom is already getting slowly eroded.

For God's sake, there are some folks starting to implement BLAS in Julia, so I have high hopes for the language

Re: Python vs. Rust for Neural Networks

#17
post #10

Neural network libraries (Tensorflow, Pytorch) have a C++ backend and a Python interface. Which is great - you get a performant compiled language as the backend and a flexible user-friendly language as the interface. Rust vs Python is a weird question because in reality no one writes their own neural network with numpy, and no one expects Rust to act like an interpreted language suitable for data science workflows. I…

Yeah, this is the real point.

Python is an interface to C, C++, and FORTRAN for a lot of stuff. There are even crossover libs for running R.

This is like comparing apples and steaks.

Re: Python vs. Rust for Neural Networks

#18

This approach I think is missing the point. You will write highly optimized libraries in Rust, and then use those in Python. This is why Python has eaten the world. Not because its the best at any one thing, except bringing all those things together - at which it is unparalleled, and is unlikely to be surpassed anytime soon. numpy, scipy, pandas, tensorflow all those have very little actual Python code, its c++ and e…

I think you're being unnecessarily dismissive of discussions surrounding python's fitness, and I find your remark "that's exactly how it should be" confusing.

Python is an ok interface language, in that it's script-like, dynamically typed and simple to comprehend. It's popular, which makes on-boarding efficient due to the sheer volume of tutorials online. And, it has built up a large ecosystem, because of the last two points.

That said, it's naive to suppose that python is the currently-ideal or future-ideal interface language. It's just ok, plus it's popular.

Re: Python vs. Rust for Neural Networks

#19
post #2

>> Is rust suitable for data science workflows? >> Right now I have to say that the answer is “not yet”. I’ll definitely reach for rust in the future when I need to write optimized low-level code with minimal dependencies. However using it as a full replacement for python or C++ will require a more stabilized and well-developed ecosystem of packages. I'm not sure rust is really aiming to be something used for data sc…

There are people working on language features that will get Rust closer to parity with C++ for numerical computing, most prominently "const generics", which will make it more ergonomic to write numeric libraries (see C++'s Eigen) that use static array sizes. This will ultimately be important for how aggressively the compiler can optimize the code, via eliminating bounds checks, etc.

Re: Python vs. Rust for Neural Networks

#20

Nobody writing NN in Python, they are just describing it. For NN or DL in general, the correctness doesn't really lie too much on the code quality level, like ownership Rust people love to talk about. It is more about Numeric stability under/overflow and such. Choice of programming language offers limited help here. I don't think Rust has a killer app for ML/DL community to offer as of now, the focus is vastly differ…

I've had a few Rust lovers come and mention this project to me recently. None of them had any data science or ML experience. None of them knew that Python is just used to define the high level architecture.

At the same time, comparatively tedious languages like Rust will never attract data science practitioners. They don't care about the kind of safety it brings, they don't care about improving performance in a component that's idle 99% of the time.

The bulk of the load in an DL workflow is CUDA code and sits on the GPU. Even the intermediate libraries like cublas would only see marginal-to-none benefits of being reimplemented in rust.

This is a cool project, but it has no chance to displace or even complement Python in the data science space.

Post reply on HN