Revise action-aware pilot after token overload
This commit is contained in:
@@ -11,14 +11,28 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
SCHEMA = "action-aware-constraint-pilot-manifest-v0"
|
||||
CONFIGS = (
|
||||
{"id": "b_base", "mns": 64, "mbbt": 256, "repetition_order": [1, 2, 3]},
|
||||
{"id": "a_base", "mns": 16, "mbbt": 8192, "repetition_order": [2, 3, 1]},
|
||||
{"id": "shared", "mns": 64, "mbbt": 8192, "repetition_order": [3, 1, 2]},
|
||||
{"id": "b_mns", "mns": 128, "mbbt": 256, "repetition_order": [1, 3, 2]},
|
||||
{"id": "a_mbbt", "mns": 16, "mbbt": 16384, "repetition_order": [2, 1, 3]},
|
||||
)
|
||||
SCHEMA_V0 = "action-aware-constraint-pilot-manifest-v0"
|
||||
SCHEMA_V1 = "action-aware-constraint-pilot-manifest-v1"
|
||||
|
||||
|
||||
def configs(token_source_mbbt: int) -> tuple[dict[str, Any], ...]:
|
||||
return (
|
||||
{
|
||||
"id": "b_base",
|
||||
"mns": 64,
|
||||
"mbbt": token_source_mbbt,
|
||||
"repetition_order": [1, 2, 3],
|
||||
},
|
||||
{"id": "a_base", "mns": 16, "mbbt": 8192, "repetition_order": [2, 3, 1]},
|
||||
{"id": "shared", "mns": 64, "mbbt": 8192, "repetition_order": [3, 1, 2]},
|
||||
{
|
||||
"id": "b_mns",
|
||||
"mns": 128,
|
||||
"mbbt": token_source_mbbt,
|
||||
"repetition_order": [1, 3, 2],
|
||||
},
|
||||
{"id": "a_mbbt", "mns": 16, "mbbt": 16384, "repetition_order": [2, 1, 3]},
|
||||
)
|
||||
|
||||
|
||||
def sha256_file(path: Path) -> str:
|
||||
@@ -38,7 +52,17 @@ def atomic_json(path: Path, payload: Any) -> None:
|
||||
os.replace(temporary, path)
|
||||
|
||||
|
||||
def build(base_path: Path) -> dict[str, Any]:
|
||||
def build(
|
||||
base_path: Path,
|
||||
*,
|
||||
token_source_mbbt: int = 256,
|
||||
prior_attempt_h20_hours: float = 0.0,
|
||||
prior_attempt_artifact: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
if token_source_mbbt <= 0:
|
||||
raise ValueError("token source MBBT must be positive")
|
||||
if prior_attempt_h20_hours < 0.0 or prior_attempt_h20_hours >= 8.0:
|
||||
raise ValueError("prior attempt cost must be in [0, 8)")
|
||||
base = json.loads(base_path.read_text(encoding="utf-8"))
|
||||
if base.get("schema") != "intervention-response-phase-aware-pilot-manifest-v3":
|
||||
raise ValueError("unexpected base manifest schema")
|
||||
@@ -60,9 +84,15 @@ def build(base_path: Path) -> dict[str, Any]:
|
||||
"merged_trace": source["merged_trace"],
|
||||
}
|
||||
|
||||
config_ids = [str(config["id"]) for config in CONFIGS]
|
||||
frozen_configs = configs(token_source_mbbt)
|
||||
config_ids = [str(config["id"]) for config in frozen_configs]
|
||||
schema = (
|
||||
SCHEMA_V0
|
||||
if token_source_mbbt == 256 and prior_attempt_h20_hours == 0.0
|
||||
else SCHEMA_V1
|
||||
)
|
||||
payload = {
|
||||
"schema": SCHEMA,
|
||||
"schema": schema,
|
||||
"status": "PASS",
|
||||
"source": {
|
||||
"base_manifest": str(base_path.resolve()),
|
||||
@@ -76,10 +106,11 @@ def build(base_path: Path) -> dict[str, Any]:
|
||||
"duration_s": 300.0,
|
||||
"disable_slo_early_stop": True,
|
||||
"client_timeout_s": 450.0,
|
||||
"burnin_max_elapsed_s": 90.0,
|
||||
},
|
||||
"burnin": base["burnin"],
|
||||
"repetitions": repetitions,
|
||||
"configs": [dict(config) for config in CONFIGS],
|
||||
"configs": [dict(config) for config in frozen_configs],
|
||||
"regimes": {
|
||||
"A": {
|
||||
"source": "a_base",
|
||||
@@ -91,7 +122,10 @@ def build(base_path: Path) -> dict[str, Any]:
|
||||
},
|
||||
},
|
||||
"budget": {
|
||||
"hard_cap_h20_hours": 8.0,
|
||||
"global_hard_cap_h20_hours": 8.0,
|
||||
"hard_cap_h20_hours": 8.0 - prior_attempt_h20_hours,
|
||||
"prior_attempt_h20_hours": prior_attempt_h20_hours,
|
||||
"prior_attempt_artifact": prior_attempt_artifact,
|
||||
"session_estimate_h20_hours": 1.35,
|
||||
"safety_h20_hours": 0.25,
|
||||
"expected_h20_hours": [6.0, 7.2],
|
||||
@@ -117,7 +151,7 @@ def build(base_path: Path) -> dict[str, Any]:
|
||||
== 1,
|
||||
"all_repetition_orders_are_permutations": all(
|
||||
sorted(config["repetition_order"]) == [1, 2, 3]
|
||||
for config in CONFIGS
|
||||
for config in frozen_configs
|
||||
),
|
||||
}
|
||||
},
|
||||
@@ -141,8 +175,16 @@ def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--base-manifest", type=Path, required=True)
|
||||
parser.add_argument("--output", type=Path, required=True)
|
||||
parser.add_argument("--token-source-mbbt", type=int, default=256)
|
||||
parser.add_argument("--prior-attempt-h20-hours", type=float, default=0.0)
|
||||
parser.add_argument("--prior-attempt-artifact")
|
||||
args = parser.parse_args()
|
||||
payload = build(args.base_manifest)
|
||||
payload = build(
|
||||
args.base_manifest,
|
||||
token_source_mbbt=args.token_source_mbbt,
|
||||
prior_attempt_h20_hours=args.prior_attempt_h20_hours,
|
||||
prior_attempt_artifact=args.prior_attempt_artifact,
|
||||
)
|
||||
atomic_json(args.output, payload)
|
||||
print(json.dumps(payload["sanity"], sort_keys=True))
|
||||
if payload["status"] != "PASS":
|
||||
|
||||
Reference in New Issue
Block a user