Skip to content

Commit bc74bf9

Browse files
Merge remote-tracking branch 'origin/AgentMemory/update-mac-full-engine-launcher-2815' into _train2
# Conflicts: # inference_engine/bridge/manifest.py # tests/inference_engine/bridge/test_manifest.py Co-authored-by: FluffyAIcode <FluffyAIcode@users.noreply.github.com>
2 parents 5bece7b + f06264a commit bc74bf9

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
@@ -812,6 +812,29 @@ def _harness_preset(
812812
timeout_minutes=10,
813813
validate_reports=False,
814814
),
815+
Preset(
816+
name="mlx-kakeya-launcher-full",
817+
description="Validate scripts/run_kakeya_mac.sh in FULL mode (f_θ "
818+
"verifier+proposer+f_θ, default path) on a LONG scripted "
819+
"answer that crosses the ~1024 native-cache ring wrap. "
820+
"Guards the launcher's full pipeline + the PR #146 "
821+
"wrapped-ring fix end-to-end: the report must pass the §4 "
822+
"liveness gate AND the quality gate (coherent, no runaway "
823+
"repeat) past the wrap.",
824+
command_templates=(
825+
(
826+
"bash", "scripts/run_kakeya_mac.sh",
827+
"--max-new-tokens", "{max_new_tokens}",
828+
"--ignore-turn-stop",
829+
"--chat-scripted", "请详细解释POW的工作原理",
830+
"--output",
831+
"results/research/k3_mac_bridge_launcher_full.json",
832+
),
833+
),
834+
timeout_minutes=90,
835+
params={"max_new_tokens": ("int:max_new_tokens", "1300")},
836+
validate_reports=True, # §4 liveness + §2.4 quality gate on-device
837+
),
815838
Preset(
816839
name="mlx-kakeya-degen-probe",
817840
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
@@ -75,8 +84,9 @@ if [[ "$FAST" == "1" ]]; then
7584
MODE="FAST (verifier + proposer + S5 bounded KV; f_θ BYPASSED)"
7685
else
7786
# torch drafter + f_θ: the harness auto-enables --force-f-theta in --chat, so
78-
# f_θ projection ACTUALLY RUNS each turn (the full pipeline).
79-
MODE="FULL (verifier + proposer + f_θ + S5 bounded KV; f_θ runs)"
87+
# f_θ projection ACTUALLY RUNS each turn (the full pipeline). Coherent past the
88+
# ~1024 native-cache wrap (PR #146: single-token commits once the ring wraps).
89+
MODE="FULL (verifier + proposer + f_θ + S5 bounded KV; f_θ runs; long-answer safe)"
8090
fi
8191

8292
log "mode : $MODE"

tests/inference_engine/bridge/test_manifest.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def test_allowlist_contains_exactly_the_documented_presets():
8686
"mlx-kakeya-fused-chat-ftheta",
8787
"mlx-kakeya-fused-chat-smoke",
8888
"mlx-kakeya-launcher-dryrun-bash32",
89+
"mlx-kakeya-launcher-full",
8990
"mlx-kakeya-launcher-smoke",
9091
"mlx-multitenant-pressure",
9192
"mlx-upgrade",
@@ -108,7 +109,7 @@ def test_harness_presets_validate_reports_others_do_not():
108109
"k3-step2-fused-allmlx",
109110
# §4 liveness gate runs on-device for the fused-chat presets too:
110111
"mlx-kakeya-fused-chat-smoke", "mlx-kakeya-fused-chat-ftheta",
111-
"mlx-kakeya-launcher-smoke",
112+
"mlx-kakeya-launcher-smoke", "mlx-kakeya-launcher-full",
112113
}
113114

114115

@@ -168,6 +169,20 @@ def test_mlx_kakeya_launcher_smoke_preset_invokes_launcher():
168169
assert argv[argv.index("--max-new-tokens") + 1] == "64"
169170

170171

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

0 commit comments

Comments
 (0)