<p>There does not seem to be a client-facing feature allowing you to fine-tune Copilot directly.</p>
<p>Here are two illustration as to why this feature is, for now (Q2 2022) missing.</p>
<p>The <a href="https://github.com/features/copilot" rel="nofollow noreferrer">Copilot feature page</a> initially included this:</p>
<blockquote>
<h2>How will GitHub Copilot get better over time?</h2>
<p>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.</p>
</blockquote>
<p>As <a href="https://twitter.com/tomekkorbak" rel="nofollow noreferrer">Tomek Korbak</a> explains <a href="https://twitter.com/tomekkorbak/status/1410554250514636805" rel="nofollow noreferrer">on Twitter</a>:</p>
<blockquote>
<p>Actually, Copilot's completions will always be optimised for human's liking, not necessarily compiler's liking.</p>
<p>That's because the language model training objective (predicting the next token in text) is great at capturing short-term dependencies (which explains the human feel of generated snippets).</p>
<p>But it struggles to capture long-term, global, semantic properties of generated sequences such as compilability. And there's no easy way of including compilability as a signal for their training.</p>
<p>The standard way -- fine-tuning language models using RL with compilability as a reward -- notoriously leads to catastrophic forgetting: less diverse and less accurate completions.</p>
</blockquote>
<p>Tomek references &quot;<a href="https://arxiv.org/pdf/2106.04985.pdf" rel="nofollow noreferrer">Energy-Based Models for Code Generation under Compilability Constraints (pdf)</a>&quot;</p>
<blockquote>
<p><a href="https://i.stack.imgur.com/ulfPr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ulfPr.png" alt="https://pbs.twimg.com/media/E5NHqGjXIAYRtwa?format=png&amp;name=small" /></a></p>
<p>Our solution (KL-DPG) boosts compilability rate of generated sequences from 55% to 70%.<br />
RL fine-tuning can do better but at a cost of catastrophic forgetting.</p>
<p>Overall, energy-based models (EBMs) turn out to be great at expressing weird, sequence-level constraints that would be super hard as to express as normalised priors for autoregressive language models.</p>
<p>EBMs provide a way of injecting our structured, symbolic knowledge into large language models without breaking them down or sacrificing their uncanny abilities.<br />
The space of further applications in controllable generation is huge.</p>
</blockquote>
<p>So not so easy.</p>
<p><a href="https://tmabraham.github.io/" rel="nofollow noreferrer">Tanishq Mathew Abraham</a> explains in &quot;<a href="https://tmabraham.github.io/blog/github_copilot" rel="nofollow noreferrer">Coding with GitHub Copilot</a>&quot;</p>
<blockquote>
<p>I wonder if the GitHub team might also develop a way of perhaps fine-tuning GitHub Copilot to specific use-cases.</p>
<p>For example, there may be a specific GitHub Copilot models for fastai, JAX, etc. They would be fine-tuned on the source code of of these libraries and codebases that use these libraries.</p>
<p>But making sure that the tool does not provide outdated suggestions would still be a challenge.<br />
I don’t think it would be possible to provide suggestions for a brand-new library that does not have enough codebases using it to train on.</p>
<p>Additionally, for situations like fastai where there are older APIs and newer APIs, when fine-tuning a model, the codebases using the older APIs would have to be filtered out.</p>
</blockquote>
How to fine tune fine tune GitHub Copilot?
<p>We can fine tune language models like <code>BERT</code>, <code>GPT-3</code>.</p>
<p>Can I fine tune <code>GitHub Copilot</code> model?</p>
<p>I have already looked into examples from <a href="https://copilot.github.com/" rel="nofollow noreferrer">https://copilot.github.com/</a> but cant find the details.</p>
<p>Would really appreciate if someone had fine tuned Github Copilot.</p>