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
9 changes: 9 additions & 0 deletions tests/hyperloom_benchmark_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ def main():
assert abs(geomean - (400.0 * 12.0 * 28.0) ** (1 / 3)) < 1e-9, geomean
assert bench.geometric_mean(400.0, 12.0, 28.0) == geomean

# Box rule 2026-11-01 12:13: the drafter at long context is the arm that faulted this box, so a
# candidate that asks for both must be refused (scores zero) and not load a drafter.
import os

for longctx, dflash, want in ((18800, "1", True), (18800, "", False), (0, "1", False)):
os.environ["HL_LONGCTX"], os.environ["HL_DFLASH"] = str(longctx), dflash
assert bench.longctx_drafter_conflict() is want, (longctx, dflash, want)
os.environ.pop("HL_LONGCTX"), os.environ.pop("HL_DFLASH")

print("hyperloom_benchmark_test: OK")
return 0

Expand Down
25 changes: 23 additions & 2 deletions tools/hyperloom/custom/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,22 @@ def serve_batch_args():
return args


def dflash_on():
"""True when the DFlash drafter is requested (`HL_DFLASH`; `0`/`off`/`false` mean off)."""
value = env("HL_DFLASH")
return bool(value) and value not in ("0", "off", "false")


def longctx_drafter_conflict():
"""The box rule (2026-11-01 12:13): no long-context measurement may draft.

The drafter at long context is the arm that faulted the HRX graph on this box (27B at 18.8k, the
11:13 MODE2 reset), so it is refused until engine#764's admission guardrail is merged. A refused
candidate scores zero and says why, rather than loading a drafter nobody may measure.
"""
return env_int("HL_LONGCTX", 0) > 0 and dflash_on()


def serve_lever_args():
"""The levers that only `1bit serve` has: drafting and slots.

Expand All @@ -188,9 +204,8 @@ def serve_lever_args():
external head to draft with instead.
"""
args = serve_batch_args()
dflash = env("HL_DFLASH")
mtp_max_raw = env("HL_MTP_MAX")
if dflash and dflash not in ("0", "off", "false"):
if dflash_on():
args += ["--dflash", env("HL_DFLASH_GGUF", "dflash.gguf")]
elif mtp_max_raw:
mtp_max = env_int("HL_MTP_MAX", 0)
Expand Down Expand Up @@ -381,6 +396,12 @@ def kld(ppl, model, args, base, wiki, timeout, out_dir):

def main():
started = time.time()
# Box rule first: nothing else in this run may even resolve if it asks for the forbidden shape.
if longctx_drafter_conflict():
raise SystemExit(
"refusing HL_DFLASH with HL_LONGCTX>0: the drafter at long context is the arm that faulted the "
"HRX graph on this box (27B, 18.8k, 2026-11-01 11:13 reset) and the box rule forbids it until "
"engine#764's refusal guardrail is merged")
out_dir = pathlib.Path(env("RESULT_DIR") or ".").expanduser()
out_dir.mkdir(parents=True, exist_ok=True)
name = env("RESULT_FILENAME") or "inferencex_result"
Expand Down
Loading