Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,22 @@ Supply `PHOENIX_API_KEY` through your environment. Set `API_BASE` for a custom O
./run.sh --model glm-5.2 --instances /path/to/tasks.jsonl --output runs/glm-repair
```

Each completed task writes `PhoenixRepair.patch` under `<output>/<model>/<instance_id>/`. Use `--resume` with the same inputs to continue an interrupted run. The GLM-5.2 and Qwen3.7-Plus generation profiles disable thinking and use a 32,768-token output limit. Model request defaults live in `phoenix/settings.py` and per-model run budgets in `configs/models/`.
Each completed task writes `PhoenixRepair.patch` under `<output>/<model>/<instance_id>/`. Use `--resume` with the same inputs to continue an interrupted run. Model request defaults live in `phoenix/settings.py` and per-model run budgets in `configs/models/`.

## Published results for the original method
## Inference profiles

### Pass@1 on SWE-bench Verified
Use the profile name with `--model`. The settings below apply to localization, patch generation and candidate comparison. Output limits are per response.

| Method | LLM | Resolved (%) |
|--------|-----|--------------|
| Mini-SWE-agent | DeepSeek-V3.2 | 61.0% |
| Live-SWE-agent | DeepSeek-V3.2 | 63.8% |
| SWE-Search | DeepSeek-V3.2 | 65.4% |
| Agentless | DeepSeek-V3.2 | 67.0% |
| Trae-agent | DeepSeek-V3.2 | 67.8% |
| SWE-agent | DeepSeek-V3.2 | 69.4% |
| Moatless-tools | Claude-4-Sonnet | 70.8% |
| **PhoenixRepair** | **DeepSeek-V3.2** | **74.4%** (+5.0%) |
| Profile | Thinking | Temperature | Top-p | Context tokens | Output tokens |
| --- | --- | ---: | ---: | ---: | ---: |
| `deepseek-v3.1` | Off | 0.6 | 0.95 | 131,072 | API default |
| `deepseek-v3.2` | Off | 1.0 | 0.95 | 131,072 | API default |
| `qwen3-coder-plus` | Off | 0.7 | 0.80 | 1,000,000 | 65,536 |
| `glm-4.7` | On | 0.7 | 1.00 | 202,752 | 131,072 |
| `minimax-m2.5` | On (native) | 1.0 | 0.95 | 204,800 | 32,768 |
| `glm-5.2` | Off | 1.0 | 1.00 | 1,048,576 | 131,072 |
| `qwen3.7-plus` | Off | 1.0 | 0.95 | 1,000,000 | 131,072 |
| `qwen3.7-plus-thinking` | On | 1.0 | 0.95 | 1,000,000 | 131,072 |
| `qwen-3.8-max` | Off | 1.0 | 0.95 | 1,000,000 | 131,072 |

### Fault Localization Accuracy

| Method | LLM | File Acc@1 | Module Acc@1 | Function Acc@1 |
|--------|-----|------------|--------------|----------------|
| SWE-agent | DeepSeek-V3.2 | 83.04% | 74.22% | 63.42% |
| **PhoenixRepair** | **DeepSeek-V3.2** | **85.64%** (+2.60%) | **76.82%** (+2.60%) | **66.64%** (+3.22%) |
Both DeepSeek profiles send `deepseek-chat` and omit the output-length parameter. To reproduce V3.1 (2025-08-21) or V3.2 (2025-12-01), set `API_BASE` to a deployment serving that release. The shared API identifier alone cannot pin a snapshot. Both Qwen-3.7 Plus profiles send `qwen3.7-plus` with the selected thinking flag.
4 changes: 0 additions & 4 deletions config/locate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,5 @@ agent:
history_processors:
- type: cache_control
last_n_messages: 2
model:
temperature: 1
completion_kwargs:
reasoning_effort: high
localization_independent_hypotheses: true
localization_complete_strategies: true
4 changes: 0 additions & 4 deletions configs/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Current GLM PhoenixRepair: complete localization -> 200 shared generation calls, 32K output.
model: glm-5.2
instances: null
runtime: null
output: runs/PhoenixRepair
concurrency: 4
max_steps: 200
max_input_tokens: 131072
context_compaction_threshold: 120000
context_compaction_target: 110000
localization_max_steps: 150
localization_timeout: null
task_timeout: 7200
Expand Down
2 changes: 2 additions & 0 deletions configs/models/deepseek-v3.1/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: deepseek-v3.1
output: runs/deepseek-v3.1-repair
2 changes: 2 additions & 0 deletions configs/models/deepseek-v3.2/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: deepseek-v3.2
output: runs/deepseek-v3.2-repair
2 changes: 1 addition & 1 deletion configs/models/deepseek-v4.1-flash/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Same settings as the current GLM 200-call/32K PhoenixRepair experiment; only model/output differ.
# Historical DeepSeek Flash profile with a 200-call budget and 32K output limit.
model: deepseek-v4.1-flash
instances: null
runtime: null
Expand Down
2 changes: 2 additions & 0 deletions configs/models/glm-4.7/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: glm-4.7
output: runs/glm-4.7-repair
4 changes: 0 additions & 4 deletions configs/models/glm-5.2/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# Current GLM PhoenixRepair: complete localization -> 200 shared generation calls, 32K output.
model: glm-5.2
instances: null
runtime: null
output: runs/glm-5.2-repair
concurrency: 4
max_steps: 200
max_input_tokens: 131072
context_compaction_threshold: 120000
context_compaction_target: 110000
localization_max_steps: 150
localization_timeout: null
task_timeout: 7200
Expand Down
2 changes: 2 additions & 0 deletions configs/models/minimax-m2.5/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: minimax-m2.5
output: runs/minimax-m2.5-repair
2 changes: 2 additions & 0 deletions configs/models/qwen-3.8-max/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: qwen-3.8-max
output: runs/qwen-3.8-max-repair
2 changes: 2 additions & 0 deletions configs/models/qwen3-coder-plus/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: qwen3-coder-plus
output: runs/qwen3-coder-plus-repair
2 changes: 2 additions & 0 deletions configs/models/qwen3.7-plus-thinking/PhoenixRepair.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
model: qwen3.7-plus-thinking
output: runs/qwen3.7-plus-thinking-repair
4 changes: 3 additions & 1 deletion phoenix/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main(argv=None):
parser.add_argument("--concurrency", type=int)
parser.add_argument("--max-steps", type=int)
parser.add_argument("--no-truncation", action="store_true", default=None, help="Keep full context and observations; reject length-truncated responses")
parser.add_argument("--max-input-tokens", type=int, help="Generation context limit; historical default 131072")
parser.add_argument("--max-input-tokens", type=int, help="Generation context limit (defaults to the model profile)")
parser.add_argument("--context-compaction-threshold", type=int, help="Generation input threshold; 0 disables compaction")
parser.add_argument("--context-compaction-target", type=int, help="Target input size after generation context compaction")
parser.add_argument("--task-timeout", type=int)
Expand Down Expand Up @@ -95,6 +95,8 @@ def main(argv=None):
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
if args.resume:
previous = json.loads((output / "plan.json").read_text())
if previous.get("model_profile") != plan["model_profile"]:
raise ValueError("Saved inference profile differs; resume with the original code or start a new run")
if previous.get("recovery_format") != 1:
raise ValueError("This run predates durable recovery; use a new output directory")
if previous["settings"].get("method") == LEGACY_METHOD:
Expand Down
7 changes: 2 additions & 5 deletions phoenix/localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,9 @@ def tokens(ms):
raise RuntimeError('Context budget exceeded after preserving actions/requirements; drafts retained')
choice = ({'type': 'function', 'function': {'name': 'location_checkpoint'}}
if control['checkpoint_required'] else runtime['tool_choice'])
payload = dict(model=profile['model'], messages=request_messages,
payload = dict(runtime['inference'], messages=request_messages,
tools=definitions(config, control['allowed_tools']), tool_choice=choice,
parallel_tool_calls=False, temperature=0.0, top_p=1.0,
max_tokens=runtime['max_tokens'], enable_thinking=runtime['enable_thinking'])
if runtime.get('preserve_thinking'):
payload['preserve_thinking'] = True
parallel_tool_calls=False)
if runtime.get('no_truncation') and tokens(request_messages) > runtime['max_compacted_tokens']:
raise RuntimeError('NO_TRUNCATION: localization input limit reached; full history retained')
request_dir = task / 'requests' / f'{step:03d}'
Expand Down
38 changes: 8 additions & 30 deletions phoenix/recovery_profiles.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,21 @@
"""Explicit historical model/method recovery profiles; never switch models."""

from phoenix.settings import REPAIR_METHODS
from phoenix.settings import PROFILES, REPAIR_METHODS

# Generation sampling parameters remain in settings.PROFILES. These values
# describe transport/lifecycle recovery, not another repair or review prompt.
MODEL_RECOVERY = {
"glm-5.2": {
"api_timeout_seconds": 240, "wall_time_seconds": 7200,
"thinking": False, "summary_timeout_seconds": 120,
"summary_transport_attempts": 5, "summary_format_rounds": 3,
"generation_supported": True,
},
"qwen3.7-plus": {
"api_timeout_seconds": 600, "wall_time_seconds": 7200,
"thinking": False, "summary_timeout_seconds": 120,
"summary_transport_attempts": 5, "summary_format_rounds": 3,
"generation_supported": True,
},
"kimi-k2.7-code": {
"api_timeout_seconds": 240, "wall_time_seconds": 3000,
"thinking": True, "preserve_thinking": True,
"summary_timeout_seconds": 240, "summary_transport_attempts": 3,
"summary_format_rounds": 3,
"generation_supported": True,
},
}
MODEL_RECOVERY["deepseek-v4.1-flash"] = dict(MODEL_RECOVERY["glm-5.2"])


def recovery_profile(settings):
model = settings["model"]
result = dict(MODEL_RECOVERY[model], model=model, method=settings["method"],
same_model_only=True, budget_reset=False, review_calls=0,
spec = PROFILES[model]
result = dict(model=model, method=settings["method"], api_timeout_seconds=spec["timeout"],
wall_time_seconds=settings.get("task_timeout", spec["task_timeout"]), thinking=spec["thinking"],
summary_timeout_seconds=120, summary_transport_attempts=5, summary_format_rounds=3,
generation_supported=True, same_model_only=True, budget_reset=False, review_calls=0,
environment_start_retries=3 if settings["method"] in REPAIR_METHODS else 1,
terminal_session_retries=1, submission_replay_attempts=2)
result["wall_time_seconds"] = settings.get("task_timeout", result["wall_time_seconds"])
if spec["thinking"]:
result["preserve_thinking"] = True
if settings["method"] in REPAIR_METHODS:
if not result["generation_supported"]:
raise ValueError("No historically scored Kimi PhoenixRepair profile is available")
result.update(summary_timeout_seconds=(30, result["api_timeout_seconds"]),
summary_transport_attempts=1, summary_format_rounds=1,
summary_request_interval_seconds=2,
Expand Down
90 changes: 63 additions & 27 deletions phoenix/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,46 @@
LEGACY_METHOD = "our_method"
REPAIR_METHODS = (METHOD_NAME, LEGACY_METHOD)

CONTEXT_DEFAULTS = dict(max_input_tokens=131072, context_compaction_threshold=120000,
context_compaction_target=110000)
CONTEXT_FIELDS = ("max_input_tokens", "context_compaction_threshold", "context_compaction_target")


def profile(api_model, temperature, top_p, context, output, thinking, *, extra=None,
timeout=240, tool_choice="auto", task_timeout=7200, release=None):
return dict(api_model=api_model, temperature=temperature, top_p=top_p,
max_input_tokens=context, max_tokens=output, thinking=thinking,
extra_body=extra if extra is not None else {"enable_thinking": thinking},
timeout=timeout, tool_choice=tool_choice, task_timeout=task_timeout, release=release)


PROFILES = {
"glm-5.2": dict(max_tokens=32768, timeout=240, tool_choice="required", thinking=False, task_timeout=7200),
"qwen3.7-plus": dict(max_tokens=32768, timeout=600, tool_choice="auto", thinking=False, task_timeout=7200),
"kimi-k2.7-code": dict(max_tokens=32768, timeout=240, tool_choice="auto", thinking=True, task_timeout=3000),
"deepseek-v3.1": profile("deepseek-chat", 0.6, 0.95, 131072, None, False, extra={}, release="2025-08-21"),
"deepseek-v3.2": profile("deepseek-chat", 1.0, 0.95, 131072, None, False, extra={}, release="2025-12-01"),
"qwen3-coder-plus": profile("qwen3-coder-plus", 0.7, 0.8, 1000000, 65536, False, extra={}),
"glm-4.7": profile("glm-4.7", 0.7, 1.0, 202752, 131072, True, extra={"thinking": {"type": "enabled"}}),
"minimax-m2.5": profile("MiniMax-M2.5", 1.0, 0.95, 204800, 32768, True, extra={}),
"glm-5.2": profile("glm-5.2", 1.0, 1.0, 1048576, 131072, False, tool_choice="required"),
"qwen3.7-plus": profile("qwen3.7-plus", 1.0, 0.95, 1000000, 131072, False, timeout=600),
"qwen3.7-plus-thinking": profile("qwen3.7-plus", 1.0, 0.95, 1000000, 131072, True, timeout=600),
"qwen-3.8-max": profile("qwen-3.8-max", 1.0, 0.95, 1000000, 131072, False, timeout=600),
# Additional supported models outside the reported experiments.
"kimi-k2.7-code": profile("kimi-k2.7-code", 0.0, 1.0, 131072, 32768, True, task_timeout=3000,
extra={"enable_thinking": True, "preserve_thinking": True}),
"deepseek-v4.1-flash": profile("deepseek-v4.1-flash", 0.0, 1.0, 131072, 32768, False, tool_choice="required"),
}
# New-model comparison: inherit the current GLM settings, not model defaults.
PROFILES["deepseek-v4.1-flash"] = dict(PROFILES["glm-5.2"])


def inference_fields(model):
spec = PROFILES[model]
fields = {k: spec[k] for k in ("temperature", "top_p")}
if spec["max_tokens"] is not None:
fields["max_tokens"] = spec["max_tokens"]
return dict(model=spec["api_model"], **fields, **spec["extra_body"])


def context_defaults(limit):
"""Scale the existing compression watermarks with the configured context window."""
return dict(max_input_tokens=limit, context_compaction_threshold=limit * 120000 // 131072,
context_compaction_target=limit * 110000 // 131072)


def write_json(path: Path, value):
Expand Down Expand Up @@ -70,24 +101,24 @@ def load_instances(path: Path, selected=(), limit=0):
def model_config(model, api_base, *, shared_budget_mode=False, context_settings=None):
profile = PROFILES[model]
data = {
"name": "openai/" + model, "api_base": api_base, "api_key": "$PHOENIX_API_KEY",
"temperature": 0.0, "top_p": 1.0, "per_instance_cost_limit": 0,
"total_cost_limit": 0, "per_instance_call_limit": 0, "max_input_tokens": 131072,
"context_compaction_threshold": 120000, "context_compaction_target": 110000,
"name": "openai/" + profile["api_model"], "api_base": api_base, "api_key": "$PHOENIX_API_KEY",
"temperature": profile["temperature"], "top_p": profile["top_p"], "per_instance_cost_limit": 0,
"total_cost_limit": 0, "per_instance_call_limit": 0, **context_defaults(profile["max_input_tokens"]),
"context_keep_first_rounds": 5, "context_keep_last_rounds": 5,
"retry": {"retries": 8 if shared_budget_mode else 20, "min_wait": 10, "max_wait": 120},
"completion_kwargs": {
"extra_body": {"enable_thinking": profile["thinking"]},
"max_tokens": profile["max_tokens"], "timeout": profile["timeout"],
"extra_body": copy.deepcopy(profile["extra_body"]),
"timeout": profile["timeout"],
"tool_choice": profile["tool_choice"], "num_retries": 0,
},
}
if profile["max_tokens"] is not None:
data["completion_kwargs"]["max_tokens"] = profile["max_tokens"]
if profile["thinking"]:
data["preserve_thinking"] = True
data["completion_kwargs"]["extra_body"]["preserve_thinking"] = True
if shared_budget_mode:
data["request_min_interval"] = (context_settings or {}).get("api_request_interval", 2)
data.update({k: context_settings[k] for k in CONTEXT_DEFAULTS
data.update({k: context_settings[k] for k in CONTEXT_FIELDS
if context_settings and k in context_settings})
if context_settings and context_settings.get("no_truncation"):
data.update(reject_truncation=True, context_compaction_threshold=0)
Expand All @@ -104,7 +135,7 @@ def load_settings(mode, config_path, overrides):
"task_timeout", "locations", "stage", "docker_host", "container_cpus", "container_memory",
"localization_max_steps", "localization_timeout", "adaptive_io", "io_device",
"environment_start_concurrency", "local_command_concurrency", "pin_cpus",
"submission_recovery_timeout", "no_truncation", "exclude_rate_limit_from_budget", "api_request_interval", *CONTEXT_DEFAULTS}
"submission_recovery_timeout", "no_truncation", "exclude_rate_limit_from_budget", "api_request_interval", *CONTEXT_FIELDS}
if set(data) - allowed:
raise ValueError("Unknown configuration fields: " + ", ".join(sorted(set(data) - allowed)))
data.update({k: v for k, v in overrides.items() if v is not None})
Expand Down Expand Up @@ -142,7 +173,12 @@ def load_settings(mode, config_path, overrides):
data.setdefault("local_command_concurrency", 4)
data.setdefault("submission_recovery_timeout", 600)
data["task_timeout"] = data.get("task_timeout") or PROFILES[data["model"]]["task_timeout"]
context = {k: data.get(k, v) for k, v in CONTEXT_DEFAULTS.items()}
limit = data.get("max_input_tokens", PROFILES[data["model"]]["max_input_tokens"])
if type(limit) is not int or limit < 1:
raise ValueError("max_input_tokens must be a positive integer")
for k, v in context_defaults(limit).items():
data.setdefault(k, v)
context = {k: data[k] for k in CONTEXT_FIELDS}
for key, value in context.items():
minimum = 0 if key == "context_compaction_threshold" else 1
if type(value) is not int or value < minimum:
Expand Down Expand Up @@ -195,17 +231,17 @@ def localization_config(settings):
templates = data["agent"]["templates"]
templates["system_template"] = templates["system_template"].removeprefix("You are PhoenixRepair.\n")
data["agent"]["max_steps"] = settings["localization_max_steps"]
model = settings["model"]
limit = settings.get("max_input_tokens", PROFILES[model]["max_input_tokens"])
data["localization_runtime"] = {
"max_tokens": 32768, "api_timeout": 600,
"tool_choice": "auto", "enable_thinking": False,
"task_timeout": settings.get("localization_timeout"), "action_repeat_limit": 10,
"max_compacted_tokens": 110000, "context_compaction_threshold": 100000,
"context_compaction_target": 90000, "preserve_thinking": False,
"inference": inference_fields(model),
"api_timeout": 240 if model == "kimi-k2.7-code" else 600,
"tool_choice": "auto", "task_timeout": settings.get("localization_timeout"),
"action_repeat_limit": 10, "max_compacted_tokens": limit * 110000 // 131072,
"context_compaction_threshold": limit * 100000 // 131072,
"context_compaction_target": limit * 90000 // 131072,
}
runtime = data["localization_runtime"]
if settings["model"] == "kimi-k2.7-code":
runtime.update(enable_thinking=True, preserve_thinking=True, api_timeout=240)
if settings.get("no_truncation"):
runtime.update(no_truncation=True, context_compaction_threshold=0,
max_compacted_tokens=settings.get("max_input_tokens", 131072))
data["localization_runtime"].update(no_truncation=True, context_compaction_threshold=0,
max_compacted_tokens=limit)
return data
9 changes: 2 additions & 7 deletions phoenix/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from phoenix.prompts import PromptBuilder
from phoenix.repair_guidance import SUMMARY_GUIDANCE
from phoenix.settings import LEGACY_METHOD, REPAIR_METHODS, PROFILES, write_json
from phoenix.settings import LEGACY_METHOD, REPAIR_METHODS, PROFILES, inference_fields, write_json
from phoenix.run_state import bind, read, digest

def sha(path):
Expand Down Expand Up @@ -69,12 +69,7 @@ def summarize(task, candidates, settings, directory, key, *, shared_budget=False
(directory / "prompt.txt").write_text(prompt)
write_json(directory / "inputs.json", [{k: v for k, v in row.items() if k != "submission"} for row in inputs])
kimi = settings["model"] == "kimi-k2.7-code"
payload = dict(model=settings["model"], messages=[{"role": "user", "content": prompt}], temperature=0.7,
top_p=1.0, max_tokens=32768 if kimi else 8192, enable_thinking=kimi)
if kimi:
payload["preserve_thinking"] = True
if shared_budget_mode:
payload.update(temperature=0.0, max_tokens=PROFILES[settings["model"]]["max_tokens"])
payload = dict(inference_fields(settings["model"]), messages=[{"role": "user", "content": prompt}])
timeout = (30, PROFILES[settings["model"]]["timeout"]) if shared_budget_mode else (240 if kimi else 120)
bind(directory / "identity.json", {"payload": payload, "api_base": settings["api_base"],
"shared_budget": shared_budget})
Expand Down
Loading
Loading