AI research company OpenAI is releasing a new machine learning tool that translates the English language into code. The software is called Codex and is designed to speed up the work of professional programmers, as well as help amateurs get started coding.
In demos of Codex, OpenAI shows how the software can be used to build simple websites and rudimentary games using natural language, as well as translate between different programming languages and tackle data science queries. Users type English commands into the software, like “create a webpage with a menu on the side and title at the top,” and Codex translates this into code. The software is far from infallible and takes some patience to operate, but could prove invaluable in making coding faster and more accessible.
“We see this as a tool to multiply programmers,” OpenAI’s CTO and co-founder Greg Brockman told The Verge. “Programming has two parts to it: you have ‘think hard about a problem and try to understand it,’ and ‘map those small pieces to existing code, whether it’s a library, a function, or an API.’” The second part is tedious, he says, but it’s what Codex is best at. “It takes people who are already programmers and removes the drudge work.”
OpenAI used an earlier version of Codex to build a tool called Copilot for GitHub, a code repository owned by Microsoft, which is itself a close partner of OpenAI. Copilot is similar to the autocomplete tools found in Gmail, offering suggestions on how to finish lines of code as users type them out. OpenAI’s new version of Codex, though, is much more advanced and flexible, not just completing code, but creating it.
Codex is built on the top of GPT-3, OpenAI’s language generation model, which was trained on a sizable chunk of the internet, and as a result can generate and parse the written word in impressive ways. One application users found for GPT-3 was generating code, but Codex improves upon its predecessors’ abilities and is trained specifically on open-source code repositories scraped from the web.
This latter point has led many coders to complain that OpenAI is profiting unfairly from their work. OpenAI’s Copilot tool often suggests snippets of code written by others, for example, and the entire knowledge base of the program is ultimately derived from open-source work, shared to benefit individuals, not corporations. The same criticisms will likely be leveled against Codex, though OpenAI says its use of this data is legally protected under fair use.
When asked about these complaints, Brockman responds: “New technology is coming, we do need this debate, and there will be things we do that the community has great points on and we will take feedback and do things differently.” He argues, though, that the wider coding community will ultimately benefit from OpenAI’s work. “The real net effect is a lot of value for the ecosystem,” says Brockman. “At the end of the day, these types of technologies, I think, can reshape our economy and create a better world for all of us.”
Codex will also certainly create value for OpenAI and its investors. Although the company started life as a nonprofit lab in 2015, it switched to a “capped profit” model in 2019 to attract outside funding, and although Codex is initially being released as free API, OpenAI will start charging for access at some point in the future.
OpenAI says it doesn’t want to build its own tools using Codex, as it’s better placed to improve the core model. “We realized if we pursued any one of those, we would cut off any of our other routes,” says Brockman. “You can choose as a startup to be best at one thing. And for us, there’s no question that that’s making better versions of all these models.”
WHAT IS CODEX ACTUALLY LIKE TO USE?
Of course, while Codex sounds extremely exciting, it’s difficult to judge the full scope of its capabilities before real programmers have got to grips with it. I’m no coder myself, but I did see Codex in action and have a few thoughts on the software.
OpenAI’s Brockman and Codex lead Wojciech Zaremba demonstrated the program to me online, using Codex to first create a simple website and then a rudimentary game. In the game demo, Brockman found a silhouette of a person on Google Images then told Codex to “add this image of a person from the page” before pasting in the URL. The silhouette appeared on-screen and Brockman then modified its size (“make the person a bit bigger”) before making it controllable (“now make it controllable with the left and right arrow keys”).
It all worked very smoothly. The figure started shuffling around the screen, but we soon ran into a problem: it kept disappearing off-screen. To stop this, Brockman gave the computer an additional instruction: “Constantly check if the person is off the page and put it back on the page if so.” This stopped it from moving out of sight, but I was curious how precise these instructions need to be. I suggested we try a different one: “Make sure the person can’t exit the page.” This worked, too, but for reasons neither Brockman nor Zaremba can explain, it also changed the width of the figure, squashing it flat on-screen.
“Sometimes it doesn’t quite know exactly what you’re asking,” laughs Brockman. He has a few more tries, then comes up with a command that works without this unwanted change. “So you had to think a little about what’s going on but not super deeply,” he says.
This is fine in our little demo, but it says a lot about the limitations of this sort of program. It’s not a magic genie that can read your brain, turning every command into flawless code — nor does OpenAI claim it is. Instead, it requires thought and a little trial and error to use. Codex won’t turn non-coders into expert programmers overnight, but it’s certainly much more accessible than any other programming language out there.
THE FUTURE OF PROGRAMMING
OpenAI is bullish about the potential of Codex to change programming and computing more generally. Brockman says it could help solve the programmer shortage in the US, while Zaremba sees it as the next step in the historical evolution of coding.
“What is happening with Codex has happened before a few times,” he says. In the early days of computing, programming was done by creating physical punch cards that had to be fed into machines, then people invented the first programming languages and began to refine these. “These programming languages, they started to resemble English, using vocabulary like ‘print’ or ‘exit’ and so more people became able to program.” The next part of this trajectory is doing away with specialized coding languages altogether and replacing it with English language commands.
“Each of these stages represents programming languages becoming more high level,” says Zaremba. “And we think Codex is bringing computers closer to humans, letting them speak English rather than machine code.” Codex itself can speak more than a dozen coding languages, including JavaScript, Go, Perl, PHP, Ruby, Swift, and TypeScript. It’s most proficient, though, in Python.
Codex also has the ability to control other programs. In one demo, Brockman shows how the software can be used to create a voice interface for Microsoft Word. Because Word has its own API, Codex can feed it instructions in code created from the user’s spoken commands. Brockman copies a poem into a Word document and then tells Word (via Codex) to first remove all the indentations, then number the lines, then count the frequency of certain words, and so on. It’s extremely fluid, though hard to tell how well it would work outside the confines of a pre-arranged demo.
If it succeeds, Codex might not only help programmers but become a new interface between users and computers. OpenAI says it’s tested Codex’s ability to control not only Word but other programs like Spotify and Google Calendar. And while the Word demo is just a proof of concept, says Brockman, Microsoft is apparently already interested in exploring the software’s possibility. “They’re very excited about the model in general and you should expect to see lots of Codex applications be created,” he says.
Source: theverge.com