During my research into productivity tools a few months ago, I discovered a series of articles highlighting the potential of AI assistants as a game-changing technology in the industry. As a full stack developer who routinely produces large amounts of code, I was immediately drawn to the possibilities of such a tool. After using GitHub Copilot daily for some time, I would like to share with you what it is, how it works, and how it can be a useful tool for developers, engineers, and data scientists
What is Github Copilot?
GitHub Copilot is an AI-powered coding assistant that uses a neural network trained on billions of lines of code from open source repositories on GitHub. This means that Copilot can understand the context of the code you’re working on and provide relevant suggestions based on that context.
How Does It Work?
The model used by Copilot is a neural network that has been trained using a technique called supervised learning. In supervised learning, the model is trained on a large dataset of labeled examples. In the case of Copilot, this means training the model on millions of lines of code and corresponding descriptions of what that code does.
To train the model, GitHub and OpenAI used a technique called multi-task learning, which involves training the model on multiple related tasks simultaneously. This approach allows the model to learn a wide range of coding tasks and produce more accurate suggestions. It also allows the model to learn from feedback provided by users, which can further improve its accuracy over time.
How Can Copilot Help Developers?
GitHub Copilot can help developers work more efficiently in several ways:
- Speeding up development: Copilot cuts down on the raw time it takes to write code by providing useful suggestions. What makes Copilot unique is that it has the ability to suggest far more than any of the existing autocomplete tools available. For example, it can autogenerate an entire function, with relevant business logic and arguments based on input such as a quality comment or valuable function name.
- Out-of-the-box thinking: Because Copilot’s ML model is trained on open source projects, it sometimes suggests valid code that you may not have otherwise thought to format as such. On more than one occasion, this resulted in cleaner code that is still easy to read.
- Learning new things: Copilot sometimes suggests code from a library that you haven’t used before. For example, it might suggest a valuable log along with a method from your database relationship management library to capture the raw database query that you did not know existed, which can help you learn and grow as a developer.
- Multiple languages supported: Copilot offers integration plugins for various products, including the entire JetBrains suite (my preferred IDE toolset). Once installed, Copilot immediately started assisting me with TypeScript, JSON, Markdown, Python, YAML, and SQL. What’s really cool is that you can write a SQL query in DataGrip, go to your WebStorm window, and click on the line of code where you would write the database query, and Copilot would suggest the same query you just wrote, but using the proper driver syntax for your backend server.
What’s the Catch?
Although AI is progressing at an incredible pace, it is absolutely critical for the one interacting with the tool to understand what is going on at a deep level. Since Copilot is a text predictor in its simplest of terms, it often times comes close to the mark, but requires some changes. Below are some examples of when Copilot wasn’t so helpful:
- Custom Functional Components: When working in a frontend repository, I often times would find myself being slowed down by Copilot’s suggestions. I believe this was due to Copilot’s limitations of being able to accurately predict what I was trying to create, since it has no way of knowing my context for how I am building a UI. I believe this will continue to be a limitation until Copilot has the ability to interface with static designs and gain context in that regard.
- Complex Algorithms: Although Copilot does a good job at offering suggestions, they are often rudimentary in nature. When dealing with data that needs heavy ETL formatting, copilot struggles with deeply chained Object notation.
My High Level Thoughts
In my experience, Copilot’s suggestions have been generally helpful and accurate, although there are times when its suggestions don’t quite match what I’m looking for. It’s important to remember that Copilot is still a relatively new technology and that there are limitations to what it can do. The technology is nowhere close to being able to independently create working, dependable software.
With that said, when used as an assistant to help pair program with, I believe it is going to become a must-have for developers with full workloads. Copilot has the potential to transform the way we write code and make us more productive and efficient developers, and I am excited to see what this tool will be able to do in the coming months and years.
The team at GitHub recently announced a new version, called Copilot X. This new version features a chat box style plug in, where you can ask it questions about code and it will respond, in addition to the existing feature set. Copilot X is currently in a closed beta status. Stay tuned for another article, just as soon as I gain access and have an opportunity to familiarize it. Thanks for reading!