Answers.Body: <p>I think you mentioned the most important points.</p>
  <p>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!</p>
  <p>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.</p>
  <p>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).</p>
  <p>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.</p>
  <p>Btw, there are some scripting languages based on Rust (e.g. <a href="https://github.com/rhaiscript/rhai" rel="nofollow noreferrer">rhai</a>), 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-06T11:52:33.193Z
Answers.LastActivityDate: 2023-01-06T12:18:27.763Z
Answers.LastEditDate: 2023-01-06T12:18:27.763Z
Answers.UserDisplayName: nbro
Body: <p>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)</p>
  <p>What I know so far:</p>
  <ul>
  <li>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)</li>
  <li>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</li>
  <li>Anecdotally, Rust has a rather steep learning curve (unlike Python) and that might scare away ML practitioners without solid CS background.</li>
  <li>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 <a href="https://github.com/google/evcxr" rel="noreferrer">jupyter kernel for Rust</a>, so creating an interactive dev environment does not seem to be impossible.</li>
  </ul>
  <p>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</p>
  <ul>
  <li><a href="https://github.com/huggingface/tokenizers" rel="noreferrer">Hugging Face's Tokenizers library</a></li>
  <li><a href="https://github.com/google-research/deduplicate-text-datasets" rel="noreferrer">Google's Deduplication library</a></li>
  </ul>
  <p>So modulo the anecdotal steep learning curve, Rust looks like a good programming language for doing &quot;all kind of stuff&quot; in AI. Evidences to counter this opinion are especially welcome.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-08-31T20:53:55.750Z
Comments.Text: 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.
Comments.UserDisplayName: alexzander
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-01-06T10:19:19.613Z
Comments.Text: 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
  https://github.com/AhmedBoin/Perceptrons
Comments.UserDisplayName: Mohamed A. Taha
Tags: <machine-learning><deep-learning><programming-languages><rust>
Title: Whys and Why-nots using Rust for AI
UserDisplayName: hongshan.li
ThreadText: # Whys and Why-nots using Rust for AI
  
  (Asked by: username_0 on 2022-07-31)
  
  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](https://github.com/google/evcxr), 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
  
  * [Hugging Face's Tokenizers library](https://github.com/huggingface/tokenizers)
  * [Google's Deduplication library](https://github.com/google-research/deduplicate-text-datasets)
  
  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.
  
  **Tags:** machine-learning, deep-learning, programming-languages, rust
  > **Comments:**
  > **username_1**: 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.  
  > **username_2**: 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 https://github.com/AhmedBoin/Perceptrons  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2023-01-06. Score: 4
  
  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](https://github.com/rhaiscript/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.
  
  
  ---
  
  