What Is an AI Copilot?
Code LLMs, famously known as AI Copilots, enables developers to write code more efficiently by providing suggestions for code completion, write high-quality maintainable code, avail automatic code explanations, and more. Developers are now empowered to code and generate solutions to problems using natural language. These AI systems allow interacting with the IDE and developing software solutions to be done in a much more natural way.
What Is Starcoder?
StarCoder is a Large Language Model released by BigCoden aimed to act as an AI copilot for developers. It aims to do multiple chores like acting as a technical assistant, auto completing code, making code modifications and explaining code snippets through natural language. The base model is called StarCoderBase and StarCoder is a result of fine-tuning it on 35 billion Python tokens.
StarCoder and Its Capabilities
StarCoder is a part of the BigCode project. It is a joint effort of ServiceNow and Hugging Face. BigCode is an effort to build open-source AI tools around code generation. As a result, StarCoder has been made available under an OpenRAIL licence for usage by the community.
The model was trained across 86 programming languages through permissively licensed data from GitHub. All the languages ranked within the top 50 for the most popular languages have been included. All of these languages had an individual dataset size of more than 500 MB leading to a total training on 1 trillion tokens for the final model. The data included GitHub commits, issues (enabling it to act as technical assistant) and notebooks (Jupyter). The final model is on the smaller side with 15 billion parameters trained on 1 trillion tokens. StarCoderBase was then fine-tuned on 35 billion Python tokens for 2 epochs. The final dataset used to train the entire model has a total size of 815 GB.
StarCoder has been made open source under the OpenRAIL licence. The licence allows open access, use and distribution of licenced material like AI artefacts for which it is primarily designed. The licence promotes ‘Open’ and ‘Responsible’ use of the product which holds it. As for StarCoder, it is allowed to be used, modified, distributed and made derivatives under some conditions/restrictions enforced by its licence such as:
- Attribution
- Transparency
- Ethical use
- Data protection
- No endorsement
Steps to Deploy and Use StarCoder Locally
Here we will be discussing setting up StarCoder on a TIR notebook environment on E2E Cloud.
- Set up your environment and install the libraries.
- Login to Hugging Face with your access token.
- Obtain permissions for using the model from here.
- Import the libraries and download the model from Hugging Face.
- Run the model through a custom input as an argument to tokenizer.encode()
Benefits of Using StarCoder vs Proprietary AI Copilots
Proprietary AI copilots such as GitHub Copilot are designed to work with specific IDEs (Integrated Development Environment) even if they provide support to many languages. This is due to their closed source nature and thereby the lack of flexibility on how they can be used and where they can be integrated. Proprietary copilots can also be kept under a paywall when the company pleases it and thereby access/usage can be disrupted under various unfavourable conditions. Changes and modifications that suit the particular user/benefit users would be less negotiable unlike in an open source project like StarCoder. StarCoder and its open source nature allows it to be freely accessed and used by individuals and organisations alike, freely integrated to their IDEs and other softwares, updates and changes all monitored and kept in favour of the growth of the entire community.
How Enterprises Can Leverage StarCoder to Power Their Programmers and R&D
How Was StarCoder Trained and How Expensive Can It Get?
The StarCoderBase model was trained on 512 Nvidia A100 80 GB GPUs distributed across 64 nodes. With various parallelization and other optimizations during training, the base model took a total of 24 days of training and a power usage of 280W per GPU. The fine-tuning of the model in the same set-up to produce StarCoder took 3.5% of the original training time under the same hardware conditions. Again, StarCoder is a fine-tuned Python version of the base model trained for 2 epochs on the original data’s Python subset.
The final power consumption estimate for the training is 89671.68 kWh. The total time it took for training the GPU was 24 days. The cheapest rate of renting an A100 80GB GPU from E2E Cloud for an hour is approximately $3.39. We need a total of 512 such GPUs giving a cost of $1735.68/hour. Our total training time was 576 hours. A rough estimate of the final cost for just training StarCoderBase would be $999K. Now fine-tuning adds around 3.5% of the original training time. This gives a total final cost of $1.03 million. All this is a rough estimate by factoring in purely the E2E Cloud GPU rental costs.
How Beneficial Is Such a Tool for an Enterprise?
Code LLMs enable people from all backgrounds to write higher quality code and, thereby, develop no-code/low-code applications. This greatly enhances what can be done through a given amount of knowledge and skill – enabling access to technology in much wider hands.
Enterprises can use these LLMs to help their developers write high-quality code all the time, which is very important for the maintenance of a lot of applications which are mission critical. Effort spent on refactoring low-quality code can be used elsewhere, thereby saving massively on cost. This can also help relatively early developers to easily learn and implement good quality maintainable systems, which makes the entire process more worthwhile.
The usage of Code LLMs like StarCoder is useful for businesses of all sizes. They have various benefits like automating code generation and improving code quality – all of which leads to greatly enhanced speed and efficiency in software development. The time and effort gained from deploying such a tool cannot be overstated.
Conclusion
StarCoder is a tool that distributes the power of Code LLMs into the hands of all individuals and enterprises. Its open-source nature allows state-of-the-art code generation capabilities to be availed for free by the masses, thereby fueling a great increase in productivity and learning. Models like these encourage research and funding into the open-source AI community as well.