GitHub Copilotの導入検討
GitHub Copilotを(特に組織として)導入する場合の検討事項を主に2つの観点から評価する
①安全性
・コードベースがトレーニングデータに使用されないか
・脆弱なコードがサジェストされないか
②コストメリット
・現在のコードベースに対してどれくらい有益なサジェストが得られるか
・Copilotによる生産性向上の寄与率がどれくらい見込めるか(コストバランスが取れているか)
トレーニングデータについて
What data has GitHub Copilot been trained on?
GitHub Copilot is powered by generative AI models developed by GitHub, OpenAI, and Microsoft. It has been trained on natural language text and source code from publicly available sources, including code in public repositories on GitHub.
Does GitHub Copilot use any of your code to train the GitHub's model (or any successor model)?
No. GitHub uses neither Copilot Business nor Enterprise data to train the GitHub model.
パブリックリポジトリのコードや公開されているソースをトレーニングデータとして使用している。
少なくともCopilot BusinessやEnterpriseはリポジトリ自体を公開しない限り、プライベートなコードがトレーニングデータに使われる心配はなさそう。
Model training and improvements
By default, GitHub, its affiliates, and third parties will not use your data, including prompts, suggestions, and code snippets, for AI model training. This is reflected in your personal settings for GitHub Copilot and cannot be enabled.
Individualでもデフォルトでコードスニペットをトレーニングデータにはしないし有効にもできないとあるので大丈夫そう。
確かにCopilotの設定画面ではDisabledから変更できない。
上の設定画面の
Allow GitHub to use my data for product improvements
これにチェック入ってるとどうなるか気になる
Allow GitHub, its affiliates and third parties to use my data, including Prompts, Suggestions, and Code Snippets, for product improvements. More information in the Privacy Statement.
これだけ読むと、コードスニペットをproduct improvementsのためにuseする=トレーニングデータとして使用する?とも解釈できそうだが。
GitHub Copilot (i) may collect and process data based on your settings and the specific GitHub Copilot Service you use - this may include Prompts, Suggestions, and code snippets, and (ii) will collect additional usage information through the GitHub Copilot Service you use tied to your Account - this may include Service Usage Information, Website Usage Data, and Feedback Data. Upon your instructions, we may share this data with third-party applications such as those on the GitHub Marketplace or third-party AI models of your choosing. This may include personal data, as referenced in the GitHub Privacy Statement. You can learn more about the collection and use of GitHub Copilot data in the GitHub Copilot Trust Center.
For GitHub Copilot Free users, the data collected by GitHub Copilot may be used for AI Model training where permitted and if you allow in your settings.
要約すると、
- Copilotはプロンプト(コード含む)を収集する場合がある
- Copilot Freeユーザーは、設定で許可していればCopilotによって収集されたデータをモデルのトレーニングに使われることがある
設定ではDisableから変更できなかったが?
Does GitHub Copilot retain any of your prompts that it used as a basis for providing suggestions?
The GitHub Copilot extension in the code editor does not retain your prompts for any purpose after it has provided Suggestions, unless you are a Copilot Pro or Copilot Free subscriber and have allowed GitHub to retain your prompts and suggestions.
As noted above, Copilot does transfer content from your code editor to GitHub’s servers for purposes of assessing the context and providing suggestions. The transferred copy is purely ephemeral and, shortly after Copilot has provided suggestions, the copy is deleted. It is not used for any other purpose.
GitHub Copilot offerings outside of the code editor extension, such as in the CLI, do retain your prompts and suggestions in order to provide the service. For more information please review the Privacy section.
一方でこんな記述もある。
IDEからCopilot ProおよびCopilot Freeを使用する場合はプロンプトは保存されず(提案後即座に削除)、他の目的には使用されないとのこと。
If and for how long GitHub’s retains Copilot data depends on how a Copilot user accesses Copilot and for what purpose. The default settings for Copilot Business and Enterprise Customers are as follows:
Access through IDE for Chat and Code Completions:
Prompts and Suggestions: Not retained
User Engagement Data: Kept for two years.
Feedback Data: Stored for as long as needed for its intended purpose.
Copilot BusinessやEnterpriseでも大体同じことが書かれてる。
どうも、設定画面のAllow GitHub to use my data for product improvementsのチェック項目は、直接的に「トレーニングデータとして使用してもよい」ということを意味しているわけではないっぽい。
ただ、GitHubの言うproduct improvementsにモデルの改善も暗に含まれるのかどうか(=トレーニングデータに使用される可能性があるか)というところは確証は持てなかったので念のためチェックは外しておいたほうが良さげ。
Copilotが脆弱性を含むコードを吐く可能性
こういうことがある
一方でGitHubも脆弱性フィルタリングのモデル改善はやってそうなのでここは正直あんまり心配してもしょうがない気はする。最終的には人の判断が必要。
コストメリット
Copilotによってどの程度コードを書く時間を削減することができれば導入のメリットがあると言えるかを試算する。
エンジニアの一人当たりの時間単価(A)、Copilotの導入によって1か月に削減できる時間(B)、Copilotの1か月あたりのコスト(C)として、
が成り立てばコストメリットがあると判断できるので、Bを基準に考えるなら
となるBの下限を考えればいい。
Copilotの1か月あたりのコスト(C)は、Businessプランの場合、1ユーザーあたり$19/月なので、1ドル=147円換算で計算すると約2,793円/月。
エンジニアの一人当たりの時間単価(A)は、1か月あたり20日、1日あたり8時間の稼働を例にとると
1か月の人件費 | A | C/A(=Bの下限) |
---|---|---|
300,000 | 1,875 | 1.49 時間/月 |
400,000 | 2,500 | 1.12 時間/月 |
500,000 | 3,125 | 0.89 時間/月 |
600,000 | 3,750 | 0.74 時間/月 |
700,000 | 4,375 | 0.64 時間/月 |
800,000 | 5,000 | 0.56 時間/月 |
900,000 | 5,625 | 0.50 時間/月 |
と試算できる。
体感的には余裕でコストを上回るメリットが得られそうではあるが、コードベースのコンテキストによっては正確なサジェストがどれくらい期待できるかは定性的な評価が必要。
問題は、実際にCopilotの導入によって1か月に削減できた時間(Bの実測値)をどう計測するか。
Copilot Metrics APIというのがあるらしい。
さらにAPIをビジュアライズ化したアプリケーションCopilot Metrics Viewerもある。
これを使うとCopilotによって提案された数(行数)・受け入れられた数(行数)が得られるっぽいので、これで削減時間の目安が立てれるかも。
コントリビューターのインサイトみてコードにチェックインする機会の多い人に絞って試験導入し、Metrics APIで使用状況を定量評価するのが良さそう。
Copilotを組織利用する場合に設定しておいた方がいいポリシー
Suggestions matching public code
パブリックコードに一致する提案を許可するか。⇒ Blocked
著作権侵害を防ぐための設定。
※Businessプランの場合は組織レベルで設定(個人で設定はできない)
Allow GitHub to use my data for product improvements
プロンプトやコードスニペットをGitHubの改善に利用することを許可するか。 ⇒ チェック外す
前述の通りトレーニングデータに使用される可能性を払拭できないため。
※Businessプランの場合そもそもこの項目はない
コンテンツの除外設定もしておくといい。
[Settings] -> [Copilot] -> [Content exclusion]
これ設定しておくと指定したファイルではサジェストさせないことが可。
環境変数ファイルなどクレデンシャルを含む機密情報をCopilotに食わせたくない場合に。