If we have smart AIs to write code, find bugs, and write tests - doesn’t that mean we can ditch the “safe” languages and go back to C? Thats mostly a joke. But AI-hardened-C seems like it could be much better than current-human-only-C.
Translating All C to Rust (TRACTOR)
381–390 of 403 posts
Re: Translating All C to Rust (TRACTOR)
#382Not to mention that this quote is incredibly scary. This is someone we are trusting to make this decision?
"You can go to any of the LLM websites, start chatting with one of the AI chatbots, and all you need to say is 'here's some C code, please translate it to safe idiomatic Rust code,' cut, paste, and something comes out, and it's often very good, but not always," said Dan Wallach, DARPA program manager for TRACTOR, in a statement.
Re: Translating All C to Rust (TRACTOR)
#383Earlier quoted context omitted.
It's quite hilarious to see the push back rust gets by the c/c++ community. Obviously their decades of hard work and experience to work with those languages are overriding their reasoning circuits. Who in their right mind would defend a language that has such major and obvious design flaws if a genuine alternative is there.
Many of the most widely used languages have obvious major design flaws. (JavaScript is one obvious candidate, python is another. How did a language which has no built-in floating point type become the number one language for numerical analysis?) The real question is what tradeoffs you are making and what you are gaining. Rust makes certain memory safety guarantees about the program at compile time, but at the same ti…
I don't see anyone defending JavaScript. In fact a whole lot of people are using typescript now because JavaScript is just so bad.
As for python, that's a good point. I guess it's just because it's easy to use and all the numerical stuff is done with c-bindings anyway?
But the C++ Situation is genuinely different. There's a reason governments are now calling upon developers to just let it die already[0]. That design flaw is so bad it's causing genuine harm.
[0] https://www.cisa.gov/news-events/news/urgent-need-memory-saf...
Re: Translating All C to Rust (TRACTOR)
#384slight tangent, but I think it would be amazing if AI could write device drivers. Full-featured GPU drivers for, say, OpenBSD. What does it need? Probably the state machines of the GPUs, how to enable various modes, how to feed data in/out of the device at intended speed, how to load shaders. Why can't AI learn to do that? Its reward could be getting past the initialization and getting to the default state of the dri…
Because it isn't magic.
>It could be trained on hundreds of GPU drivers
Do you know what an AI trained on hundreds of books looks like? Even with millions of books it can not write a coherent chapter, much less an entire book.
This is a genuinely terrible idea. It is exactly the thing AI is bad at, high degree of accuracy over long stretches of output.
Re: Translating All C to Rust (TRACTOR)
#385slight tangent, but I think it would be amazing if AI could write device drivers. Full-featured GPU drivers for, say, OpenBSD. What does it need? Probably the state machines of the GPUs, how to enable various modes, how to feed data in/out of the device at intended speed, how to load shaders. Why can't AI learn to do that? Its reward could be getting past the initialization and getting to the default state of the dri…
>Why can't AI learn to do that? Because it isn't magic. >It could be trained on hundreds of GPU drivers Do you know what an AI trained on hundreds of books looks like? Even with millions of books it can not write a coherent chapter, much less an entire book. This is a genuinely terrible idea. It is exactly the thing AI is bad at, high degree of accuracy over long stretches of output.
So graphics drivers are magic? They weren't designed in a determinate way, with a known interface and specifications?
Re: Translating All C to Rust (TRACTOR)
#386Earlier quoted context omitted.
>Why can't AI learn to do that? Because it isn't magic. >It could be trained on hundreds of GPU drivers Do you know what an AI trained on hundreds of books looks like? Even with millions of books it can not write a coherent chapter, much less an entire book. This is a genuinely terrible idea. It is exactly the thing AI is bad at, high degree of accuracy over long stretches of output.
> Because it isn't magic. So graphics drivers are magic? They weren't designed in a determinate way, with a known interface and specifications?
LLMs are bad at exactly those things which you need to make a GPU driver. Extremely high accuracy over long distances. AI totally falls apart when trying to write a novel, how could it write a GPU driver?
Re: Translating All C to Rust (TRACTOR)
#387Earlier quoted context omitted.
Many of the most widely used languages have obvious major design flaws. (JavaScript is one obvious candidate, python is another. How did a language which has no built-in floating point type become the number one language for numerical analysis?) The real question is what tradeoffs you are making and what you are gaining. Rust makes certain memory safety guarantees about the program at compile time, but at the same ti…
I think DARPA is making the right decision about choosing Rust as the language for low level systems programming. For national security related matters you'd definitely want the certainty Rust brings. The reason I personally chose Rust as my go to language for low level programming is that despite learning systems programming in college I pretty much never used it outside of school. Meaning I didn't have any of that…
I see this differently: DARPA bets on different baskets in parallel. This is just one basket, if they are wrong it doesn't matter because there are other bets to reduce the general risk.
Re: Translating All C to Rust (TRACTOR)
#3881. Create a tool that scores code depending on translation difficulty.
2. Automatically translate all code that can be directly translated.
3. Refactor the remaining C code into C or C++ code that is easier to translate.
4. Create a tool that suggests a translation but have a human review the changes.
5. Finally refactor everything else by hand.
You're welcome, DARPA.
Re: Translating All C to Rust (TRACTOR)
#389I don't see this working. There are abstractions in C which are not replicable in Rust, without major changes. In C, having two separate data structures which carry an identical pointer and are writing to it is a common occurrence. This can not be trivially replicated in rust and will need some reasonably clever intervention.
What you won’t get is an output which is less buggy, or a process which automatically generates the program structure which yields Rust’s reliability.
Re: Translating All C to Rust (TRACTOR)
#390Earlier quoted context omitted.
Line by line is infeasible, which is precisely why you need to use AI to make larger semantic inferences. You also don't have to one-shot translate everything. One of the valuable things about the Rust compiler is it gives lots of specific information that you can feed back into an LLM to iterate. I've been working on similar problems for my startup (grit.io) and think C -> Rust is definitely tractable in the near te…
What about convert to AST then ask the AI to convert to Rust. Would that work?
ASTs also generally don't actually have magical information in them. They won't solve the lifetime issues for you.