🤖We trained a small 1.6b code model that reaches 32% HumanEval🤖
Tags: ai, llm, githubcopilot, programming
Published: 2023-09-05 10:15:23

Today we're introducing Refact LLM: 1.6B code model with infill real-time code completion (including fill-in-the-middle(FIM) capability) and chat.
Refact LLM achieves the state-of-the-art performance among the code LLMs, coming closer to  HumanEval as Starcoder, being 10x smaller in size, and it beats other code models such as StableCode, CodeGen and ReplitCode on HumanEval metric. 

**Summary**:
<ul class="normal">
    <li>1.6b parameters</li> 
    <li>20 programming languages</li> 
    <li>4096 tokens context</li> 
    <li>code completion and chat capabilities</li> 
    <li>SoTA on HumanEval benchmark among similar code models</li> 
    <li>pre-trained on permissive licensed code and available for commercial use</li> 
</ul>
<div class="blog-table">
    <table>
        <thead>
            <tr>
                <th>Model</th>
                <th>Model Size</th>
                <th>HumanEval pass@1</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>DeciCoder-1b</td>
                <td>1b</td>
                <td>19.1%</td>
            </tr>
            <tr class="blog-table--hightlight">
                <td>Refact-1.6-fim</td>
                <td>1.6b</td>
                <td>32.0%</td>
            </tr>
            <tr>
                <td>StableCode</td>
                <td>3b</td>
                <td>20.2%</td>
            </tr>
            <tr>
                <td>ReplitCode v1</td>
                <td>3b</td>
                <td>21.9%</td>
            </tr>
            <tr>
                <td>CodeGen2.5-multi</td>
                <td>7b</td>
                <td>28.4%</td>
            </tr>
            <tr>
                <td>CodeLlama</td>
                <td>7b</td>
                <td>33.5%</td>
            </tr>
            <tr>
                <td>StarCoder</td>
                <td>15b</td>
                <td>33.6%</td>
            </tr>
        </tbody>
    </table>
</div>

The base model was trained on our own set of code with permissive licenses only and open text datasets (the text to code ratio was 50:50). In total, we trained our base model on 1.2T tokens of code on our cluster.

The model was then fine-tuned with open code instruction-following datasets filtered for quality and a synthetic dataset based on [The Stack dedup v1.1](https://huggingface.co/datasets/bigcode/the-stack-dedup) to improve FIM and boosting the base model performance. 

You can read more about the architecture decisions that we made in the [blog post](https://refact.ai/blog/2023/applying-recent-innovations-to-train-model/). 

We aim for the model to be accessible to everyone, we're releasing the model for commercial use under BigScience OpenRAIL-M license and making the weight available on [HuggingFace](https://huggingface.co/smallcloudai/Refact-1_6B-fim). 

While the trend recently was for the model sizes to get bigger, we wanted to lower barriers to entry and make it a versatile tool for developers with varying hardware setups. With the smaller size, running the model is much faster and affordable than ever: the model can be served on most of all modern GPUs requiring just 3Gb RAM and works great for real-time code completion tasks.

Refact LLM can be easily integrated into existing developers workflows with [an open-source docker container](https://github.com/smallcloudai/refact/) and [VS Code](https://marketplace.visualstudio.com/items?itemName=smallcloud.codify) and [JetBrains](https://plugins.jetbrains.com/plugin/20647-codify) plugins. With Refact's intuitive user interface, developers can utilize the model easily for a variety of coding tasks. Finetune is available in the self-hosting (docker) and Enterprise versions, making suggestions more relevant for your private codebase.

<p class="blog-left">
  <img style="width: 100%; height: auto" src="https://refact.ai/images/blog/introducing-refact-code-llm/palindrome.gif" />
</p>

Refact 1.6B LLM is the third model in the family of our code models, with [CodeContrast 3b](https://huggingface.co/smallcloudai/codify_3b_multi) and [CodeContrast 0.3b](https://huggingface.co/smallcloudai/codify_medium_multi) released previously. We aim to continue with our research and future updates to improve the LLM's performance and capabilities. We would love to get community contributions and feedback to enhance the model further. For any questions and ideas, please visit our [Discord](https://smallcloud.ai/discord).