# Can any model actually write current Rust?

**URL:** <https://discuss.huggingface.co/t/can-any-model-actually-write-current-rust/72148>\
**Category:** Models\
**Created:** [February 6, 2024, 5:46pm UTC](https://discuss.huggingface.co/t/can-any-model-actually-write-current-rust/72148 "2024-02-06T17:46:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![boeroboy](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/boeroboy/32/23631_2.png) [@boeroboy](https://discuss.huggingface.co/u/boeroboy)\
**Post date:** [February 6, 2024, 5:46pm UTC](https://discuss.huggingface.co/t/can-any-model-actually-write-current-rust/72148/1 "2024-02-06T17:46:12Z")

</div>

![Screenshot_20240206_125925](https://us1.discourse-cdn.com/hellohellohello/original/3X/5/c/5cfa0531fa30a6c15b4d005c03af45a233576222.png)  
CodeLlama-2-70B doing creative x86\_64 assembly.

I love how these models are evolving and can even work with assemby but it seems that Rust is evolving even faster than them. Even CodeLlama-2-70B struggles in my case with this simple challenge:

```auto
Please write a sample Rust app to read a JSON file test.json and validate it against a JSON schema file schema.json.

```

Often it will give deprecated cargo crates or obsolete code which won’t compile or really just code that compiles but won’t do the job. I find this same behavior with Bard, ChatGPT and everything I’ve tried besides GPT-4, which managed to do it in three tries.

Can anybody find an open source model that can generate a clean code snippet to do this in Rust?

---

<div class="post-metadata">

**Author:** ![CKeibel](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ckeibel/32/55416_2.png) [@CKeibel](https://discuss.huggingface.co/u/CKeibel)\
**Post date:** [February 7, 2024, 1:04pm UTC](https://discuss.huggingface.co/t/can-any-model-actually-write-current-rust/72148/2 "2024-02-07T13:04:56Z")

</div>

I can’t imagine that anyone currently keeps a Rust code model up to date due to a lack of data and computing capacity to constantly retrain it.

I think the best approach is to use Bing chat, which looks up sources from the internet and then writes an answer based on the sources ( kind of like a RAG). This is probably the best appraoch at the moment but I don’t want to go too far out on a limb, these are just my thoughts on it 😅

---

<div class="post-metadata">

**Author:** ![CireSnave](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ciresnave/32/27003_2.png) [@CireSnave](https://discuss.huggingface.co/u/CireSnave)\
**Post date:** [May 15, 2024, 6:19pm UTC](https://discuss.huggingface.co/t/can-any-model-actually-write-current-rust/72148/3 "2024-05-15T18:19:14Z")

</div>

Cody combines any of several LLMs with sourcegraph and generates pretty good Rust code for me.
