Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement #46

Open
shnakazawa opened this issue May 6, 2024 · 0 comments

Comments

@shnakazawa
Copy link
Contributor

OpenCodeInterpreter Zheng et al., arXiv 2024
Zheng, Tianyu, et al. “OpenCodeInterpreter: Integrating Code Generation with Execution and Refinement.” arXiv [cs.SE], 22 Feb. 2024, http://arxiv.org/abs/2402.14658. arXiv.

  • ChatGPTのCodeInterpreterのように、LLMがコードを生成→生成したコードを実行→反復的に洗練する機能を統合したシステムをオープンソースとして公開。
  • GPT-3.5や4の力を借りて6万8千件の人 (を模倣した生成文)・コード・実行結果の往復を記録した Code-Feedbackデータセットを作成。
  • エラーメッセージだけでなく人からの助言を受けると、課題を正しく認識し適切なコードを生成する性能がさらに向上した。

Abstract

The introduction of large language models has significantly advanced code generation. However, open-source models often lack the execution capabilities and iterative refinement of advanced systems like the GPT-4 Code Interpreter. To address this, we introduce OpenCodeInterpreter, a family of open-source code systems designed for generating, executing, and iteratively refining code. Supported by Code-Feedback, a dataset featuring 68K multi-turn interactions, OpenCodeInterpreter integrates execution and human feedback for dynamic code refinement. Our comprehensive evaluation of OpenCodeInterpreter across key benchmarks such as HumanEval, MBPP, and their enhanced versions from EvalPlus reveals its exceptional performance. Notably, OpenCodeInterpreter-33B achieves an accuracy of 83.2 (76.4) on the average (and plus versions) of HumanEval and MBPP, closely rivaling GPT-4's 84.2 (76.2) and further elevates to 91.6 (84.6) with synthesized human feedback from GPT-4. OpenCodeInterpreter brings the gap between open-source code generation models and proprietary systems like GPT-4 Code Interpreter.

(DeepL翻訳)

大規模な言語モデルの導入により、コード生成が大幅に進歩した。しかし、オープンソースのモデルは、GPT-4コード・インタープリタのような先進的なシステムの実行機能や反復的な改良に欠けていることが多い。この問題に対処するために、我々はOpenCodeInterpreterを紹介する。OpenCodeInterpreterは、コードの生成、実行、反復的な改良のために設計されたオープンソースのコードシステム・ファミリーである。OpenCodeInterpreterは、6万8千のマルチターン相互作用を含むデータセットであるCode-Feedbackによってサポートされ、実行と人間のフィードバックを統合して、ダイナミックなコード改良を行う。OpenCodeInterpreterをHumanEval、MBPP、およびEvalPlusの強化バージョンなどの主要なベンチマークで包括的に評価したところ、その卓越した性能が明らかになりました。特に、OpenCodeInterpreter-33Bは、HumanEvalとMBPPの平均(およびプラスバージョン)で83.2 (76.4)の精度を達成し、GPT-4の84.2 (76.2)に匹敵し、GPT-4から合成された人間のフィードバックでさらに91.6 (84.6)まで上昇しました。OpenCodeInterpreterは、オープンソースのコード生成モデルとGPT-4 Code Interpreterのようなプロプライエタリなシステムとの間のギャップを解消します。

コード

https://opencodeinterpreter.github.io/

解決した課題/先行研究との比較

  • 様々なオープンソースのコード生成モデルが開発されてきている。
  • 先行研究はコードの実行機能を持たないものが多く、生成されたコードの実際の実行やその結果に基づいてコードを評価・修正する機能は限られていた。
  • 本論文ではコードの実行と反復的なコードの精緻化の機能を統合したOpenCodeInterpreterシステムを提案。

技術・手法のポイント

  • 反復的なコードの精緻化を学習させるため、Code-Feedback データセットを作成
    • 68,000件
    • 現実のニーズにあった課題
    • 人とコード、コンパイラ間の複数回の往復
      • 往復のデータセットとすることで、コードの実行結果だけでなく、それに対する人による改善案も含めることができた。
      • 人の助言の大部分はGPT-4を用いてのシミュレート
        • (51,000件シミュレート例を作ったと記載があるが、それらをすべてデータセットに含めたのかが明確でない)
    • 各回答には自然言語とコードの両方を含む
    • GPT-4に意図的に間違ったコードを500パターン生成させて、その実行結果をデータセットに加えたことで、動くコードの生成と動かないコードの修正の両方を学習できた

評価指標

  • 上記のデータセットを用いて特定の言語モデルをfine-tuning

    • 論文中では CodeLlama と DeepSeekCoder がベースとなっている
  • 下図はTable 1 より一部を抜粋。実際は下にスケールの大きなモデルの結果が続く。
    Image from Gyazo

  • プログラミングタスクであるHumanEval及びMBPP (Mostly Basic Python Problems) で性能を評価

  • 4パターンの評価

    • Single-turn: 一発生成
    • Excecution Feedback: 実行結果をフィードバック→再生成
    • Synth: Human Feedback: 実行結果に加え、GPT-4に人っぽい入力を生成させてフィードバック→再生成
    • Synth: Human... (Oracle): 動くコード = 答えを知っているGPT-4にフィードバック文を生成させる→再生成
  • フィードバックを加えた場合にGPT-3.5 Turbo並み〜GPT-4 Turboに迫る性能を発揮

残された課題・議論・感想

  • 言語の得意不得意やドメイン知識の偏りがあるかもしれない。
  • ユーザーの意図を理解できるかどうかは基本となるモデルとCode-Feedbackデータセットに含まれる依るため、意図が非常に複雑な場合は対応できないかもしれない。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant