frank-primary: prefix caching back ON — the OFF experiment did not fix the corruption

Frank: still corrupted at ~40k with --no-enable-prefix-caching deployed
and mechanically verified (zero gdn_hip faults in the container serving
that window, coherent 40,771-token boundary probe). The recurrence is
FAULT-FREE, so the align-mode page re-seed is not the (only) mechanism
and the mitigation bought whole-history re-prefill per turn for nothing.

Revert: knob FRANK_PRIMARY_NO_PREFIX_CACHING commented out -> the serve
branch renders --enable-prefix-caching (the shipped contract). The knob,
the branch and the seam stay documented for a future fixed fork build.

Open hypotheses recorded in the runbook: re-fed poisoned transcript (the
same conversation cannot distinguish fixed from unfixed), or a second
fault-free long-context path — fp8 KV at depth is the next suspect. Next
diagnostic: fresh-conversation reproduction, then a KV-dtype A/B.
This commit is contained in:
Frank
2026-10-05 13:13:26 -07:00
parent 1fee99c8ce
commit 35a45b8a66
4 changed files with 57 additions and 26 deletions
+15 -5
View File
@@ -175,7 +175,8 @@ FRANK_PRIMARY_KV_DTYPE=fp8
FRANK_PRIMARY_MNBT=2048 FRANK_PRIMARY_MNBT=2048
FRANK_PRIMARY_GATHER_CHUNKS=32 FRANK_PRIMARY_GATHER_CHUNKS=32
FRANK_PRIMARY_GATHER_LANES=64 FRANK_PRIMARY_GATHER_LANES=64
# PREFIX CACHING IS OFF — THE FORK'S OWN NAMED MITIGATION (2026-10-05). # PREFIX CACHING: ON. An OFF experiment ran 2026-10-05 (below) and FAILED
# to stop the corruption, so the historical flag is back.
# MEASURED 2026-10-04, 18:46:07 PDT (5.6 h into the live boot, one running # MEASURED 2026-10-04, 18:46:07 PDT (5.6 h into the live boot, one running
# request, prefix hit rate 48.1%): 48 gdn_hip state faults in one 0.6 s # request, prefix hit rate 48.1%): 48 gdn_hip state faults in one 0.6 s
# burst, then the process-lifetime silence cap: # burst, then the process-lifetime silence cap:
@@ -212,10 +213,19 @@ FRANK_PRIMARY_GATHER_LANES=64
# history instead of at most 3135 tail tokens (a full 40k context costs # history instead of at most 3135 tail tokens (a full 40k context costs
# tens of seconds of TTFT per turn at this shape's prefill rate). A silently # tens of seconds of TTFT per turn at this shape's prefill rate). A silently
# corrupted conversation is worse than a slower first token. # corrupted conversation is worse than a slower first token.
# RE-ENABLE PATH: if the fork ships a fixed align path, set this to empty, # RESULT (2026-10-05, later that day): THE MITIGATION DID NOT WORK. With
# redeploy, and re-verify by taking one conversation past 40,768 tokens # --no-enable-prefix-caching deployed and mechanically verified (zero
# (decode must stay coherent and podman logs must show zero gdn_hip lines). # gdn_hip faults, a 40,771-token single-request boundary probe coherent),
FRANK_PRIMARY_NO_PREFIX_CACHING=1 # live long conversations STILL degraded at ~40k on the running endpoint
# (Frank, direct). The container serving that window logged ZERO faults
# while the corruption reproduced, so the align-mode page re-seed is not
# the (only) mechanism — see the runbook's RESULT note for the open
# hypotheses (re-fed poisoned transcript vs a fault-free long-context
# path such as fp8 KV at depth). Cost bought nothing: caching is back ON.
# The knob stays commented for a future fork build with a fixed GDN state
# path: set 1, redeploy, re-verify past 40,768 tokens (one conversation
# coherent AND zero gdn_hip lines).
# FRANK_PRIMARY_NO_PREFIX_CACHING=1
# UTIL is an ARENA lever: the fork plans `budget = device_total x util`, and at # UTIL is an ARENA lever: the fork plans `budget = device_total x util`, and at
# 31.86 GiB/card every +0.01 is +0.32 GiB of expert cache (~+139 slots), and # 31.86 GiB/card every +0.01 is +0.32 GiB of expert cache (~+139 slots), and
# 0.982 is Frank's standing law: NEVER 1.00. The 1.00 attempt (2026-10-03, # 0.982 is Frank's standing law: NEVER 1.00. The 1.00 attempt (2026-10-03,
+8 -7
View File
@@ -137,13 +137,14 @@ fi
# available" while device_count() says 2). --ipc=host for the engine's shared # available" while device_count() says 2). --ipc=host for the engine's shared
# memory; memlock unbounded for the pinned host slabs. # memory; memlock unbounded for the pinned host slabs.
# The entrypoint already execs `vllm serve "$@"`, so no `serve` here. # The entrypoint already execs `vllm serve "$@"`, so no `serve` here.
# Prefix caching: the fork's QFN mamba align path corrupts GDN SSM state # Prefix caching: ON — the shipped contract. FRANK_PRIMARY_NO_PREFIX_-
# at ~40k tokens (2026-10-04, 48 gdn_hip state faults, one request — the # CACHING=1 flips to the fork-named mitigation (--no-enable-prefix-caching)
# evidence block is in frank-primary.env). FRANK_PRIMARY_NO_PREFIX_CACHING # for the QFN align-mode GDN state fault; it was tried 2026-10-05 and
# flips to the fork-named mitigation (--no-enable-prefix-caching); empty # REVERTED the same day (live conversations still degraded at ~40k with
# keeps the historical flag. NO comment lines inside the backslash chain # caching off and zero faults — see the evidence block in
# below — a comment there terminates the continuation and the next line # frank-primary.env). NO comment lines inside the backslash chain below —
# runs as its own command (the 2026-10-05 exit-127 crash loop). # a comment there terminates the continuation and the next line runs as
# its own command (the 2026-10-05 exit-127 crash loop).
# The ${VAR:-word} / ${VAR:+word} double-expansion for the two directions is # The ${VAR:-word} / ${VAR:+word} double-expansion for the two directions is
# AMBIGUOUS bash (${VAR:--flag} parses as a substring offset when set — # AMBIGUOUS bash (${VAR:--flag} parses as a substring offset when set —
# measured 2026-10-05: rendered "--no-enable-prefix-caching1"), so the flag # measured 2026-10-05: rendered "--no-enable-prefix-caching1"), so the flag
@@ -374,6 +374,25 @@ slower first token.
192.168.0.112:8989 leg with FrankBook-Pro asleep (environmental, 192.168.0.112:8989 leg with FrankBook-Pro asleep (environmental,
unrelated to this change; re-run `tests/e2e/run.sh` once the mini is up). unrelated to this change; re-run `tests/e2e/run.sh` once the mini is up).
**RESULT — REVERTED THE SAME DAY.** With every mechanical check green
(zero faults, coherent 40,771-token probe), live long conversations
STILL degraded at ~40k on the running endpoint (Frank, direct
observation). The container serving that window (`--no-enable-prefix-
caching`, booted 2026-10-05 12:47 PDT) logged ZERO `gdn_hip` faults
while the corruption reproduced — so this recurrence is **fault-free**:
the NaN-state guard did not fire, which the re-seed theory requires.
Open hypotheses, in order: (1) the poisoned transcript is being re-fed —
corrupted assistant turns already in the history keep producing
corrupted continuations even with perfect state, so the same
conversation cannot distinguish fixed from unfixed; (2) a second
long-context mechanism with no guard coverage — fp8 KV degradation at
depth is the next suspect (a bf16-KV boot costs ~2× the pool per token
and would settle it). Prefix caching is **back ON**
(`FRANK_PRIMARY_NO_PREFIX_CACHING` commented out — the cost bought no
fix). The knob and the serve branch stay for a future fork build with a
fixed GDN path. Next diagnostic: reproduce on a FRESH conversation; if
it still breaks at ~40k with zero faults, A/B the KV dtype.
### Shape F/G (2026-10-03): where the free VRAM actually is, and what forcing it cost ### Shape F/G (2026-10-03): where the free VRAM actually is, and what forcing it cost
`rocm-smi` showed **3.57 GiB free per R9700** at the deployed shape E (28.28 GiB `rocm-smi` showed **3.57 GiB free per R9700** at the deployed shape E (28.28 GiB
+15 -14
View File
@@ -142,16 +142,16 @@ DOWNLOAD="$REPO_ROOT/scripts/download-frank-primary.sh"
grep -q '^FRANK_PRIMARY_CACHE_DIR=/home/dank/.cache/frank-primary$' "$ENV_FILE" grep -q '^FRANK_PRIMARY_CACHE_DIR=/home/dank/.cache/frank-primary$' "$ENV_FILE"
grep -q '^FRANK_PRIMARY_GATHER_CHUNKS=32$' "$ENV_FILE" grep -q '^FRANK_PRIMARY_GATHER_CHUNKS=32$' "$ENV_FILE"
grep -q '^FRANK_PRIMARY_GATHER_LANES=64$' "$ENV_FILE" grep -q '^FRANK_PRIMARY_GATHER_LANES=64$' "$ENV_FILE"
# Prefix caching is OFF (2026-10-05): with the flag on, the fork runs # Prefix caching is ON (reverted 2026-10-05 the same day it was
# QFN on mamba_cache_mode 'align', and its GDN state path went # disabled): the fork's QFN align-mode GDN state fault (48 gdn_hip
# non-finite mid-conversation (48 gdn_hip state faults, one request, # state faults, slot 42 heads 3/8, at the 13th 3136-token boundary =
# slot 42 heads 3/8, at the 13th 3136-token boundary = 40,768 — the # 40,768 — the "~40k corruption" report) was mitigated with
# "~40k corruption" report). The fork's own guard names the mitigation: # --no-enable-prefix-caching, but live long conversations STILL
# --no-enable-prefix-caching. RAM was ruled out the same day (zero MCE, # degraded at ~40k with caching off and zero faults logged — cost
# in-band pattern stable, 4800 MT/s is the JEDEC floor). The evidence # with no fix, so the historical flag returned. The knob stays
# block is FRANK_PRIMARY_NO_PREFIX_CACHING in the env file; re-enable # commented in the env file for a future fixed fork build; flip it to
# only with a fixed align path and a re-verification past 40,768 tokens. # 1 only together with a re-verification past 40,768 tokens.
grep -q '^FRANK_PRIMARY_NO_PREFIX_CACHING=1$' "$ENV_FILE" grep -qE '^# FRANK_PRIMARY_NO_PREFIX_CACHING=1$' "$ENV_FILE"
grep -q '^FRANK_PRIMARY_MODEL_SHARDS=131$' "$ENV_FILE" grep -q '^FRANK_PRIMARY_MODEL_SHARDS=131$' "$ENV_FILE"
} }
@@ -175,9 +175,10 @@ DOWNLOAD="$REPO_ROOT/scripts/download-frank-primary.sh"
# explicitly in the serve script (the ${VAR:--flag} double-expansion is # explicitly in the serve script (the ${VAR:--flag} double-expansion is
# ambiguous bash — when set it parsed as a substring offset, measured # ambiguous bash — when set it parsed as a substring offset, measured
# 2026-10-05): set -> --no-enable-prefix-caching (the fork-named # 2026-10-05): set -> --no-enable-prefix-caching (the fork-named
# mitigation), unset -> the historical --enable-prefix-caching. Both # mitigation, tried and REVERTED the same day — live corruption
# directions are spelled out so a fork default change cannot silently # persisted at ~40k with zero faults), unset -> the shipped
# flip the contract. # --enable-prefix-caching. Both directions are spelled out so a fork
# default change cannot silently flip the contract.
grep -qF 'FRANK_PRIMARY_PREFIX_CACHE_FLAG=--no-enable-prefix-caching' "$SERVE" grep -qF 'FRANK_PRIMARY_PREFIX_CACHE_FLAG=--no-enable-prefix-caching' "$SERVE"
grep -qF 'FRANK_PRIMARY_PREFIX_CACHE_FLAG=--enable-prefix-caching' "$SERVE" grep -qF 'FRANK_PRIMARY_PREFIX_CACHE_FLAG=--enable-prefix-caching' "$SERVE"
grep -qF '"$FRANK_PRIMARY_PREFIX_CACHE_FLAG"' "$SERVE" grep -qF '"$FRANK_PRIMARY_PREFIX_CACHE_FLAG"' "$SERVE"
@@ -192,7 +193,7 @@ DOWNLOAD="$REPO_ROOT/scripts/download-frank-primary.sh"
FRANK_PRIMARY_PREFIX_CACHE_FLAG=--enable-prefix-caching FRANK_PRIMARY_PREFIX_CACHE_FLAG=--enable-prefix-caching
fi fi
printf %s "$FRANK_PRIMARY_PREFIX_CACHE_FLAG"' _ "$ENV_FILE" printf %s "$FRANK_PRIMARY_PREFIX_CACHE_FLAG"' _ "$ENV_FILE"
[ "$output" = "--no-enable-prefix-caching" ] [ "$output" = "--enable-prefix-caching" ]
grep -q -- '--trust-remote-code' "$SERVE" grep -q -- '--trust-remote-code' "$SERVE"
# DCP is opt-in: the flag is passed only when FRANK_PRIMARY_DCP is set # DCP is opt-in: the flag is passed only when FRANK_PRIMARY_DCP is set
# (DCP reuses the TP ranks when PCP is off, so TP=2 + DCP=2 fits two GPUs). # (DCP reuses the TP ranks when PCP is off, so TP=2 + DCP=2 fits two GPUs).