OpenAI Codex (language model)

Code-generating large language model by OpenAI From Wikipedia, the free encyclopedia

OpenAI Codex is a large language model developed by OpenAI for translating natural-language prompts into source code. Announced in 2021, it was a modified production version of GPT-3 that was fine-tuned on source code in multiple programming languages, and it served as the original model for GitHub Copilot.[1][2]

Codex was designed to assist programmers by generating code from plain-language instructions, completing partially written code, and interacting with software and online services.[3][4] Researchers and commentators also described limitations and risks, including inaccurate or insecure output, difficulty with more complex prompts, and copyright concerns related to training on publicly available code.[5][6][7]

It should not be confused with the separate coding agent OpenAI Codex, which OpenAI introduced in 2025 under the same name.[8]

Capabilities

Built on GPT-3, Codex was further trained on 159 gigabytes of Python code drawn from 54 million GitHub repositories.[9][2] A typical use case of Codex is for a user to type a comment, such as "//compute the moving average of an array for a given window size", then use the AI to suggest a block of code that satisfies that comment prompt.[10] OpenAI stated that Codex can complete approximately 37% of requests and is meant to make human programming faster rather than to replace it. According to OpenAI's blog, Codex excels most at "mapping... simple problems to existing code", which they describe as "probably the least fun part of programming".[11][3] Co-founder of Fast.ai, Jeremy Howard, said that "Codex is a way of getting code written without having to write as much code", and that "it is not always correct, but it is just close enough".[12] OpenAI stated that Codex could complete about 37% of programming tasks in its evaluation set and was intended to make human programmers faster rather than replace them.[5]

OpenAI claims that Codex can create code in over a dozen programming languages, including Go, JavaScript, Perl, PHP, Ruby, Shell, Swift, and TypeScript, though it is most effective in Python.[1] According to VentureBeat, OpenAI demonstrations suggested that Codex could keep track of earlier parts of a prompt and use that context to generate working code. In these demonstrations, it was used to create a browser game in JavaScript and to generate data-visualization code using matplotlib.[3]

In demonstrations, OpenAI showed Codex interacting with services and applications such as Mailchimp, Microsoft Word, Spotify, and Google Calendar.[3][4]

Limitations and concerns

OpenAI demonstrations also showed weaknesses such as inefficient code and occasional unexpected results in individual examples.[3] In an interview with The Verge, OpenAI chief technology officer Greg Brockman said that "sometimes [Codex] doesn't quite know exactly what you're asking" and that it can require some trial and error.[4] OpenAI researchers found that Codex struggled with multi-step prompts and could produce unexpected output. They also raised safety concerns including over-reliance by novice programmers, biases in the training data, and security risks from vulnerable code.[5] In an interview with The Verge, OpenAI chief technology officer Greg Brockman said that "sometimes [Codex] doesn't quite know exactly what you're asking" and that it can require some trial and error.[4] OpenAI researchers found that Codex struggles with multi-step prompts, often failing or yielding counter-intuitive behavior. Additionally, they brought up several safety issues, such as over-reliance by novice programmers, biases based on the training data, and security impacts due to vulnerable code.[5]

VentureBeat stated that because Codex is trained on public data, it could be vulnerable to "data poisoning" via intentional uploads of malicious code.[3] According to a study by researchers from New York University, approximately 40% of code generated by GitHub Copilot (which uses Codex) in scenarios relevant to high-risk CWEs included glitches or other exploitable design flaws.[6]

The Free Software Foundation expressed concerns that code snippets generated by Copilot and Codex could violate copyright, in particular the condition of the GPL that requires derivative works to be licensed under equivalent terms.[7] Issues they raised include whether training on public repositories falls into fair use or not, how developers could discover infringing generated code, whether trained machine learning models could be considered modifiable source code or a compilation of the training data, and if machine learning models could themselves be copyrighted and by whom.[7][13] An internal GitHub study found that approximately 0.1% of generated code contained direct copies from the training data. In one example the model outputted the training data code implementing the fast inverse square root algorithm, including comments and an incorrect copyright notice.[10]

In response, OpenAI stated that "legal uncertainty on the copyright implications of training AI systems imposes substantial costs on AI developers and so should be authoritatively resolved."[10]

The copyright issues with Codex have been compared to the Authors Guild, Inc. v. Google, Inc. court case, in which judges ruled that Google Books's use of text snippets from millions of scanned books constituted fair use.[10][14]

References

Related Articles

Wikiwand AI