Intro0:00
Hello, welcome to my talk. So, the topic of my talk is "Rust is the language of AGI," Artificial General Intelligence. I'll explain why: it's about Rust tools for AI coders and their human assistants. You read itright: the AI first, human second.
That's, you know, um, I say I believe it's a lot of how things are evolving. So, my name is Michael Yuan, and you can— So this link and this PR code goes to my GitHub page, where you can find my email, contact information, X account, and, you know, things like that.
And you can also see some of the open-source projects that I'm involved in, including this project that I want to talk to you about, called Rust Coder. Anyway, this is an AI conference, so I think it may be prudent to get started with a little bit of background about what is Rust.
Rust & AI0:50
And Rust, as you know, is a programming language. It's hard to believe it's just celebrated its 10-year anniversary, so it's took a long time to grow a programming language. And one of its distinctions is that people love it.
You know, that's, um, so
since the Stack Overflow has its developer survey, Rust is the most beloved programming language every single year in the past 10 years. It's just celebrated its 10-year anniversary,right? So pretty much since it was born, it was very beloved by the programming community.
So this is this year's data. But you can also see some of the, I would say, troubles or the signs. You know, that's, uh, so you can see. Let's— from the top, it's Python, JavaScript, SQL, HTML, TypeScript, Rust, and Go,right?
And you can see the red bar, the red bar is how people admire the language. People really admire and really love Rust. It has 82%. It's much higher than anyone else, than anything else that's in this list,right? You know, that's, uh, but what about the blue?
The blue is actually desired. How much people want to actually use it,right? You know, so in that measurement, Python is really high, and Rust is not really that high. But surprisingly, it's higher than Go,right? You know, so, you know, that brings to the issue.
Rust is a language that people really love for many reasons, which I'm going to get into why. But also, people find it's diff- somewhat difficult, or somewhat they are hesitant to use it themselves. Why? Because for humans, Rust has a very steep learning curve.
Okay, so, you know, so there's, uh, um, you can— you can just search for "Rust learning curve" on the internet, you can see a lot of examples. And people find it's difficult to learn because it has a very powerful compiler that forces you to do theright thing.
You can do a lot of things that are not only wrong, you know, that's not only not optimal, but also very bug-prone in languages like C++ or in languages like Python and JavaScript that are not even a compiler,right?
You know, so it's just, uh, um, so you can— anything goes,right? No strong type system and all that. So Rust forces you to write from— write the correct and optimized code from the get-go. And that is apparently very difficult for beginners.
And I have to say, I went through the same learning curve when I started to learn Rust. The good news, of course, is once you master that, it's, uh, it becomes a lot easier to write correct code in Rust than any other language.
But the initial, um, learning curve is hard to get over. So that's one of the big issues with Rust,right?
However, that's the human-centric world. The human-centric world, we want a language that's easy to write. Maybe it has bugs, but then we can get the result quicker,right? You know, maybe it's hard to maintain, but, you know, that's, uh, let's have something working first.
So that's why Python and JavaScript are so popular. Rust is not that language. So what is Rust good for? So I— I think there's a very enlightening talk, um, you know, by— in the Latent Space podcast by Bret, um, Bret Taylor, you know, who's, uh, you know, um, the chairman of OpenAI and, you know, a very famous guy.
And, uh, so he basically said a human would prefer Python over Rust, um, because, you know, it's easier. But Rust is better suited for machines, not only because it's more efficient, but because it's all more structure-oriented for the strong compiler checking, the strong type system and all that.
It's just more rigorous. And, uh, because the compiler provides a very tight feedback loop. You know, one of the experiences that a lot of Rust developers have is that there's little debugging out once the project compiles. You know, once your Rust project compiles, there's a high likelihood it's going to run correctly.
You know, and it's, uh, yeah, it would run as you intended. You know, that's, uh, um, so the same can't be said about many, many other languages, especially languages without compilers. But though, because of this, because this property, the compiler of the Rust language provides a very good feedback loop for the AI.
So it forces AI to gen— it creates what we call a very good reward function,right? You know, so if you think about reinforcement learning, which is where popularized by, say, I mean, the large language model space, it's popularized by DeepSeek, you know, in the general space, popularized by, say, AlphaGo, AlphaZero,right?
You provide, uh, um, for any answ— for any question or any request, you have a correct answer. In the world of Rust, it's what the compiler accepts,right? It provides a very strong feedback to the, uh, to the large language model.
So it can get really good at those things. So that's why we say, uh, a programming like— a programming language like Rust, maybe it's difficult for humans, but it's a per— really a perfect fit for AI code generators.
So if we— if we see a future where most of the code is written by AI, I would think that's, you know, to have AI write human-incomprehensible Python or JavaScript is not the way to go. Because those languages— the benefit of those languages are human-incomprehensible,right?
You know, if you are going to write code that is hard for humans but easy for AI, but you can easy— you can fairly easy verify its correctness, then Rust would be the way to go,right? You know, so that's the background.
You know, that's why we think, you know, in the— in the world of AI, in the world of generated code, Rust, a language like Rust, is so important because it's friendly to the AI and also reasonably friendly to the humans.
Rust Coder Project6:43
So what do we want to do? So that's why we, uh, started a project called Rust Coder, with a very specific goal of, um, making, uh, Rust more— teaching Rust to AI and making AI generator— generate better Rust code,right?
So this project, by the way, it's sponsored by two, uh, internship grants from the Linux Foundation. You can think of this as, uh, you know, Google Summer of Code, that type of thing, but it's paid for and sponsored by Linux Foundation.
And it used copyrighted materials from the, uh, educational materials from the Rust Foundation as well. So, um, the goal of this Rust Coder project really is, for humans, make it easier, makes the AI assistant of learning Rust, make it easier to learn Rust, to wipe code with Rust, and to make Rust easier to work with in IDEs, for instance.
But perhaps more importantly, as we'll see in a minute, for machines, make it possible to generate Rust code on the fly. So, for instance, um, one thing that people do believe is that the path to AGI may come from code generators,right?
You know, so if the large language model planned for something and it want to execute on it, it could call an API, or it could generate code to perform this task for it,right? You know, so this— so we— our goal is to make it easier for a machine to generate correct Rust code.
And to make it, yeah, so, you know, you give it a specific task, it can generate code on the fly, and make sure that the code, by working with a compiler, to make sure that the code is correct, you know, at least can correctly execute,right?
So that's the goal of the Rust Coder project. So first, I'll show a demo that is help humans learn Rust. And, uh, there's a link here that's, um, goes into the process. So the process really is that we take Rust education materials and we, um, asked our, um, um, software interns to generate, um, several hundreds of tasks that, um, you know, common Rust developer would do, and, uh, build that into a knowledge base by creating embeddings, put that into vector database, and all that.
Learning Demo8:19
And build a system where you can ask, uh, a programming question or asking a programming task to the AI agent, and the AI agent would be able to give you, um, you know, a Rust answer,right? You know, so let's see a demo.
In this test, the student needs to write a Rust program to convert numbers to different bases. This is a complex problem. Let's see if a chairman coder model running a Gaia network can pass this test. We are accessing this Gaia node from the cursor IDE.
In cursor's AI assistant panel, we'll first give it the question. Since this is a complex question, we'll also give it some examples, like this input, get this output. Finally, we'll— we'll tell it to implement it in Rust so that it wouldn't do it in Python or JavaScript.
Now we send the question and everything to the Gaia node that runs the chairman coder model. It immediately starts to give the answers, as well as the code that implements its answer.
After that, it even gives the explanation of the code. It tells you how the— how it structures the data and the purpose of different functions in the code.
Now I'll just copy the entire code and put that into the main IDE.
After that, I can go ahead and run Cargo wrong, which would compile and run the application, and it gives theright result.
So now you have seen the demo. Here is, uh, um, this project is actually used by over a thousand developers that's in the— in the, um, in the university-based Rust camp. And one of the questions that you have just saw are the exam questions.
And, uh, so all the— essentially all the exam questions are like that, and the Rust coder would be able to do it in one shot. And it would be— would be able to explain its answers to the, um, to the learner and, uh, help them explore more,right?
So this is the first demo.
IDE Demo11:36
Now let's look at the second demo, because that's more wipe coding. You know, that's, uh, you have an instruction to generate some Rust code that is, you know, it has similar examples in the database, in the vector database.
Now we want to do something that is more advanced, that is to help humans code in Rust in the IDE,right? So for that, we made an MCP server in the— in the Rust Coder. So in the same, same approach, we can integrate MCP server into cursor IDE,right?
So we provide several MCP tools that allow cursor to generate a new project and compile and fix an existing project. So here's a demo. So here you can see I have cursor opened up, and, uh, in the cursor MCP servers, I have added a local Rust Coder MCP server.
And, uh, you can go to our documentation to find out how to do that. And you can see once connected, it's available at localhost port 3000. So it's, uh, it's running entirely on my local machine. And you can see it creates two tools.
One— one tool is called generate. So the— the generate MCP tool, um, allows you to give it a description and a— and then a requirement, both in string format. And, uh, it would generate the whole, um, um, a— a whole Rust project for you, um, because it has a vector database that has many common, you know, um, algorithms and Rust use cases and, you know, things like that.
So it can find a template and then, um, based on your description, modify the template and generate for you. But I want to show you today, really, is that the— oh, so let me refresh this so that get back.
So, but what I really want to show you here today is the compile and fix. So compile and fix is an MCP tool that allows you to take, um, files, um, Rust project files, um, in the context, and then ask the large language model to send that— to send those files to the MCP server so that the MCP server compiles it using its own Rust compiler to compile it.
Uh, if it encounter any error, it's going to use the error to use its own large language model, a coding large language model, to figure out what the error is, and, uh, then attempt to fix the source code.
And after the fi— after it tried to fix it, it's going to run the compiler again. It's going to repeat until it gets, uh, um, gets theright results. So this tool, I believe, is pretty useful, you know, when used with, um, IDEs, because it allows, uh, because it allows you to just give your Rust project to the— to the MCP and have it automatically fix the bugs,right?
So here, what are we going to do is that I'm going to, um, go to— because I have a Rust project open, and you can see it's a very simple project. It's, uh, just to print "Hello World." And, uh, it's obviously wrong because there's no closing there,right?
You know, so the syntax is wrong. So what I'm going to do is that I can in the— in the agent chat, I'm going to tell it to compile the Rust project file in the context. So two files in the context, cargo.tomo and rustmain.rs, and fix all the compiler bugs.
Go.
So cursor sees my re— request and sees the files in the context. And it knows the best way to do that is to call the MCP tool that I've just— that's connected, called compile and fix. So I'm going to say run the tool.
Oh, so it's really fast. So it comes back and says the syntax error is this. So just, uh, you know, adding those. So you can— we can just accept this. And then now fixed. It can— the— the code can compile now.
But before we go, let's go into the tool and see what's being— what's the request and response. So the request really is— so it sends two files here. One is file name cargo.tomo and the content of this file bene— underneath it.
And then it starts a new section called file src main.rs. And then the file that's seen here, that's the broken main.rs, that wouldn't pass the compiler. So we send that to the tool. And the re— response from the tool is still the entire— the— the source code of the entire package.
So it has a file name tomo.cargo.tomo, and then the source main.rs. But you can see it fixed this already. So this— by having these results coming back from the MCP tool, the building, um, large language model inside the cursor would be able to figure out what's the difference and then tell you.
And then it also is intelligent enough to know that this is a hint. So it's going to just fix this, and then it asks— it goes back to the editor and asks to fix it. Now I know you must be asking, you know, that's— for a simple example like that, the building Rust compiler and building large language model like Claude, uh, inside the cursor can probably figure it out as well.
After all, it's just missing a— you know, uh, missing something obvious,right? Um, but what I would like to note is that, uh, for tools like, um, the Rust Coder, the MCP server, it's a fully integrated solution with its own knowledge base of all the— of the Rust compiler error messages and how to fix those error messages.
And as you use it, the knowledge base also grows,right? Because sometimes it can't fix it, but cursor would give a different, uh, answer, or you would give a different answer. So it would know— it would learn as it goes how to fix this type of issues.
And, uh, it's integrated with its own prompt, its knowledge base, and its own large language— uh, large language model. Uh, in this particular case, we use, uh, the Gaia network and Llama edge to run a, um, a chairman coder model,right?
You know, so it's— have all these things packaged together. So it's a whole package that gets more intelligent about Rust development over time. So I believe it's going to be a lot better than, say, using, um, the generic coding large language models that's available in cursor, which is really designed for Python and JavaScript and such, but knows a little bit of Rust.
How It Works18:06
So it can solve easy Rust problems, but probably not the big ones. Allright. So now you have seen the demo. So let's recap how it works,right? So there's, uh, MCP tools that, um, two MCP tools. One generate the project, then it then compile and fix any errors, as you can see.
And, uh, so under the hood, it's an integrated stack of several tools that work together that has been fine-tuned and to— and programmed that they call each other and knows each other's behavior. So that they all work together to complete those tasks.
So we have coding large language models that you can use commercial. You can configure to use commercial ones or use open-source ones. Um, in this particular, um, you know, so in this particular case, we're using open-source model, that's the chairman coder.
It optimized for the prompt tailored to the model. So each model takes a different prompt. So for instance, the Gamma 3 model would not have a system prompt. So you have to put the system prompt in the— in the user message,right?
For others, you can put the code in context into the system prompt. So there's different variations and what type of language that the model responds to,right? And then, most importantly, a self-improving knowledge base of Rust compiler error messages.
So Rust compiler has a lot of error messages. And we gave examples if this error message is typically triggered, if the code looks like this, and this is how to fix it. So, but we can't cover all of them.
So one of the goal of this, uh, long-term goal of this project is for people to contribute this knowledge back into the knowledge base so that it can be more intelligent. It can search more relevant examples and allow it to fix even, uh, ever more complex, you know, error messages,right?
So the tech stack behind that is all open-source. So we have a Llama edge project, which is, um, based on Linux Foundation project that runs large language model and AI models everywhere. So, you know, so, uh, you may think this is, oh, maybe this is a Llama CPP or Ollama, but no.
It's, uh, it actually, it's more like Python. It runs a large variety of different models, just not— not just the large language models, but things also like YOLO, Whisper, TTS, Stable Diffusion, and all that stuff. Runs all those models and runs across many different GPUs and MPUs.
But other than, uh, unlike Python, it is much, much smaller. So it's only measured in tens of megabytes, the runtime itself, tens of megabytes instead of gigabytes for PyTorch,right? And, uh, um, then on top of that, we have integrated knowledge base, as we have mentioned.
It's a core part of the system. So it has, um, full-text search using Elasticsearch. It has and also full-text search using TyDB, and also, um, vector search using Qwadron. And it has also, um, various, um, vector embedding models that you can choose from.
So that's all packaged into, uh, a product that built on Llama edge is called Gaia network, which you can— I would also encourage you to check it out. And then we turn that into MCP server using the Open MCP proxy.
And this is its own open-source project. And, uh, please go check it out if you have time.
So now we have seen, you know, um, how do we use the Gaia and the Rust Coder project to help humans,right, to help them getting started with Rust programming, wipe code Rust program, and, uh, debug your Rust program.
Machine Vision21:32
But I think even more poten— even larger potential that's, um, you know, that's would happen in the near future is MCP is not really for humans, although we are using it for humans at this moment. It's really for machines.
So we take a little step back through the memory lane. You know, who are the real user of computers,right? You know, so that's in the early days, or maybe 15 years ago, it was mostly humans. That's why we have the web UI, we have desktop, we have mobile UI, and all that.
It's all geared towards humans. The human with their eyes, with their fingers, you know, we can— the multi-touch is, you know, it's— the UI is designed for human fingers,right? You know, so the humans are the human-computer interface. And then the API error comes.
You know, the API-first approach, meaning develop your applications as API-first, not as a human-interface-first. Meaning at that time, the consumer would be a computer, you know, some other computer or some other workflow engine would consume your services, you know, as an API.
There's, um, many big— many very successful companies grew out of that error. So for instance, Stripe,right? It's a payment solution. It's pretty much only API. You know, that's, uh, um, you know, it's integrated into another application that actually has a UI,right?
And, uh, uh, Tableau is another one,right? You know, sending, uh, accessing the— the— the telecom infrastructure. The list go on. There are many, many applications like that. But since, um, large language model come out, I think tool use become one of the ways that, um, your software and your application can be consumed by its user.
Now the user is no longer a computer that is, uh, deterministic but fairly dumb. It can only follow certain rules. It'll be the large language model that behave like humans, but it's really computers. So, you know, that's where we have the MCPs, the tool calls,right?
You know, so we provide— we provide our services. In this— in this particular case, we provide the Rust compiler service. We also provide the large language model-based bug-fixing service as a tool for other language— large language model to use.
So you can envision a future where we build a system that is not an IDE, but say, to control a drone. You know, that's, uh, so the Rust code generated is to, um, is to direct where the drone going to fly and how would it behave in certain circumstances.
It would just generate that code using the SDK that is specified that is, um, the Rust crate that's included in the knowledge base of the MCP server. And, uh, then, you know, automatically compile and debug until it works and it's get uploaded to the drone.
And then the drone fly out and do whatever— do whatever the AI wants it to do,right? Entirely without human intervention, you know, but with reasonable guarantees of the correctness of the code that's being generated,right? So that's our long-term vision for the Rust Coder project.
I know it's a big, big vision, but, you know, that's, uh, um, you know, that's what— where we want to go in the world of AGI,right? So at the last section of this talk, so I would just, uh, give you a little bit, um, you know, um, because we talked about how to use the Rust Coder, what is useful, and how do you use it.
But we haven't really talked about what's inside it, you know, how do you get started, and, you know, things like that. So the Rust Coder is part of the program we call Low-Code Rust. And here's the URL and the, the, um, the QR code.
Low-Code Rust24:57
Um, please do go visit it. So it's a set Rust tools for computers,right? You know, so Rust Coder is one of those. And, uh, so it provide, like I said, provide APIs and MCP services. So the API allow it to work with workflow engines or deterministic software programs.
And MCP allows it to work with large language models, which I believe in the— in the world of, um, you know, autonomous agents, both would play very important role. So it provide services in both interfaces,right? So to install and run it is really easy.
So it has a GitHub repository. You can just clone it. And then it has a, um, you know, Docker Compose script. So anywhere where you have Docker Desktop installed, you can just run Docker Compose up, and, uh, it would, uh, spin up all the containers,right, and, uh, connect to the appropriate large language model, uh, coding large language model that you specify.
It has, uh, a vector database embedded in it. So once you install and run, you'll be able to access the APIs for workflow managers. Here are examples of two APIs that we talk about. So we talked about the, um, how to use it as MCP,right?
But here you can see you can just use it as web service APIs as well. So you can generate and by passing it a JSON object that has the description and the requirements, it will going to generate the files in that Rust project that meets your description,right?
You know, so it's, um, um, and then follow-up tools would be able to separate out those files and save them. And, you know, things like that, which we have seen that in, in, uh, in the IDE, that's the cursor can already do that.
When it sees things like that, it knows which file it's operating, and then it would be able to write into that file. So you can build your own tools to do that as well, you know, if you have autonomous agents work that you have to do,right?
And then the second is compile and fix errors. So it's the same as we have just seen in our, uh, in our cursor demo, which is, you know, send, um, you know, flat combine all the files in your project into one single flat text file and separate it by certain markers.
And then send that to the API, and the API would run the Rust compiler, would run the large language model to fix any errors, and then return the, um, the whole project in the same format back to you.
So you can, from that point on, you can continue to process it,right? And, you know, that's obviously with the API, um, we also have the MCP service, which is the same as, you know, so it's just using a command.
So the documentation here just shows how to use a command line MCP client instead of cursor to, um, but if you, um, in any, you know, I would say modern agent framework today, um, you would have MCP integration.
So, so you will have to figure out how to integrate MCP servers into your framework. But, um, once you do that, it's just a very standard tool calls that you can ask your large language model to figure out when to generate code in Rust and when to fix, compile and fix code in Rust,right?
So those are, yeah, that's pretty much, um, all I want to cover in this talk. Um, uh, what I want to emphasize is this is pretty much a work in progress. And, uh, um, so our, um, second, um, you know, Linux Foundation internship is still ongoing, and the progress is being tracked by, um, on GitHub in this issue.
Conclusion28:14
So if you are interested, um, you know, um, come check it out. Um, come check out the work that we have done. And, uh, we'd love your contribution. You know, I think, um, because I, uh, I truly believe that's, um, you know, for, um, you know, the, the road to AGI is AI coders.
And the Rust is the best language for AI coders to use. It's far better for AI than, say, Python or JavaScript, okay? So, you know, so we want to build, um, a larger knowledge base and make this smarter and, uh, um, make more and create more functionalities for other agents to use.
So, um, thank you very much. And, uh, um, I hope I will see you on GitHub.





