Extend oracle gap P06 bracket

This commit is contained in:
2026-07-13 22:21:17 +08:00
parent 34e1f4c144
commit a9e7e9991e
3 changed files with 105 additions and 6 deletions

View File

@@ -1,11 +1,28 @@
# Static-policy oracle-gap protocol
Status: **FROZEN BEFORE NEW GPU EXECUTION**.
Status: **FROZEN WITH A-OG-1 AMENDMENT**.
Date frozen: 2026-07-13 (Asia/Singapore). Existing Phase-3 measurements were
inspected only to choose the workload pair and rate brackets. They are
exploratory calibration data, not primary observations in this protocol.
### A-OG-1 — extend the P06 upper bracket (after trial 33)
The controller stopped as registered after C00/P06 remained SLO-feasible at
every original and upward-extension anchor through 2.3 requests/s. At that
point 33 trials and 1.519475 H20-hours were complete, all GPU memory had been
released, and no C00/P06 infeasible upper bound existed. No oracle inference
was performed.
This amendment changes only the P06 upward-extension list from
`2.1,2.2,2.3` to `2.1,2.2,2.3,2.4,2.5,2.6,2.8,3.0`. The controller stops at
the first bracket exactly as before. Existing trials are immutable and are
reused; config order, P01 rates, SLO, timelines, repetitions, placement,
metrics, and decision threshold do not change. The resumable controller may
accept the new code/protocol fingerprint only when all immutable runtime,
client, model, manifest, config, and base-grid fields match the pre-amendment
state, and it records both fingerprints under `A-OG-1`.
## Question and decision gate
The candidate motivation is:
@@ -98,7 +115,8 @@ Primary grids:
Every primary anchor runs once. For each phase/config, the highest primary
feasible anchor and its next higher primary anchor are then run two more times,
giving three trials at both sides of the boundary. If all primary anchors are
feasible, extend upward in the fixed order P01 `38,40,42` or P06 `2.1,2.2,2.3`.
feasible, extend upward in the fixed order P01 `38,40,42` or P06
`2.1,2.2,2.3,2.4,2.5,2.6,2.8,3.0`.
If all are infeasible, extend downward in the fixed order P01 `24,22,20` or P06
`1.3,1.2,1.1`. Stop extending at the first bracket.

View File

@@ -20,6 +20,7 @@ from analyze import CONFIGS, PHASES, atomic_json, score_trial, summarize_trials
SCHEMA = 1
AMENDMENT = "A-OG-1"
REMOTE_ROOT = Path("/home/admin/cpfs/wjh/oracle-gap-20260713")
RUN_ROOT = REMOTE_ROOT / "runs"
STATE = RUN_ROOT / "controller-state.json"
@@ -56,7 +57,10 @@ BASE_RATES = {
"P01": (32.0, 26.0, 36.0, 28.0, 34.0, 30.0),
"P06": (1.7, 1.4, 2.0, 1.5, 1.9, 1.6, 1.8),
}
UP_EXTENSIONS = {"P01": (38.0, 40.0, 42.0), "P06": (2.1, 2.2, 2.3)}
UP_EXTENSIONS = {
"P01": (38.0, 40.0, 42.0),
"P06": (2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.8, 3.0),
}
DOWN_EXTENSIONS = {"P01": (24.0, 22.0, 20.0), "P06": (1.3, 1.2, 1.1)}
TIMELINE = {
"P01": {"warmup": 60, "clean": 60, "drain": 120},
@@ -207,6 +211,9 @@ def fingerprint() -> dict[str, Any]:
return {
"controller_sha256": sha256_file(Path(__file__).resolve()),
"analyzer_sha256": sha256_file(Path(__file__).with_name("analyze.py")),
"protocol_sha256": sha256_file(
REPO / "docs/opprof/oracle-gap-protocol.md"
),
"p5_client_sha256": sha256_file(P5_CLIENT),
"p3_client_sha256": sha256_file(P3_CLIENT_DIR / "opprof_phase3_client.py"),
"repo_commit": run_text(["git", "-C", str(REPO), "rev-parse", "HEAD"]).strip(),
@@ -220,9 +227,27 @@ def fingerprint() -> dict[str, Any]:
"driver": run_text(["nvidia-smi", "--query-gpu=driver_version", "--format=csv,noheader"]).splitlines()[0],
"config_details": CONFIG_DETAILS,
"base_rates": {key: list(value) for key, value in BASE_RATES.items()},
"up_extensions": {
key: list(value) for key, value in UP_EXTENSIONS.items()
},
}
def resume_compatible(old: dict[str, Any], current: dict[str, Any]) -> bool:
immutable = (
"p5_client_sha256",
"p3_client_sha256",
"vllm_commit",
"model",
"manifests",
"runtime",
"driver",
"config_details",
"base_rates",
)
return all(old.get(key) == current.get(key) for key in immutable)
def ensure_provenance(current: dict[str, Any]) -> None:
destination = RUN_ROOT / "provenance"
destination.mkdir(parents=True, exist_ok=True)
@@ -235,10 +260,18 @@ def ensure_provenance(current: dict[str, Any]) -> None:
):
target = destination / source.name
if target.exists() and sha256_file(target) != sha256_file(source):
raise RuntimeError(f"provenance file changed: {target}")
digest = sha256_file(source)
target = destination / f"{source.stem}.{digest[:12]}{source.suffix}"
if target.exists() and sha256_file(target) != sha256_file(source):
raise RuntimeError(f"content-addressed provenance mismatch: {target}")
if not target.exists():
shutil.copy2(source, target)
atomic_json(destination / "fingerprint.json", current)
fingerprint_path = (
destination / f"fingerprint.{current['repo_commit'][:8]}.json"
)
atomic_json(fingerprint_path, current)
if not (destination / "fingerprint.json").exists():
atomic_json(destination / "fingerprint.json", current)
atomic_json(destination / "host-before.json", gpu_snapshot())
(destination / "nvidia-smi-q.txt").write_text(run_text(["nvidia-smi", "-q"]))
@@ -607,7 +640,28 @@ def execute(resume: bool) -> None:
assert_idle()
current = fingerprint()
if state["fingerprint"] and state["fingerprint"] != current:
raise RuntimeError("resume fingerprint changed")
if not (
resume
and state.get("status") == "failed"
and resume_compatible(state["fingerprint"], current)
):
raise RuntimeError("resume fingerprint changed incompatibly")
state.setdefault("amendments", []).append(
{
"id": AMENDMENT,
"accepted_at": time.time(),
"reason": (
"C00/P06 feasible through the original 2.3-rps "
"upper extension"
),
"completed_trials_before": len(
state.get("completed_trials", [])
),
"gpu_hours_before": state.get("gpu_hours"),
"old_fingerprint": state["fingerprint"],
"new_fingerprint": current,
}
)
state["fingerprint"] = current
state["status"] = "running"
save_state(state)

View File

@@ -9,6 +9,7 @@ ORACLE_GAP = Path(__file__).resolve().parents[1] / "scripts/oracle_gap"
sys.path.insert(0, str(ORACLE_GAP))
from analyze import score_trial, summarize_trials # noqa: E402
from run_frontier import UP_EXTENSIONS, resume_compatible # noqa: E402
def _request(
@@ -141,3 +142,29 @@ def test_nonmonotone_frontier_blocks_inference() -> None:
assert summary["verdict"] == "INCONCLUSIVE"
assert not summary["sanity"]["invariants"]["all_frontiers_monotone"]
def test_a_og_1_extends_only_mutable_resume_fields() -> None:
immutable = {
"p5_client_sha256": "p5",
"p3_client_sha256": "p3",
"vllm_commit": "vllm",
"model": "model",
"manifests": {"P01": "a", "P06": "b"},
"runtime": "runtime",
"driver": "driver",
"config_details": {"C00": {}},
"base_rates": {"P01": [26], "P06": [1.4]},
}
amended = {
**immutable,
"controller_sha256": "new",
"repo_commit": "new",
"up_extensions": {"P06": [2.4]},
}
assert UP_EXTENSIONS["P06"][-5:] == (2.4, 2.5, 2.6, 2.8, 3.0)
assert resume_compatible(immutable, amended)
assert not resume_compatible(
immutable, {**amended, "manifests": {"P01": "changed"}}
)