206
DARPA suggests turning old C code automatically into Rust – using AI, of course
(www.theregister.com)
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Follow the wormhole through a path of communities [email protected]
This is an interesting application of so-called AI, where the result is actually desirable and isn't some sort of frivolity or grift. The memory-safety guarantees offered by native Rust code would be a very welcome improvement over C code that guarantees very little. So a translation of legacy code into Rust would either attain memory safety, or wouldn't compile. If AI somehow (very unlikely) manages to produce valid Rust that ends up being memory-unsafe, then it's still an advancement as the compiler folks would have a new scenario to solve for.
Lots of current uses of AI have focused on what the output could enable, but here, I think it's worth appreciating that in this application, we don't need the AI to always complete every translation. After all, some C code will be so hardware-specific that it becomes unwieldy to rewrite in Rust, without also doing a larger refactor. DARPA readily admits that their goal is simply to improve the translation accuracy, rather than achieve perfection. Ideally, this means the result of their research is an AI which knows its own limits and just declines to proceed.
Assuming that the resulting Rust is: 1) native code, and 2) idiomatic, so humans can still understand and maintain it, this is a project worth pursuing. Meanwhile, I have no doubt grifters will also try to hitch their trailer on DARPA's wagon, with insane suggestions that proprietary AI can somehow replace whole teams of Rust engineers, or some such nonsense.
Edit: is my disdain for current commercial applications of AI too obvious? Is my desire for less commercialization and more research-based LLM development too subtle? :)
The problem I see here is that AI may write code that does compile, but has a bunch of logical errors, edge cases or bad architecture. From personal experience, even though AI can write small amounts of good code, it's bad at understanding big and complex solutions.
At that point, fixing the AI codebase might take longer than just starting with a competent Rust dev.
This is a timely reminder and informative for people who aren't aware that LLMs don't actually understand anything. At all.
That doesn't mean they're useless, but yes, if you want an LLM to handle complex input and use it to generate complex output correctly... You may need to reevaluate your choice of tooling or your process.
This is a timely reminder and informative for people who want to seem smug I guess? Or haven't really thought about it? ... that the word "understand" is definitely not defined precisely or restrictively enough to exclude LLMs.
By the normal meaning of "understand" they definitely show some level of understanding. I mean, have you used them? I think current state of the art LLMs could actually pass the Turing test against unsophisticated interviewers. How can you say they don't understand anything?
Understanding is not a property of the mechanism of intelligence. You can't just say "it's only pattern matching" or "it's only matrix multiplication" therefore it doesn't understand.
I think understanding requires knowledge, and LLMs work with statistics around text, not knowledge.
With billions of dollars pumped into these companies and enough server farms crawling to make a data hoarder green with envy, they've reached a point where it seems like they know things. They've incorporated, in some capacity, that some things are true, and some are related. They understand.
That is not the case. Ask me a thousand times the solution of a math problem, and a thousand times I'll give you the same solution. Ask an LLM about a math problem, and you'll get different strategies, different rules, and different answers, often incorrect. Same thing with coding. Back away a little, and you could even apply that to any task with reasoning.
But you don't need to go that far: ask an LLM about anything without sufficient resources on the internet to absorb, and it'll just make things up. Because an LLM has no concept of knowing, it also has no concept of not knowing. It knows anything about as well as your smartphone keyboard. It's autocomplete on steroids.
So let's say they understand—they contain information about—the statistical relations between tokens. That's not the same as understanding what those tokens actually mean, and the proof of that is how much basic stuff LLMs get wrong, all the time. The information they hold is about the tokens themselves, not about the real world things those tokens represent.
At this point, I don't think it's unreasonable to say that insisting LLMs understand anything is a discussion more related to the meaning of words than to current AI capabilities. In fact, since understanding is more closely associated with knowledge that you can reason with and about, the continuous use of this word in these discussions can actually be harmful by misleading people who don't know better.
Thanks for assuming good faith, I suppose.
I have, in fact, used multiple popular LLM models currently available, including paid offerings, and spent way too much time hearing both people who know about this subject and people who don't. I can safely say LLMs don't understand anything. At all.
See above.
You're already making the assumption that "statistics around text" isn't knowledge. That's a very big assumption that you need to show. And before you even do that you need a precise definition of "knowledge".
Sure but only if you are certain of the answer. As soon as you have a little uncertainty that breaks down. Ask an LLM what Obama's first name is a thousand times and it will give you the same answer.
Does my daughter not have any knowledge because she can't do 12*2 reliably 1000 times in a row? Obviously not.
Yes that is a big problem, but not related to this discussion. Humans can make things up too, the only difference is they don't do it all the time like LLMs do. Well actually I should say most humans don't. I worked with a guy who was very like an LLM. Always an answer but complete bullshit half the time.
Prove it. I assert that it is the same.
And you're making the assumption that it could be. Why am I the only one who needs to show anything?
I'm saying that LLMs fail at many basic tasks that any person which could commonly be said to have an understanding of them wouldn't. You brought up the Turing test as though it was an actual, widely accepted scientific measure of understanding.
Source - Wikipedia.
What do you mean, "certain of the answer?" It's math. I apply knowledge, my understanding gained through study, to reason about and solve a problem. Ask me to solve it again, the rules don't change; I'll get the same answer. Again, what do you mean?
Apples to oranges. "What's Obama's first name" doesn't require the same kind of skills as solving a math problem.
Also, it took me 7 attempts to get ChatGPT to be confidently wrong about Obama's name:
It couldn't even give me the same answer 7 times.
That's not my argument. If your daughter hasn't learned multiplication yet, there's no way she could guess the answer. Once has grown and learned it, though, I bet she'll be able to answer that reliably. And I fully believe she'll understand more about our world than any LLM. I hope you do so as well.
It's absolutely related, because as I stated, LLMs have no concept of knowing. Even if there are humans that'll lie, make things up, spread misinformation—sometimes even on purpose—at least there are also humans who won't. People who'll try to find the truth. People that will say, "Actually, I'm not sure. Why don't we look into it together?"
LLMs don't do that, and they fundamentally can't. Any insurmountable objection to answering questions is a guardrail put in place by their developers, and researchers are already looking into how to subvert those.
Sorry to hear that. From experience, I know they can cause a lot of damage, even unintentionally.
Very confident assertion, there. Can I ask where's your proof?
I see that you also neglected to answer a critical part of my comment, so I'll just copy and paste it here.
Any opinion on this?
"Could be" is the null hypothesis.
Hmm I'm guessing you don't have children.
Oh dear. I dunno where to start here... but basically while maths itself is either true or false, our certainty of a mathematical truth is definitely not. Even for the cleverest mathematicians there are now proofs that are too complicated for humans to understand. They have to be checked by machines... then how much do you trust that the machine checker is bug free? Formal verification tools often have bugs.
Just because something "is math" doesn't mean we're certain of it.
I don't have proof. That's my point. Your position is no stronger than the opposite position. You just asserted it as fact.
It's unclear that AI is the right tool at all. It's certainly possible to use some automated conversion libraries, and then have human programmers fill in the gaps.