Skip to content

Commit f06264a

Browse files
feat(mac-launcher): long-answer-safe defaults + full-mode validation preset
run_kakeya_mac.sh: - Document that long answers are now coherent past the ~1024 native-cache ring wrap (PR #146: single-token commits once the sliding RotatingKVCache wraps). - Raise default --max-new-tokens 1024 -> 2048 (the wrap is no longer a coherence cliff; FULL mode just drops the spec-decode speedup past it). - Refresh help text and FULL-mode mode banner. bridge: add mlx-kakeya-launcher-full preset (FULL f_θ path, long scripted answer crossing the wrap, validate_reports) so CI/on-device guards the launcher's full pipeline + the wrap fix end-to-end; launcher-smoke stays for fast wiring checks. Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
1 parent f13594d commit f06264a

3 files changed

Lines changed: 54 additions & 6 deletions

File tree

inference_engine/bridge/manifest.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,29 @@ def _harness_preset(
771771
params={"max_new_tokens": ("int:max_new_tokens", "64")},
772772
validate_reports=True, # §4 liveness gate on-device
773773
),
774+
Preset(
775+
name="mlx-kakeya-launcher-full",
776+
description="Validate scripts/run_kakeya_mac.sh in FULL mode (f_θ "
777+
"verifier+proposer+f_θ, default path) on a LONG scripted "
778+
"answer that crosses the ~1024 native-cache ring wrap. "
779+
"Guards the launcher's full pipeline + the PR #146 "
780+
"wrapped-ring fix end-to-end: the report must pass the §4 "
781+
"liveness gate AND the quality gate (coherent, no runaway "
782+
"repeat) past the wrap.",
783+
command_templates=(
784+
(
785+
"bash", "scripts/run_kakeya_mac.sh",
786+
"--max-new-tokens", "{max_new_tokens}",
787+
"--ignore-turn-stop",
788+
"--chat-scripted", "请详细解释POW的工作原理",
789+
"--output",
790+
"results/research/k3_mac_bridge_launcher_full.json",
791+
),
792+
),
793+
timeout_minutes=90,
794+
params={"max_new_tokens": ("int:max_new_tokens", "1300")},
795+
validate_reports=True, # §4 liveness + §2.4 quality gate on-device
796+
),
774797
Preset(
775798
name="mlx-kakeya-degen-probe",
776799
description="Long-decode regression probe: full f_θ fused engine on a "

scripts/run_kakeya_mac.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
# the all-MLX proposer path (f_θ bypassed via S5 native prefill — much faster on
99
# Mac, but the f_θ projection does not execute).
1010
#
11+
# LONG ANSWERS ARE SAFE (PR #146). The full path runs on gemma-4's native hybrid
12+
# cache (sliding RotatingKVCache, max_size≈1024). Past that ring wrap the engine
13+
# automatically commits single tokens (no speculative rollback to mis-trim on the
14+
# wrapped ring), so generations stay coherent well beyond ~1024 tokens — they
15+
# just lose the spec-decode speedup past the wrap. So the default budget below is
16+
# generous; you no longer need to keep answers under the window.
17+
#
1118
# Model facts come from env vars (set on the kakeya-mac-m4 runner), with sane
1219
# fallbacks; override on the CLI if needed:
1320
# KAKEYA_MAC_VERIFIER_PATH local MLX gemma-4 dir
@@ -17,7 +24,7 @@
1724
# Usage:
1825
# bash scripts/run_kakeya_mac.sh # full engine (f_θ on), interactive
1926
# bash scripts/run_kakeya_mac.sh --fast # proposer-only (f_θ bypassed), faster
20-
# bash scripts/run_kakeya_mac.sh --max-new-tokens 2048 --window 128
27+
# bash scripts/run_kakeya_mac.sh --max-new-tokens 4096 --window 128
2128
# bash scripts/run_kakeya_mac.sh --dry-run # print the command, run nothing
2229
# echo 'Explain proof-of-work.' | bash scripts/run_kakeya_mac.sh # one-shot via stdin
2330
set -euo pipefail
@@ -31,7 +38,9 @@ FTHETA="${KAKEYA_MAC_FTHETA_DIR:-results/research/f_theta_v5_s5_sliding}"
3138
SINK="${KAKEYA_SINK:-4}"
3239
WINDOW="${KAKEYA_WINDOW:-64}"
3340
BLOCK="${KAKEYA_BLOCK_SIZE:-4}"
34-
MAX_NEW="${KAKEYA_MAX_NEW_TOKENS:-1024}"
41+
# Default budget reaches past the ~1024 native-cache wrap; coherent there since
42+
# PR #146 (single-token commits past the wrap). Raise/lower freely.
43+
MAX_NEW="${KAKEYA_MAX_NEW_TOKENS:-2048}"
3544

3645
FAST=0
3746
DRY_RUN=0
@@ -47,7 +56,7 @@ while [[ $# -gt 0 ]]; do
4756
--window) shift; WINDOW="${1:?}" ;;
4857
--sink) shift; SINK="${1:?}" ;;
4958
--block-size) shift; BLOCK="${1:?}" ;;
50-
-h|--help) sed -n '2,28p' "$0"; exit 0 ;;
59+
-h|--help) sed -n '2,29p' "$0"; exit 0 ;;
5160
*) EXTRA+=("$1") ;; # pass-through (e.g. --chat-scripted ...)
5261
esac
5362
shift
@@ -70,8 +79,9 @@ if [[ "$FAST" == "1" ]]; then
7079
MODE="FAST (verifier + proposer + S5 bounded KV; f_θ BYPASSED)"
7180
else
7281
# torch drafter + f_θ: the harness auto-enables --force-f-theta in --chat, so
73-
# f_θ projection ACTUALLY RUNS each turn (the full pipeline).
74-
MODE="FULL (verifier + proposer + f_θ + S5 bounded KV; f_θ runs)"
82+
# f_θ projection ACTUALLY RUNS each turn (the full pipeline). Coherent past the
83+
# ~1024 native-cache wrap (PR #146: single-token commits once the ring wraps).
84+
MODE="FULL (verifier + proposer + f_θ + S5 bounded KV; f_θ runs; long-answer safe)"
7585
fi
7686

7787
log "mode : $MODE"

tests/inference_engine/bridge/test_manifest.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def test_allowlist_contains_exactly_the_documented_presets():
8484
"mlx-kakeya-degen-probe",
8585
"mlx-kakeya-fused-chat-ftheta",
8686
"mlx-kakeya-fused-chat-smoke",
87+
"mlx-kakeya-launcher-full",
8788
"mlx-kakeya-launcher-smoke",
8889
"mlx-multitenant-pressure",
8990
"mlx-upgrade",
@@ -106,7 +107,7 @@ def test_harness_presets_validate_reports_others_do_not():
106107
"k3-step2-fused-allmlx",
107108
# §4 liveness gate runs on-device for the fused-chat presets too:
108109
"mlx-kakeya-fused-chat-smoke", "mlx-kakeya-fused-chat-ftheta",
109-
"mlx-kakeya-launcher-smoke",
110+
"mlx-kakeya-launcher-smoke", "mlx-kakeya-launcher-full",
110111
}
111112

112113

@@ -166,6 +167,20 @@ def test_mlx_kakeya_launcher_smoke_preset_invokes_launcher():
166167
assert argv[argv.index("--max-new-tokens") + 1] == "64"
167168

168169

170+
def test_mlx_kakeya_launcher_full_preset_runs_full_mode_past_wrap():
171+
request = parse_manifest(_manifest(
172+
preset="mlx-kakeya-launcher-full", params={"max_new_tokens": "1300"}))
173+
(argv,) = build_commands(request, {})
174+
assert argv[0] == "bash"
175+
assert argv[1].endswith("run_kakeya_mac.sh")
176+
# FULL mode: NO --fast (f_θ verifier+proposer+f_θ path).
177+
assert "--fast" not in argv
178+
assert "--chat-scripted" in argv
179+
assert "--ignore-turn-stop" in argv
180+
# budget crosses the ~1024 native-cache ring wrap.
181+
assert int(argv[argv.index("--max-new-tokens") + 1]) > 1024
182+
183+
169184
def test_mlx_kakeya_fused_chat_ftheta_preset_runs_f_theta_path():
170185
request = parse_manifest(_manifest(
171186
preset="mlx-kakeya-fused-chat-ftheta",

0 commit comments

Comments
 (0)