affine-god/1111 / launch_extrap.py
affine-god's picture
download
raw
8.45 kB
"""Launch the extrapolation experiment. Costs money — dry run unless --yes.
arm = KING + scale * (KING - af10)
Job A (h200, ~2 h, ~$10) builds the arms and samples thoughts. It never loads
the teacher, so it cannot report Λ2. Job B (h200x2, ~1 h, ~$11) scores them.
Run A first, read its output, then launch B.
python harness/launch_extrap.py # show the plan, spend nothing
python harness/launch_extrap.py --yes # launch job A
python harness/launch_extrap.py --phase b --yes
"""
from __future__ import annotations
import argparse
import pathlib
ROOT = pathlib.Path(__file__).resolve().parent.parent
PLAN = {
"a": {
"script": "run_extrap.sh", "flavor": "h200", "rate": 5.0, "hours": 2.0,
"label": "affine-extrap-A", "timeout": "4h",
"does": "build 3 arms + sample thoughts for control and each arm",
},
"a2": {
"script": "run_extrap2.sh", "flavor": "h200", "rate": 5.0, "hours": 3.0,
"label": "affine-extrap-A2", "timeout": "5h",
"does": "rebuild+PERSIST scale 2.0 and build 3.0/4.0, reusing round 1's control",
},
"a3": {
"script": "run_extrap3.sh", "flavor": "h200", "rate": 5.0, "hours": 4.5,
"label": "affine-extrap-A3", "timeout": "7h",
"does": "stack our direction onto the NEW king (legend): arms A, B, C + control",
},
"pub": {
"script": "run_publish.sh", "flavor": "cpu-xl", "rate": 1.0, "hours": 0.75,
"label": "affine-publish", "timeout": "3h", "image": "python:3.12",
"does": "copy a bucket candidate to a PUBLIC model repo and report its commit sha",
},
"gateg": {
"script": "run_gateg.sh", "flavor": "h200", "rate": 5.0, "hours": 0.45,
"label": "affine-gateg", "timeout": "2h",
"does": "serve the published candidate and run the promptability probe (gate G)",
},
"b": {
"script": "run_extrap_score.sh", "flavor": "h200x2", "rate": 10.0,
"hours": 1.1, "label": "affine-extrap-B", "timeout": "3h",
"does": "serve GLM-4.5-Air-FP8 (tp=2) and score every arm against the king",
},
}
def cmd(script: str) -> list[str]:
return ["bash", "-lc",
"set -uo pipefail; mkdir -p /work && cd /work; "
"pip install -q 'huggingface_hub>=1.27' httpx 2>&1 | tail -1; "
"hf download dent1s2/affine-harness --repo-type dataset "
"--local-dir /work/harness || exit 1; "
f"bash /work/harness/{script}"]
def main() -> None:
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
ap.add_argument("--phase", choices=("a", "a2", "a3", "b", "pub", "gateg"), default="a")
ap.add_argument("--scales", default="0.5 1.0 2.0")
ap.add_argument("--runpath", default="", help="bucket subdir (default: run for a/b, run2 for a2)")
ap.add_argument("--turns", default="500")
ap.add_argument("--ref", default="chal-00525")
ap.add_argument("--flavor", default="", help="override the plan's GPU flavor")
ap.add_argument("--tp", default="", help="tensor-parallel size (phase b)")
ap.add_argument("--maxlen", default="", help="vLLM max_model_len (phase b)")
ap.add_argument("--util", default="", help="vLLM gpu_memory_utilization")
ap.add_argument("--conc", default="", help="scoring client concurrency")
ap.add_argument("--eager", default="", help="1 = --enforce-eager")
ap.add_argument("--cand", default="candidate_3.0", help="bucket dir to publish")
ap.add_argument("--s1", default="3.0", help="scale on d1 = sada - af10 (our direction)")
ap.add_argument("--s2", default="2.0", help="scale on d2 = legend - sada (theirs)")
ap.add_argument("--repo", default="", help="model repo (phases pub/gateg)")
ap.add_argument("--rev", default="", help="pinned revision (phase gateg)")
ap.add_argument("--hotkey-ss58", default="", help="submitter hotkey (phase gateg)")
ap.add_argument("--yes", action="store_true", help="required to spend")
args = ap.parse_args()
p = dict(PLAN[args.phase])
if args.flavor:
# h200x2 sat in SCHEDULING for 37 min; a single h200 fits the
# 112.6 GB FP8 teacher in 141 GB and schedules immediately.
p["flavor"] = args.flavor
p["rate"] = {"h200": 5.0, "h200x2": 10.0, "h200x4": 20.0,
"l40sx4": 8.0, "l40sx8": 16.0}.get(args.flavor, p["rate"])
print(f" phase {args.phase.upper()} — {p['does']}")
image = p.get("image", "vllm/vllm-openai:latest")
print(f" image {image}")
print(f" flavor {p['flavor']} (~${p['rate']:.0f}/hr, expected ~{p['hours']} h "
f"=> ~${p['rate']*p['hours']:.0f})")
print(f" timeout {p['timeout']}")
runpath = args.runpath or {"a2": "run2", "a3": "run3"}.get(args.phase, "run")
bucket = "dent1s2/affine-candidates" if args.phase == "a3" else "dent1s2/affine-extrap"
print(f" bucket hf://buckets/{bucket}/{runpath}")
if args.phase == "gateg":
print(f" candidate {args.repo} @ {args.rev[:12]} (the exact bytes the validator fetches)")
print(" checks parsable ```bash action AND finite forced logprobs")
if args.phase == "pub":
print(f" candidate hf://buckets/dent1s2/affine-extrap/{args.cand}")
print(f" target {args.repo} (PUBLIC — the validator must fetch it)")
if args.phase == "a3":
print(f" king diceofgod/affine-5fjgc5jhxq-legend @ d259cb38 (reign 9, S* -0.00048)")
print(f" arms A legend+{args.s1}*(sada-af10) | "
f"B legend+{args.s2}*(legend-sada) | C = A+{args.s2}*(legend-sada)")
print(" geometry cos(d1,d2) = -0.0012 over 20 tensors -> orthogonal, gains should ADD")
print(" control the reigning king, generated fresh (round 2's control was a different model)")
if args.phase == "a2":
print(" arms scale " + args.scales + " (control REUSED from round 1)")
print(" persist each arm uploaded to candidate_<scale> BEFORE deletion")
print(" round 1 0.5 z@2080 +0.16 | 1.0 +1.86 | 2.0 +2.73 (bar 2.0)")
if args.phase == "a":
print(" king ttttxxxxsada/Affine-5guassq3tu @ e86758f5 (bucket copy, 16/16 hashes)")
print(" base Tok331102/affine-5EqYW8McUc-af10 @ eb8bf9a3 (pinned)")
print(f" arms control-king + scale {args.scales}")
print(" lineage probed: 1026/1026 shared names, delta only in "
"mlp.shared_expert at 0.0095")
elif args.phase == "b":
print(f" teacher zai-org/GLM-4.5-Air-FP8 (112.6 GB), tp={args.tp or 2}, "
f"max_model_len {args.maxlen or 65536}")
print(f" input thoughts from hf://buckets/dent1s2/affine-extrap/{runpath}")
print(f" screen {args.turns} turns from {args.ref}")
print(f" bar k_sigma 2.0 @ n 2080 => margin +0.00306; this screen's own "
f"se ~{0.070/float(args.turns)**0.5:.5f}")
if not args.yes:
print("\n dry run — nothing launched. Re-run with --yes to spend.")
return
from huggingface_hub import run_job, get_token
job = run_job(image=image, command=cmd(p["script"]),
flavor=p["flavor"], timeout=p["timeout"],
secrets={"HF_TOKEN": get_token()},
env={"HF_HUB_ENABLE_HF_TRANSFER": "1", "WORK": "/work",
"SCALES": args.scales, "TURNS": args.turns, "REF": args.ref,
"RUNPATH": runpath,
**({"S1": args.s1, "S2": args.s2} if args.phase == "a3" else {}),
**({"TP": args.tp} if args.tp else {}),
**({"MAXLEN": args.maxlen} if args.maxlen else {}),
**({"UTIL": args.util} if args.util else {}),
**({"CONC": args.conc} if args.conc else {}),
**({"EAGER": args.eager} if args.eager else {}),
**({"CAND": args.cand, "REPO": args.repo}
if args.phase == "pub" else {}),
**({"REPO": args.repo, "REV": args.rev,
"HOTKEY_SS58": args.hotkey_ss58}
if args.phase == "gateg" else {})},
labels={"name": p["label"]})
print(f"\n JOB {job.id}")
(ROOT / "watch").mkdir(exist_ok=True)
(ROOT / "watch" / f"extrap_job_{args.phase}.txt").write_text(job.id)
if __name__ == "__main__":
main()

Xet Storage Details

Size:
8.45 kB
·
Xet hash:
9771a16df72012d203d5c9d7a865c39f1388ff1eb6162968456d213b73ec0b5a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.