GitHub Copilot! Your AI pair programmer.

Shubham Chambhare
3 min readJun 30, 2021

GitHub Copilot is powered by Codex, the new AI system created by OpenAI. GitHub Copilot understands significantly more context than most code assistants. So, whether it’s in a docstring, comment, function name, or the code itself, GitHub Copilot uses the context you’ve provided and synthesizes code to match.

Whether you’re working in a new language or framework, or just learning to code, GitHub Copilot can help you find your way. Tackle a bug, or learn how to use a new framework without spending most of your time spelunking through the docs or searching the web.

How it works

Copilot, as the code synthesizer is called, has been developed in collaboration with OpenAI, and leverages Codex, a new AI system that’s trained on publicly available source code and natural language with the goal of translating comments and code written by a user into auto-generated code snippets. OpenAI Codex was trained on publicly available source code and natural language, so it understands both programming and human languages. The GitHub Copilot editor extension sends your comments and code to the GitHub Copilot service, which then uses OpenAI Codex to synthesize and suggest individual lines and whole functions.

“GitHub Copilot draws context from the code you’re working on, suggesting whole lines or entire functions,” GitHub CEO Nat Friedman said in a blog post. “It helps you quickly discover alternative ways to solve problems, write tests, and explore new APIs without having to tediously tailor a search for answers on the internet.”

What context does GitHub Copilot use to generate suggestions?

GitHub Copilot uses the current file as context when making its suggestions. It does not yet use other files in your project as inputs for synthesis. This means that, for example, copy/pasting a type declaration into the file you’re working on may improve suggestions from GitHub Copilot. This is something we will improve in the future. In order to generate suggestions, GitHub Copilot transmits part of the file you are editing to the service. This context is used to synthesize suggestions for you. GitHub Copilot also records whether the suggestions are accepted or rejected. This telemetry is used to improve future versions of the AI system, so that GitHub Copilot can make better suggestions for all users in the future. In the future we will give users the option to control how their telemetry is used.

How will GitHub Copilot get better over time?

GitHub Copilot doesn’t actually test the code it suggests, so the code may not even compile or run. GitHub Copilot can only hold a very limited context, so even single source files longer than a few hundred lines are clipped and only the immediately preceding context is used. And GitHub Copilot may suggest old or deprecated uses of libraries and languages. You can use the code anywhere, but you do so at your own risk.

Mike Krieger // Co-founder, Instagram says:

In the first day, GitHub Copilot already taught me about a nuance in Javascript object comparison and is as comfortable with our database schema as I am. This is the single most mind-blowing application of ML I’ve ever seen.

For now, we’re focused on delivering the best experience in Visual Studio Code only.

--

--