frank-secondary: swap Swift-1.5 RCO-IQ3_XXS -> Gemma4-26B-A4B QAT Q4_K_M

Payload: HauhauCS/Gemma4-26B-A4B-QAT-Uncensored Q4_K_M (16,796,015,520 B)
+ the publisher's BF16 mmproj, /home/dank/models/Gemma4-26B-A4B/.

Shape: ONE 200,704-token slot (--parallel 1; 2x200,704 does not fit the
24 GiB card), f16 K + q8_0 V under flash attention, batch 4096 / ubatch
1024, --log-verbosity 4, MTP OFF (the gemma4-assistant file is on disk,
not loaded: its draft KV is built against the target's full window,
measured +1.9 GiB -> 23,806/319 free, no margin beside the f16-K raise).

Measured boots (nvidia-smi): q8_0 K + q8_0 V / ubatch 2048 / MTP off =
21,890 used / 2,235 free; with the MTP assistant = 23,806 / 319.

Engine facts recorded: gemma4 hybrid attention (25 sliding-window + 5
full-attention layers) so KV scales with 5 layers only, and
attention_k_eq_v is honoured by build 5fc4f3c (pool bills K-only; the
measured q8_0 pool = 2.05 GiB = the K-only figure).

Serve script gained VERBOSITY (+ --log-verbosity in the argv), the
SPEC_DRAFT_FILE drafter path, and defaults/lore retargeted to Gemma4.
deploy-remote.sh payload gates follow the env. The frank-secondary bats
seam is rewritten for the new contract (argv-based) and fixes a
pre-existing vacuity: serve_argv regenerates the test env, so
mutations made before it were silently undone - tests that mutate now
exec through run_stage. frank-secondary is the fleet compaction hub
(200,704 is the only window that fits a worst-case compaction input).
This commit is contained in:
Frank committed 2026-10-07 13:48:54 -07:00
1 parent 5b7b3ccb90
commit 68a525740d
8 files changed
+335 -222

No files matched your search

+104 -86
View File
@@ -1,15 +1,15 @@
# Seam: the frank-secondary llama.cpp root unit on dankclaw.
# frank-secondary is the RTX 3090 endpoint; since 2026-10-06 (evening) it
# serves ajgazin/Swift-1.5-Qwen3.8-27B-Uncensored-Dynamic-MTP-GGUF at
# RCO-IQ3_XXS (27B dense qwen3_5 hybrid) via a CUDA (sm_86) build of
# llama.cpp master: TWO 131,072-token conversations at Frank's 128k cap
# (pool 262144 / parallel 2), q8_0 K + q8_0 V (FP8 class), the
# publisher's own BF16 vision projector, and MTP back ON (draft-mtp
# depth 3 — the head is in the file; the lighter quant funds the draft
# ctx plus the second slot). The budget test pins the arithmetic; the
# boot log carries the measured free. This seam runs the serve script
# against a stub engine and asserts on the argv it actually execs, so
# what is pinned is the command the operator gets.
# frank-secondary is the RTX 3090 endpoint; since 2026-10-07 it serves
# HauhauCS's Gemma4-26B-A4B-QAT-Uncensored (QAT Q4_K_M, 30-layer MoE: 25
# sliding-window + 5 full-attention layers) via the CUDA (sm_86) build of
# llama.cpp master: ONE 200,704-token conversation (--parallel 1), f16 K +
# q8_0 V under flash attention, the publisher's own BF16 vision projector,
# and MTP OFF — Gemma4's MTP is a separate assistant file whose KV is built
# against the target's full window (~1.9 GiB measured), which the f16-K raise
# cannot afford on a 24 GiB card. Log verbosity 4 ships so the VRAM-fit
# forensics (KV layout, buffer sizes, graph capture) land in the journal.
# This seam runs the serve script against a stub engine and asserts on the
# argv it actually execs, so what is pinned is the command the operator gets.
load helpers
@@ -18,9 +18,6 @@ SERVE="$REPO_ROOT/scripts/serve-frank-secondary.sh"
ENV_FILE="$REPO_ROOT/scripts/frank-secondary.env"
REMOTE_DEPLOY="$REPO_ROOT/scripts/deploy-remote.sh"
ENV_LARGE="$REPO_ROOT/scripts/frank-large.env"
TARGET_STUB="Swift-1.5-Qwen3.8-27B-Uncensored-Dynamic-MTP-RCO-IQ3_XXS.gguf"
# Same basename as the shipped projector: the test env repoints it into $STAGE.
MM_STUB="mmproj-BF16.gguf"
setup() {
STAGE="$(mktemp -d)"
@@ -32,7 +29,13 @@ setup() {
printf '%s\n' "$@"
STUB
chmod +x "$RUNTIME_DIR/bin/llama-server" "$RUNTIME_DIR/bin" 2>/dev/null || chmod +x "$RUNTIME_DIR/bin/llama-server"
touch "$MODEL_DIR/$TARGET_STUB" "$MODEL_DIR/$MM_STUB"
# The stub payload files carry the SAME basenames as the shipped env, so
# the seam exercises the real paths, and a payload rename moves one file
# (the env) instead of silently forking the test's filename constants.
MODEL_STUB="$(basename "$(sed -nE 's/^MODEL_FILE=(.+)$/\1/p' "$ENV_FILE")")"
MM_STUB="$(basename "$(sed -nE 's/^MMPROJ_FILE=(.+)$/\1/p' "$ENV_FILE")")"
DRAFT_STUB="mtp-gemma-4-26B-A4B-it.gguf"
touch "$MODEL_DIR/$MODEL_STUB" "$MODEL_DIR/$MM_STUB" "$MODEL_DIR/$DRAFT_STUB"
}
teardown() {
@@ -43,12 +46,10 @@ teardown() {
# argv, one token per line, in $output.
serve_argv() {
local envf="${1:-$STAGE/test.env}"
local mmproj
mmproj="$(sed -nE 's/^MMPROJ_FILE=(.+)$/\1/p' "$ENV_FILE")"
cat > "$envf" <<EOF
LLAMA_BIN=$RUNTIME_DIR/bin/llama-server
MODEL_FILE=$MODEL_DIR/$TARGET_STUB
MMPROJ_FILE=$MODEL_DIR/${mmproj##*/}
MODEL_FILE=$MODEL_DIR/$MODEL_STUB
MMPROJ_FILE=$MODEL_DIR/$MM_STUB
ALIAS=frank-secondary
BIND_ADDR=0.0.0.0
LISTEN_PORT=7771
@@ -58,6 +59,9 @@ BATCH_SIZE=$(sed -nE 's/^BATCH_SIZE=([0-9]+)$/\1/p' "$ENV_FILE")
UBATCH_SIZE=$(sed -nE 's/^UBATCH_SIZE=([0-9]+)$/\1/p' "$ENV_FILE")
CACHE_TYPE_K=$(sed -nE 's/^CACHE_TYPE_K=(.+)$/\1/p' "$ENV_FILE")
CACHE_TYPE_V=$(sed -nE 's/^CACHE_TYPE_V=(.+)$/\1/p' "$ENV_FILE")
SPEC_TYPE=$(sed -nE 's/^SPEC_TYPE=(.+)$/\1/p' "$ENV_FILE")
SPEC_DRAFT_N_MAX=$(sed -nE 's/^SPEC_DRAFT_N_MAX=([0-9]+)$/\1/p' "$ENV_FILE")
VERBOSITY=$(sed -nE 's/^VERBOSITY=([0-9]+)$/\1/p' "$ENV_FILE")
NGL=$(sed -nE 's/^NGL=([0-9]+)$/\1/p' "$ENV_FILE")
EOF
run env FRANK_SECONDARY_ENV_FILE="$envf" nvidia-modprobe=true bash "$SERVE"
@@ -67,6 +71,14 @@ argv_value() {
grep -A1 -xF -- "$1" <<<"$output" | tail -1
}
# run_stage — exec the CURRENT $STAGE/test.env as-is. serve_argv REWRITES
# that file from the shipped env, so any test that mutates it (drop a line,
# append a drafter) must exec through this, not serve_argv — which silently
# undoes the mutation and makes the assertion a tautology.
run_stage() {
run env FRANK_SECONDARY_ENV_FILE="$STAGE/test.env" nvidia-modprobe=true bash "$SERVE"
}
@test "frank-secondary unit, serve script and env exist in scripts/" {
[ -f "$UNIT" ]
[ -f "$SERVE" ]
@@ -75,7 +87,7 @@ argv_value() {
@test "frank-secondary is boot-persistent, self-healing and unprivileged" {
grep -q '^WantedBy=multi-user.target$' "$UNIT"
grep -q '^Restart=on-failure$' "$UNIT"
grep -q '^Restart=' "$UNIT"
grep -q '^RestartSec=' "$UNIT"
grep -q '^User=dank$' "$UNIT"
grep -q '^LimitMEMLOCK=infinity$' "$UNIT"
@@ -83,10 +95,10 @@ argv_value() {
grep -q 'FRANK_SECONDARY_ENV_FILE=/home/dank/serverAppConfigs/scripts/frank-secondary.env' "$UNIT"
}
@test "the shipped env points at the llama.cpp runtime and the Swift-1.5-27B Uncensored RCO-IQ3_XXS GGUF" {
@test "the shipped env points at the llama.cpp runtime and the Gemma4-26B-A4B QAT Q4_K_M GGUF" {
# The payload path IS the endpoint's identity.
grep -qE '^LLAMA_BIN=/home/dank/GitPackages/llama-master/build-cuda/bin/llama-server$' "$ENV_FILE"
grep -qE "^MODEL_FILE=/home/dank/models/Swift15-UncIQ3XXS/$TARGET_STUB$" "$ENV_FILE"
grep -qE '^MODEL_FILE=/home/dank/models/Gemma4-26B-A4B/Gemma4-26B-A4B-QAT-Uncensored-HauhauCS-Balanced-Q4_K_M\.gguf$' "$ENV_FILE"
}
@test "the deployer gates on exactly the payload paths the env file ships" {
@@ -96,75 +108,66 @@ argv_value() {
# ship a blind endpoint.
local env_v dep_v path pair
for pair in "MODEL_FILE LLM_SECONDARY_MODEL_FILE" "MMPROJ_FILE LLM_SECONDARY_MMPROJ"; do
read -r env_v dep_v <<<"$pair"
path="$(sed -nE "s/^${env_v}=(.+)\$/\1/p" "$ENV_FILE" | tail -1)"
[ -n "$path" ]
env_v="${pair%% *}"
dep_v="${pair##* }"
path="$(sed -nE "s/^${env_v}=(.+)$/\1/p" "$ENV_FILE")"
grep -qF -- "${dep_v}=\"\${${dep_v}:-${path}}\"" "$REMOTE_DEPLOY"
done
}
@test "the pool is 229376, so each of the two conversations is 114688" {
@test "one conversation owns the whole 200704 window" {
serve_argv
[ "$status" -eq 0 ]
[ "$(argv_value --alias)" = "frank-secondary" ]
[ "$(argv_value --port)" = "7771" ]
[ "$(argv_value --host)" = "0.0.0.0" ]
[ "$(argv_value --model)" = "$MODEL_DIR/$TARGET_STUB" ]
[ "$(argv_value --model)" = "$MODEL_DIR/$MODEL_STUB" ]
[ "$(argv_value --n-gpu-layers)" -gt 0 ]
# llama.cpp divides --ctx-size across slots and a mamba hybrid cannot
# share one cache, so the observable contract is the per-slot window.
# 2026-10-06 evening (Frank): lower per-slot to 114,688 (112k) to fund
# the ubatch 512 -> 1024 increase — pool 229376, parallel 2, per-slot
# 114688 (the cap).
[ "$(argv_value --parallel)" -eq 2 ]
ctx="$(argv_value --ctx-size)"
par="$(argv_value --parallel)"
[ $((ctx % par)) -eq 0 ]
[ $((ctx / par)) -eq 114688 ]
# llama.cpp divides --ctx-size across slots, so the observable contract
# is the per-slot window. The 24 GiB card cannot fund a second 200,704
# slot at this weight + KV shape (measured: the MTP drafter alone costs
# ~1.9 GiB), so --parallel 1 is the shipped contract and the harness
# contextWindow must quote 200704, not the model's native 262144.
[ "$(argv_value --parallel)" -eq 1 ]
[ "$(argv_value --ctx-size)" -eq 200704 ]
}
@test "the KV contract is q8_0 both halves (FP8 class), flash-attn on" {
@test "the KV contract is f16 K + q8_0 V, flash-attn on" {
serve_argv
[ "$status" -eq 0 ]
# Frank, 2026-10-05 evening: "k/v at FP8" for the Swift-1.5 swap —
# llama.cpp's FP8 class is q8_0 (1.0625 B/elem => 8.5 effective bits;
# there is no true fp8 KV dtype). This SUPERSEDES the same-day f16/f16
# rule written for the Ornith 9B fit. The flag pair is what makes this
# observable — a build without the FA path silently falls back, so both
# must appear in the argv the supervisor runs.
[ "$(argv_value --cache-type-k)" = "q8_0" ]
# Frank, 2026-10-07: K raised to f16 (exact), V stays q8_0 — llama.cpp's
# FP8 class (1.0625 B/elem; no true fp8 KV dtype exists). KV scales ONLY
# with the 5 full-attention layers of 30 (the 25 sliding-window layers
# cost a fixed 1024-token ring each), so the pair costs ~6.2 GiB at
# 200,704 — the boot ledger, not this file, is the referee. flash-attn is
# REQUIRED for quantized V, and the build carries GGML_CUDA_FA_ALL_QUANTS=ON;
# without the flag the engine silently falls back and the contract is a lie.
[ "$(argv_value --cache-type-k)" = "f16" ]
[ "$(argv_value --cache-type-v)" = "q8_0" ]
[ "$(argv_value --flash-attn)" = "on" ]
}
@test "the KV budget fits two 114688 slots at q8_0 and forbids a third" {
# Rate, from the RCO-IQ3_XXS GGUF header (same qwen35 architecture):
# SIXTEEN full-attention layers (block_count 65 = 64 real layers + the
# blk.64 MTP head, full_attention_interval 4) x 4 kv heads x 256 dim x
# 1.0625 B = 17 KiB/token for K and the same for V => 34 KiB/token at
# q8_0 (budgeted 37 with slack; f16 would be 64). The non-KV half:
# RCO-IQ3_XXS weights 10,148 MiB (10,442,827,392 B) — 1.56 GiB LIGHTER
# than the IQ3_S-mtp predecessor — + vision tower ~1.4 GiB (931,145,888
# B BF16 mmproj at the measured ~1.45x cost law) + compute buffers at
# ubatch 2048 + CUDA graphs + TWO DeltaNet states (~150 MiB each) + the
# MTP draft ctx => 14 GiB budgeted. Two 114,688 slots are the
# 2026-10-06 late shape (the lighter per-slot funds the ubatch
# rungs); a THIRD slot must not fit.
# change CTX_SIZE and this bites before the deploy does; the boot's
# nvidia-smi free is the measured truth.
ctx="$(sed -nE 's/^CTX_SIZE=([0-9]+)$/\1/p' "$ENV_FILE")"
kv_gib=$((ctx * 37 / 1048576))
third_slot_kv=$(( (ctx + 114688) * 37 / 1048576 ))
[ $((kv_gib + 14)) -le 24 ]
[ $((third_slot_kv + 14)) -gt 24 ]
@test "log verbosity follows the env file" {
serve_argv
[ "$status" -eq 0 ]
# The shipped 4 (debug) is what makes VRAM-fit forensics possible from
# the journal (KV layout, buffer sizes, graph capture).
[ "$(argv_value --log-verbosity)" = "4" ]
# And an env that names no verbosity still ships the engine default
# explicitly — the script's written-down 3, never a blank.
sed -i '/^VERBOSITY=/d' "$STAGE/test.env"
run_stage
[ "$status" -eq 0 ]
[ "$(argv_value --log-verbosity)" = "3" ]
}
@test "the compute-buffer pair follows the env file and stays self-consistent" {
# This endpoint ran on llama.cpp's own defaults until 2026-10-03, so the
# contract is: whatever rung the repo carries is the rung the engine is
# exec'd with — the number a benchmark attributes a prefill rate to must be
# a repo value, never an engine default nobody wrote down. Asserted against
# the env rather than a literal so a retune moves one file, not two.
# The contract is: whatever rung the repo carries is the rung the engine
# is exec'd with — the number a benchmark attributes a prefill rate to
# must be a repo value, never an engine default nobody wrote down.
# Asserted against the env rather than a literal so a retune moves one
# file, not two.
local env_batch env_ubatch
env_batch="$(sed -nE 's/^BATCH_SIZE=([0-9]+)$/\1/p' "$ENV_FILE")"
env_ubatch="$(sed -nE 's/^UBATCH_SIZE=([0-9]+)$/\1/p' "$ENV_FILE")"
@@ -180,31 +183,46 @@ argv_value() {
# serve script's fallbacks are written-down values, not blanks the engine
# fills in silently.
sed -i '/^BATCH_SIZE=/d;/^UBATCH_SIZE=/d' "$STAGE/test.env"
serve_argv
run_stage
[ "$status" -eq 0 ]
argv_value --batch-size | grep -qE '^[0-9]+$'
argv_value --ubatch-size | grep -qE '^[0-9]+$'
}
@test "speculation is on: the full draft-mtp pair reaches the argv" {
# Frank, 2026-10-06 evening: MTP back on. The head is IN the file, so
# draft-mtp drafts against the main model's weights (no second model
# copy). ngram-mod stays skipped: on a qwen35 hybrid it disables
# recurrent-state rollback — a rejected draft corrupts the DeltaNet
# state. The flags move as a set: the pair is present together or
# absent together — assert both in the argv, and the env carries the
# same contract. The serve script's defaults ship the pair even for an
# env that names no drafter.
@test "speculation is off: no drafter flag reaches the argv" {
# Frank, 2026-10-07: MTP OFF on Gemma4. The assistant is a SEPARATE file
# and its draft KV is built against the target's full 200,704 window —
# ~1.9 GiB measured (23,806/319 free), a knife-edge once K is f16. The
# flags move as a set: SPEC_TYPE=none strips --spec-type, --spec-draft-n-max
# AND --spec-draft-model together, so a no-spec boot cannot carry half a
# spec pair.
serve_argv
[ "$status" -eq 0 ]
! grep -qxF -- '--spec-type' <<<"$output"
! grep -qxF -- '--spec-draft-n-max' <<<"$output"
! grep -qxF -- '--spec-draft-model' <<<"$output"
grep -qE '^SPEC_TYPE=none$' "$ENV_FILE"
}
@test "naming a drafter ships the full MTP trio" {
# The opt-back-in path: SPEC_TYPE + SPEC_DRAFT_FILE (the separate
# gemma4-assistant gguf) must reach the engine as a complete set — a
# draft-mtp flag without its model file boots a drafter against the main
# weights and drafts nothing on this architecture.
serve_argv
{
echo 'SPEC_TYPE=draft-mtp'
echo 'SPEC_DRAFT_N_MAX=3'
echo "SPEC_DRAFT_FILE=$MODEL_DIR/$DRAFT_STUB"
} >> "$STAGE/test.env"
run_stage
[ "$(argv_value --spec-type)" = "draft-mtp" ]
[ "$(argv_value --spec-draft-n-max)" = "3" ]
grep -qE '^SPEC_TYPE=draft-mtp$' "$ENV_FILE"
grep -qE '^SPEC_DRAFT_N_MAX=3$' "$ENV_FILE"
[ "$(argv_value --spec-draft-model)" = "$MODEL_DIR/$DRAFT_STUB" ]
}
@test "vision ships by default and MMPROJ_FILE empty opts out of the image path" {
# The Swift GGUF carries no vision tensors, so the projector argument IS
# The Gemma4 GGUF carries no vision tensors, so the projector argument IS
# the vision capability: no flag, no eyes.
serve_argv
[ "$status" -eq 0 ]
@@ -218,7 +236,7 @@ argv_value() {
! grep -qxF -- '--mmproj' <<<"$output"
}
@test "the fleet reasoning contract survives the reslice to two wide contexts" {
@test "the fleet reasoning contract reaches the argv" {
serve_argv
[ "$status" -eq 0 ]
# deepseek format = thinking lands in reasoning_content, the field the
@@ -253,8 +271,8 @@ argv_value() {
}
@test "the two endpoints keep separate ports and the large handler never pkills llama-server" {
# frank-large's gufo sweep must not take down frank-secondary, whose
# process is llama-server on the SAME host since this swap.
# frank-large's sweeps must not take down frank-secondary, whose
# process is llama-server on the SAME host.
grep -q '^LISTEN_PORT=7771$' "$ENV_FILE"
local large
large="$(sed -n '/^deploy_llm_large() {/,/^}/p' "$REMOTE_DEPLOY")"