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
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
2330set -euo pipefail
@@ -31,7 +38,9 @@ FTHETA="${KAKEYA_MAC_FTHETA_DIR:-results/research/f_theta_v5_s5_sliding}"
3138SINK=" ${KAKEYA_SINK:- 4} "
3239WINDOW=" ${KAKEYA_WINDOW:- 64} "
3340BLOCK=" ${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
3645FAST=0
3746DRY_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)"
7685else
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)"
8090fi
8191
8292log " mode : $MODE "
0 commit comments