Is Rust good for deep learning and artificial intelligence?

Semi-official binding exists

1 Like

"Rust for TensorFlow" is something completely different from Rust binding to TensorFlow.

Sorry, didn't read carefully. I see what you mean! hesitant though! justification is lacking imho.

Maybe off topic but take a look at https://www.weld.rs/

1 Like

So I don't think Rust is great for doing training, but I have a clone of the AlphaZero algorithm (which is a flavor of Monte Carlo tree search), written in Rust, but using the Rust TensorFlow bindings when it needs to do inference, and Python for training.

Rust was a great fit for this project because the AZ algorithm is abstract, and it works for any two-player game with rules you can encode into a computer program. In Rust, this translates into implementing a trait - the GameExpert trait, and then calling the library to start sampling the game space and finding better moves.

Rust made it easy to efficiently break the implementation of a GameExpert into a separate crate from the implementation of the fairly complicated tree searching algorithm.

It's also reasonable for this application to use Tensorflow Serving (C++ RPC server) to do the forward inferences that are necessary when playing a game.

Before Rust could be the implementation language for an inference/training library, I think it will need const generics. (This applies for a lot of numerical applications besides machine learning).

Also agree with above that Rust For TensorFlow would be a great addition to Rust.

2 Likes

Sorry I am not at all knowledgeable about ML or anything like that, but I am curious: why do you need const generics?

So the compiler can generate efficient implementations of matrix operations for matrices of arbitrary dimensions.

1 Like

Next question: why isn't it in the language? Is there any technical reason? I am not sure where, so more experienced forum users should help, but you can discuss this with the language design team somewhere.

It's a SMOP ("Simple Matter of Programming")

https://github.com/rust-lang/rfcs/blob/master/text/2000-const-generics.md

Snips, an edge AI company, is working on an inference engine for TensorFlow models and ONNX models written in Rust. Apparently it is faster than TensorFlow Lite!

https://github.com/snipsco/tract

5 Likes

So this interface engine, is it an AI library?

Yes, Tract is an AI library. You can use it to run models. You cannot use it to train models.

1 Like

Wonderful explanation. Thank you jbowles.

1 Like

Professional mathematician who can code, in the process of picking up rust. Also looking for work. Is anyone looking to support this kind of development? Is some institution already doing it?

7 Likes