一行要約

SWE-bench はモデル単体ではなくエージェントシステム全体を測るため、同じモデルでも scaffold 次第でスコアが大きく変わる。この記事の価値はスコアではなく、現在の Claude Code の Bash / Edit ツールの原型となったツール仕様そのものにある。

注意: スコアは 2025年1月時点。当時の SOTA 49% は 2026年時点で 80% 超に更新されている。読むべきはツール設計の部分。

要点

スコア(当時)

モデルSWE-bench Verified
Claude 3.5 Sonnet (new)49%
従来の SOTA45%
Claude 3.5 Sonnet (old)33%
Claude 3 Opus22%

なぜ SWE-bench を重視したか(3つの理由)

  1. 競技やコーディング面接の問題ではなく、実プロジェクトの実タスクを使う
  2. まだ飽和していない — SWE-bench Verified で 50% を超えたモデルがなかった
  3. モデル単体ではなくエージェントシステム全体を測る

SWE-bench doesn’t just evaluate the AI model in isolation, but rather an entire “agent” system. The performance of an agent on SWE-bench can vary significantly based on this scaffolding, even when using the same underlying AI model. SWE-bench は AI モデル単体を評価しているのではなく、「エージェント」システム全体を評価している。SWE-bench でのエージェントの性能は、同じ基盤モデルを使っていても、この scaffolding 次第で大きく変わりうる。

scaffold の設計

最小限の scaffolding でモデルに最大限の制御を渡すという哲学。ツールは2つだけ

ツール役割
Bash Toolbash コマンドを実行する。状態は呼び出しをまたいで永続する
Edit Toolstr_replace_editorファイルの閲覧・作成・編集。view / create / str_replace / insert / undo_edit の5コマンド

「ツールをエラー耐性のある設計にする」

One way we improved performance was to “error-proof” our tools. 性能を高めた方法のひとつは、ツールを「間違えにくく」することだった。

この節が現在も最も価値のある部分。具体的な工夫:

  • 絶対パスを必須にする — 相対パスの誤りを構造的に防ぐ
  • str_replace は完全一致を要求し、マッチが 0件でも 2件以上でも失敗させる — 曖昧な置換を成立させない
  • ツールの description とスキーマに多様なエージェンティックタスクにわたって多大な労力をかけた

We put a lot of effort into the descriptions and specs for these tools across a wide variety of agentic tasks. これらのツールの説明と仕様には、多種多様なエージェント的タスクにわたって多大な労力を注いだ。

モデルの振る舞い

The updated Claude 3.5 Sonnet is tenacious: it can often find its way around a problem given enough time. 更新版の Claude 3.5 Sonnet は粘り強い。十分な時間を与えれば、問題を回り込んで解決することが多い。

  • 自己修正の頻度が上がった
  • 同じ誤りを繰り返すのではなく、複数の解法を試すようになった
  • 成功した run は数百ターン、10万トークン超に及ぶものも多い

課題

  1. 実行時間とトークンコスト(多くの run で 10万トークン超)
  2. 採点の複雑さ — 環境構築の問題、パッチ適用の問題
  3. 隠しテストモデルは成功したと思っているのに、実際は失敗していることがある
  4. マルチモーダルの制約 — ファイルや URL を見られない(Matplotlib のタスクで特に問題)

そのまま使える具体例

タスクプロンプトreproduce → fix → rerun → edge cases の型がそのまま使える):

<uploaded_files>
{location}
</uploaded_files>
I've uploaded a python code repository in the directory {location} (not in /tmp/inputs). Consider the following PR description:
 
<pr_description>
{pr_description}
</pr_description>
 
Can you help me implement the necessary changes to the repository so that the requirements specified in the <pr_description> are met?
I've already taken care of all changes to any of the test files described in the <pr_description>. This means you DON'T have to modify the testing logic or any of the tests in any way!
 
Your task is to make the minimal changes to non-tests files in the {location} directory to ensure the <pr_description> is satisfied.
 
Follow these steps to resolve the issue:
1. As a first step, it might be a good idea to explore the repo to familiarize yourself with its structure.
2. Create a script to reproduce the error and execute it with `python <filename.py>` using the BashTool, to confirm the error
3. Edit the sourcecode of the repo to resolve the issue
4. Rerun your reproduce script and confirm that the error is fixed!
5. Think about edgecases and make sure your fix handles them as well
 
Your thinking should be thorough and so it's fine if it's very long.

Bash ツールの定義(description に運用上の注意を書き込んでいるのが要点):

{
   "name": "bash",
   "description": "Run commands in a bash shell\n* When invoking this tool, the contents of the \"command\" parameter does NOT need to be XML-escaped.\n* You don't have access to the internet via this tool.\n* You do have access to a mirror of common linux and python packages via apt and pip.\n* State is persistent across command calls and discussions with the user.\n* To inspect a particular line range of a file, e.g. lines 10-25, try 'sed -n 10,25p /path/to/the/file'.\n* Please avoid commands that may produce a very large amount of output.\n* Please run long lived commands in the background, e.g. 'sleep 10 &' or start a server in the background.",
   "input_schema": {
       "type": "object",
       "properties": {
           "command": {
               "type": "string",
               "description": "The bash command to run."
           }
       },
       "required": ["command"]
   }
}

Edit ツールの descriptionold_str の一意性要件を明記しているのが error-proofing の実例):

Custom editing tool for viewing, creating and editing files
* State is persistent across command calls and discussions with the user
* If `path` is a file, `view` displays the result of applying `cat -n`. If `path` is a directory, `view` lists non-hidden files and directories up to 2 levels deep
* The `create` command cannot be used if the specified `path` already exists as a file
* If a `command` generates a long output, it will be truncated and marked with `<response clipped>`
* The `undo_edit` command will revert the last edit made to the file at `path`
 
Notes for using the `str_replace` command:
* The `old_str` parameter should match EXACTLY one or more consecutive lines from the original file. Be mindful of whitespaces!
* If the `old_str` parameter is not unique in the file, the replacement will not be performed. Make sure to include enough context in `old_str` to make it unique
* The `new_str` parameter should contain the edited lines that should replace the `old_str`

Edit ツールの入力スキーマ:

{
   "input_schema": {
       "type": "object",
       "properties": {
           "command": {
               "type": "string",
               "enum": ["view", "create", "str_replace", "insert", "undo_edit"],
               "description": "The commands to run. Allowed options are: `view`, `create`, `str_replace`, `insert`, `undo_edit`."
           },
           "file_text": {
               "description": "Required parameter of `create` command, with the content of the file to be created.",
               "type": "string"
           },
           "insert_line": {
               "description": "Required parameter of `insert` command. The `new_str` will be inserted AFTER the line `insert_line` of `path`.",
               "type": "integer"
           },
           "new_str": {
               "description": "Required parameter of `str_replace` command containing the new string. Required parameter of `insert` command containing the string to insert.",
               "type": "string"
           },
           "old_str": {
               "description": "Required parameter of `str_replace` command containing the string in `path` to replace.",
               "type": "string"
           },
           "path": {
               "description": "Absolute path to file or directory, e.g. `/repo/file.py` or `/repo`.",
               "type": "string"
           },
           "view_range": {
               "description": "Optional parameter of `view` command when `path` points to a file. If none is given, the full file is shown. If provided, the file will be shown in the indicated line number range, e.g. [11, 12] will show lines 11 and 12. Indexing at 1 to start. Setting `[start_line, -1]` shows all lines from `start_line` to the end of the file.",
               "items": {"type": "integer"},
               "type": "array"
           }
       },
       "required": ["command", "path"]
   }
}

原典で言及されている関連文書

未取得の派生リンク