Add llm-first tuning proposal policy

This commit is contained in:
2026-06-27 12:21:51 +08:00
parent 9accf2575e
commit 7ad439730e
2 changed files with 104 additions and 1 deletions

View File

@@ -288,6 +288,7 @@ def cmd_study_tune(args: argparse.Namespace) -> int:
capability_profile = load_capability_profile(study, study_spec_path=spec_path)
proposal_files = [Path(item).resolve() for item in (args.proposal_file or [])]
max_trials = args.max_trials or (len(proposal_files) if proposal_files else 2)
proposal_policy = args.proposal_policy
if max_trials <= 0:
raise SpecError("max_trials must be positive")
if proposal_files and max_trials > len(proposal_files):
@@ -387,7 +388,7 @@ def cmd_study_tune(args: argparse.Namespace) -> int:
else:
guided_proposal = (
build_harness_guided_proposal(harness_context)
if harness_context is not None
if harness_context is not None and proposal_policy == "harness-first"
else None
)
if guided_proposal is not None:
@@ -782,6 +783,15 @@ def build_parser() -> argparse.ArgumentParser:
tune.add_argument("--store-root")
tune.add_argument("--proposal-file", action="append")
tune.add_argument("--max-trials", type=int)
tune.add_argument(
"--proposal-policy",
choices=("harness-first", "llm-first"),
default="harness-first",
help=(
"Choose whether deterministic harness proposals are tried before the LLM "
"or whether the LLM proposes directly from the harness prompt/context."
),
)
tune.add_argument(
"--skip-baseline",
action="store_true",