AI Can Write Code Like Humans

AI Can Write Code Like Humans

SOME SOFTWARE DEVELOPERS are now letting artificial intelligence help write their code. They are finding that AI is just as flawed as humans.

Last June, GitHub, a subsidiary of Microsoft that provides tools for hosting and collaborating on code, released a beta version of a program that uses AI to assist programmers. Start typing a command, a database query, or a request to an API, and the program, called Copilot, will guess your intent and write the rest.

Alex Naka, a data scientist at a biotech firm who signed up to test Copilot, says the program can be very helpful, and it has changed the way he works. It lets me spend less time jumping to the browser to look up API docs or examples on Stack Overflow, he says. It does feel a little like my work has shifted from being a generator of code to being a discriminator of it.

But Naka has found that errors can creep into his code in different ways. There have been times where I have missed some kind of subtle error when I accept one of its proposals, he says. And it can be really hard to track this down, perhaps because it seems like it makes errors that have a different flavor than the kind I would make.

The risks of AI generating faulty code may be surprisingly high. Researchers at NYU recently analyzed code generated by Copilot and found that, for certain tasks where security is crucial, the code contains security flaws around 40 percent of the time.

The figure is a little bit higher than I would have expected, says Brendan Dolan-Gavitt, a professor at NYU involved with the analysis. But the way Copilot was trained was not actually to write good code it was just to produce the kind of text that would follow a given prompt.

Despite such flaws, Copilot and similar AI-powered tools may herald a sea change in the way software developers write code. There is growing interest in using AI to help automate more mundane work. But Copilot also highlights some of the pitfalls of todays AI techniques.


Social Share

Trending Posts

Join Thousand of Happy Students!

Subscribe our newsletter & get latest news and updation!