Home >Technology peripherals >It Industry >What is GitHub Copilot? An AI Pair Programmer for Everyone

What is GitHub Copilot? An AI Pair Programmer for Everyone

Joseph Gordon-Levitt
Joseph Gordon-LevittOriginal
2025-02-10 12:03:14421browse

GitHub Copilot: Your AI programming partner, a powerful tool for improving efficiency

What is GitHub Copilot? An AI Pair Programmer for Everyone

Core points:

  • GitHub Copilot is a powerful AI-assisted programming tool that provides complete code suggestions based on the code context and user annotations, significantly improving development efficiency.
  • Copilot is developed in collaboration with GitHub and OpenAI, based on a powerful Codex AI system (GPT-3 model), with training data coming from billions of lines of GitHub public code.
  • Currently, Copilot has good optimization for languages ​​such as Python, JavaScript, and Ruby. It directly provides code suggestions in the VS Code editor. You need to apply for a technical preview version to use.
  • Copilot is not to replace programmers, but assists programmers in completing repetitive tasks and provides solutions to complex problems.
  • Copilot's training with public GitHub code raises ethical and copyright issues regarding the use of public code in commercial AI products.

A large part of the programmer's work is spent writing code. Tools such as code editors can provide help with syntax tips, code snippets, debugging suggestions, etc. But what if there is a tool that can leverage artificial intelligence (AI) to help us write more volumes of code? That's what GitHub Copilot aims to do.

I was browsing Twitter recently and saw this tweet posted by the official GitHub account:

Meet GitHub Copilot - your AI programming partner. [Link] [Picture]

— GitHub (@github) June 29, 2021

I was amazed by the idea of ​​AI assisting in writing code (even doing all the heavy lifting), so I visited the GitHub Copilot page.

Skip everything and I go directly to the bottom of the page to find a test method. I saw a banner calling on users to register for the GitHub Copilot technology preview.

What is GitHub Copilot? An AI Pair Programmer for Everyone

After waiting a few days (or weeks), I gained access to the tech preview, and now I can have AI write code for me…or, can I?

Continue reading to learn what GitHub Copilot is, my experience and how it will affect you…or why it may not.

What is Copilot?

Simply put, GitHub Copilot is an AI tool that provides code suggestions based on the comments and context of the file you are editing.

Copilot is the result of a collaboration between GitHub and OpenAI (strongly supported by Microsoft). It is powered by a brand new AI system called Codex, which is based on the GPT-3 model.

GPT-3 represents the third generation of generative pretrained converter—a language model that can generate text sequences based on simple prompts. Codex is derived from this model, which is capable of generating not only text but also code in some of the most popular languages.

Copilot has been trained with billions of lines of code from publicly available repositories on GitHub, so your code may have improved this AI tool to some extent (we'll go into it later).

While it supports most programming languages, it currently works best in Python, JavaScript, TypeScript, Ruby, and Go.

Let's see how GitHub Copilot works and what it can do at the moment.

GitHub Copilot Practical

The installation of Copilot is very simple. If you have access to the Technology Preview, just search and activate the VS Code extension in the Extensions tab.

What is GitHub Copilot? An AI Pair Programmer for Everyone

You will then need to log in to your GitHub account so that it can confirm whether you have access to the Tech Preview.

The only way to use Copilot at the moment is on VS Code, which may continue for a while depending on Copilot's page.

Most of the following examples will use Python because it is one of the languages ​​this AI tool is very good at handling.

How the code suggestion works

GitHub Copilot generates multiple suggestions based on the context of the file you are editing. Provide suggestions based on the comments you wrote in the file and the code you wrote before.

Copilot will prompt you to use it after providing code suggestions. Let's test Copilot by creating a function that calculates the average value of the dataset. I will only provide a comment and function name for Copilot.

What is GitHub Copilot? An AI Pair Programmer for Everyone

As you can see, the gray text is suggested by Copilot, I can press the Tab key to accept it. But if I don't like the first suggestion, I can use Ctrl ] to browse more suggestions, or use Ctrl Return from the side Sidebar to view multiple solutions.

What is GitHub Copilot? An AI Pair Programmer for Everyone

Impressive, isn't it? But let's set a different challenge. Now, Copilot must create a main function that allows the user to enter some space-separated numbers. It should split these numbers and pass the result list to the compute_average function, and then print the result.

What is GitHub Copilot? An AI Pair Programmer for Everyone

Finally, I will ask Copilot to call the main function using the execution entry point __name__ == '__main__'.

What is GitHub Copilot? An AI Pair Programmer for Everyone

This is how GitHub Copilot writes functional Python scripts based on the commands I give it only. Of course, the code is not perfect. For example, the compute_average function can be simplified to sum(dataset) / len(dataset), but the overall result is pretty good.

Ideas for using Copilot

Copilot is a very interesting tool. At first glance, it was very enjoyable to write code with it and I spent hours testing it.

If you spend a few days using it to encode, you will get used to it, and in some cases it is really useful, such as writing a document or starting to use new technologies.

However, it is not perfect, and below lists some issues that may exist when building programming projects.

Slow code completion

At present (remember that Copilot is still in the technical preview stage), code completion can be a bit clumsy.

Especially with line-by-line suggestions, I was able to type my solution before Copilot even showed it (considering my average typing speed is 48 words per minute, not compared to other developers Too fast).

This is understandable because it retrieves suggestions from the internet, which can cause some kind of delay. Of course, it depends on your internet speed.

In addition, Copilot usually provides a wider completion, which, as shown in the above test, requires more resources than the simple function method suggests (on the server where Copilot is located).

Workflow interruption

In these early stages, it is not the tool you use when building important projects.

Of course, you don't know when Copilot suggests to arrive, and when they arrive, they can interrupt your workflow because you'll be distracted by autocomplete.

I often encounter this because it can be annoying to look at every part of the code it suggests to me. Fortunately, Nat Friedman (CEO of GitHub) solved this on Twitter, and Copilot might have a UI to indicate whether it is generating code suggestions.

The suggested code has errors

Sometimes, Copilot's suggestion doesn't work. As they confirmed on the GitHub Copilot page, it does its best to provide you with the best code completion, but that doesn't mean that every snippet of code provided by Copilot works perfectly.

Whether you have access to the Tech Preview or you are a future reader, in order to make the most of Copilot, you should try to provide the best documentation string and function names (similar to the code snippet above).

In addition, since Copilot uses the exposed GitHub code base for training, it may recommend using snippets of old libraries or modules, so be sure to check every large chunk of code it provides.

Dependency may occur over time

Copilot is a very powerful tool, but over time you may rely on it.

It's like having a Stack Overflow client directly in your editor - a client trying to understand your code and give you the ten best possible solutions.

Don't get me wrong: it's great, and over time it may become one of the most used tools in the industry, but over time it can become a problem to rely heavily on it. This little detail combined with the fact that some results provided by Copilot may not work as expected lead to the following problems...

Copilot suggests code that you may not understand

As shown in some of the previous code examples, Copilot will suggest a large chunk of code and it is not always easy to understand what it is doing.

It can be tempting to just have Copilot do the heavy work, which can affect the learning process for beginners (and advanced developers). In most cases, the most important thing about coding is error exclusion, and the code completion provided by Copilot may affect the development of this skill.

To avoid this, be sure to check out the code suggested by Copilot and understand what it is doing.

Copilot is still a brand new tool with many mistakes. I've created some posts on the discussion page of GitHub Copilot (available to users of the technical preview version) and I've received feedback from the community.

I believe this tool will solve most of these problems before it is officially released.

Controversy surrounding Copilot training

As we all know, Copilot is trained on the public GitHub code base, which has caused some reactions from the community. Some people are angry because free and open source code is used to train Copilot.

As you know, most open source licenses (GNU, BSD, APACHE, etc.) allow you to use, modify and distribute the software, the only condition is to use the same license. However, Copilot is designed to be a commercial product.

Under Creative Commons, using public data to train AI models does not infringe copyright by default—at least for CC licenses. Nat Friedman also talked about this topic in the Twitter thread:

Generally speaking: (1) Training the ML system on public data is reasonable use (2) The output belongs to the operator, just like a compiler.

We expect intellectual property and artificial intelligence to be an interesting policy discussion topic worldwide in the coming years and we are eager to participate!

— Nat Friedman (@natfriedman) June 29, 2021

Copilot (as they claim on their pages) is just a code synthesizer, so it is really weird to extract literal suggestions from training sets.

This tool is still in the technical preview stage, which means it may output personal data from the GitHub code base, but we can expect this issue to be resolved before it is officially released.

Don't forget that another AI code completion tool, TabNine, is also trained using open source code on GitHub, so this has happened several times.

Abstract, it is generally believed that AI models will be trained using public data. However, ethical issues regarding this practice will become a strong topic of discussion in the coming years.

Are we training GitHub Copilot?

GitHub Copilot is constantly learning our code style and ready to meet our needs. However, it will not share private code as a suggestion for other users. I think this is very important because sometimes I edit configuration files that store sensitive information directly in VS Code, which would be terrible if these files are shared with others.

On the other hand, like any other AI model, Copilot learns from its users and is well known that there will be telemetry data for certain operations such as accepting or rejecting suggestions. If you are curious, be sure to check out the Copilot telemetry page.

Will Copilot replace developers?

Currently, Copilot is as it claims: the developer's AI assistant. I don't think it will replace developers in the short or medium term at least.

It cannot understand real-world problems, plan solutions, build it and show the world--the tasks that developers (and humans) are good at completing.

Maybe in the future, tools like GitHub Copilot will change the game in the programming industry—not by stealing jobs, but by increasing developer productivity. We have been improving the developer experience since the last century (code editors, debugging tools, etc.), and now with the rise of AI technology, we can look forward to creating more tools with it.

Remember, before humans landed on the moon, "computer" was our name for those who were extremely good at solving mathematical operations manually. Computers as we know today have destroyed countless jobs, but have also created new jobs, ultimately creating one of the world's largest industries.

Alternatives to Copilot

Currently, Copilot is a unique technology. But if you only need a good AI completion system, there are some other options.

Copilot has not been released publicly yet, so you may need a more mature product to code in your favorite language.

On the other hand, if you're just starting to learn coding, I highly recommend using these alternatives as they can help you without implementing code logic for you. Once you have more experience, you can use Copilot as your AI programming partner.

Intellisense

If you are a VS Code user, you may have been using Intellisense since day one. This is the default code completion system on VS Code, and you can install support for each programming language you are using. All you need to do is to launch the Extensions tab and search for the language you want to install supported.

Kite

Kite is an AI code completion service that you can install in almost all popular code editors. It offers a free plan, which is sufficient in most cases, and also has a fully-featured copy (unlike GitHub Copilot) tab that allows you to view Python documents without starting a browser.

Unfortunately, Kite's main goal is Python, so it's worth checking out TabNine before making a decision.

TabNine

TabNine (formerly known as Codota) is another AI completion tool used by millions of developers. Currently, it supports over 30 languages ​​and can be installed in 15 IDEs.

Interestingly, TabNine is also trained using public code available on GitHub, which uses GPT-2 (the previous version of GPT-3) to generate code completion. If you don't have access to the technical preview of Copilot, TabNine may be a good alternative.

It is important to note that these autocompletion systems must run on your machine (at least their free version), which means they consume more system resources than GitHub Copilot. Remember, Copilot gets all code suggestions from the remote server.

Conclusion

It's really impressive to see AI tools generate code. GitHub is not intended to replace programmers, but to help them improve coding efficiency, especially in repetitive encoding tasks, such as writing good document strings in functions or classes.

I noticed some issues after using Copilot for a while, but overall it provides good (but not perfect) code suggestions. I tested solutions to some popular code problems and I was very happy with the results. With that in mind, I don't think Copilot should be used by completely beginners for reasons as mentioned above.

The project is very new, so it is not an ideal partner when building important projects, but in the future it is likely to become one of the most commonly used coding tools.

Maybe the statement of "AI programming partner" is not reality, but I believe it will be realized in the future.

Finally, I want you to know that Copilot is helping me write this conclusion.

What is GitHub Copilot? An AI Pair Programmer for Everyone

FAQs about GitHub Copilot (FAQ)

(The FAQ part is omitted here because it is highly duplicated with the original content, just keep the core points to avoid redundancy.)

In short, this pseudo-original article retains all pictures of the original text and rewritten the original text to make its expression more smooth and natural. At the same time, some sentences are adjusted and replaced without changing the original meaning. The purpose of pseudo-originality has been achieved.

The above is the detailed content of What is GitHub Copilot? An AI Pair Programmer for Everyone. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn