7
$\begingroup$

The title says it all. I would like to know more about what attributes and design choices of Rust that make it a good (or bad) language for the entire ecosystem of AI (both research and production)

What I know so far:

  • Rust is memory safe (unlike C) and highly performant (like C). This make Rust a good choice for building heavy lifting compute engine (like kernels in TensorFlow and PyTorch)
  • Rust supports real multithreading (unlike Python) and that can potentially make it a good language for building distributed training libraries for training deep learning models
  • Anecdotally, Rust has a rather steep learning curve (unlike Python) and that might scare away ML practitioners without solid CS background.
  • Rust does not support scripting (unlike Python) and that might make it unsuitable for quickly exploring and prototyping ML ideas. But I am not really sure about this point. There are jupyter kernel for Rust, so creating an interactive dev environment does not seem to be impossible.

Some subfields of AI (like NLP) has become engineering heavy in the recent years. Even in research, much of effort is on curating large datasets. Two important libraries are built with Rust to purposefully handle challenges coming from curating large dataset

So modulo the anecdotal steep learning curve, Rust looks like a good programming language for doing "all kind of stuff" in AI. Evidences to counter this opinion are especially welcome.

$\endgroup$
2
  • $\begingroup$ rust is really good at everything, including machine learning. the first downside is it will be harder to code, cuz the language is hard. and also people say that rust ai libraries are not mature enough like python ones, (second downside) but they will be mature soon. $\endgroup$
    – alexzander
    Commented Aug 31, 2022 at 20:53
  • $\begingroup$ That’s right ML library’s is not good enough like python but I tried to make somethink like pytorch in rust take a look github.com/AhmedBoin/Perceptrons $\endgroup$ Commented Jan 6, 2023 at 10:19

1 Answer 1

4
$\begingroup$

I think you mentioned the most important points.

I love Rust, but I believe that most ML/AI practitioners and researchers would find it harder to use and it would slow them down - many AI/ML practitioners don't have a very solid knowledge of or care about software engineering principles or systems programming, some come from other fields. Arguably, Rust is as hard to learn as C and maybe C++, although, unlike those languages, Rust will try to protect/help the programmer. So, Rust really has a steeper learning curve (compared to Python) - this is not an anecdote!

People use Python because it's a relatively easy language and it's very suited for prototyping new ideas quickly. However, in reality, most libraries are written in C++ or C, like TensorFlow or NumPy, otherwise ML programs would be quite slow. They just provide a Python interface.

Rust would be a good choice for writing libraries like TensorFlow, but there are already many such libraries. So, not many people want to invest time to rewrite them in Rust - there have been some attempts to write ML libraries in Rust, but often people gave up after a while (I suppose because they didn't get much attention or financial support - the Rust community is still quite small).

Having said that, I believe that Rust will still have an important role in AI, so not just ML, if the Rust community continues to grow.

Btw, there are some scripting languages based on Rust (e.g. rhai), so they could be used as an interface to some low-level code written in Rust, but you could also use Python, and that's what people should also try to do it, i.e. provide Python interfaces to Rust applications, in order to attract more people.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .