frank-small: three contexts, vision on, 2-3 GiB of the 3090 left free

CTX_SIZE 589824 / PARALLEL 3 -> three independent 196,608-token conversations
(a mamba hybrid cannot share one KV cache, so per-slot window = pool/slots;
3 x 262,144 would need 18.4 GiB of KV alone and busts the card).

Vision comes back via bartowski's mmproj-MiMo-V2.6-Distill-Qwen-9B-f16.gguf
(918,166,048 B, sha256 ff348f31..., fetched + verified by
scripts/download-frank-small.sh): the Q5_K_M GGUF ships no v.* tensors, so
--mmproj IS the image path. MMPROJ_FILE without a colon default so an explicit
empty value is a real text-only opt-out, and the deployer now gates on the
projector exactly as the serve script does.

Budget is measured, not guessed: the 2 x 262,144 shape used 20,190/24,576 MiB,
which prices non-KV cost at 7,390 MiB. Three slots + projector land near
22.5 GiB, i.e. ~2 GiB spare - the bottom of the requested band, to be
confirmed by measurement and laddered if it lands outside 2-3 GiB.
This commit is contained in:
Frank committed 2026-10-02 03:08:00 -07:00
1 parent 8f129180d8
commit a02850203d
6 files changed
+162 -81

No files matched your search

+73 -27
View File
@@ -3,9 +3,11 @@
# frank-small is the RTX 3090 endpoint; since 2026-10-01 night it serves
# bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF:Q5_K_M via a CUDA (sm_86) build of
# llama.cpp master, chosen for the ASYMMETRIC KV Frank asked for: K f16
# (unquantized) + V q8_0, which only llama.cpp exposes per-tensor. 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.
# (unquantized) + V q8_0, which only llama.cpp exposes per-tensor. Since
# 2026-10-02 it runs THREE contexts and carries a vision projector, and the
# card must keep 2-3 GiB 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.
load helpers
@@ -15,6 +17,8 @@ ENV_FILE="$REPO_ROOT/scripts/frank-small.env"
REMOTE_DEPLOY="$REPO_ROOT/scripts/deploy-remote.sh"
ENV_LARGE="$REPO_ROOT/scripts/frank-large.env"
TARGET_STUB="MiMo-V2.6-Distill-Qwen-9B-Q5_K_M.gguf"
# Same basename as the shipped projector: the test env repoints it into $STAGE.
MM_STUB="mmproj-MiMo-V2.6-Distill-Qwen-9B-f16.gguf"
setup() {
STAGE="$(mktemp -d)"
@@ -26,7 +30,7 @@ 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"
touch "$MODEL_DIR/$TARGET_STUB" "$MODEL_DIR/$MM_STUB"
}
teardown() {
@@ -37,9 +41,12 @@ 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##*/}
ALIAS=frank-small
BIND_ADDR=0.0.0.0
LISTEN_PORT=7771
@@ -77,20 +84,36 @@ argv_value() {
grep -qE "^MODEL_FILE=/home/dank/models/MiMo-Q5KM/$TARGET_STUB$" "$ENV_FILE"
}
@test "the shipped env serves the fleet shape: two full native windows" {
@test "the deployer gates on exactly the payload paths the env file ships" {
# Anti-drift: the deploy handler checks files by its own defaults. If
# those ever differ from what the unit actually loads, a green deploy
# would be gating on a file nobody reads — and a missing projector would
# ship a blind endpoint.
local env_v dep_v path pair
for pair in "MODEL_FILE LLM_SMALL_MODEL_FILE" "MMPROJ_FILE LLM_SMALL_MMPROJ"; do
read -r env_v dep_v <<<"$pair"
path="$(sed -nE "s/^${env_v}=(.+)\$/\1/p" "$ENV_FILE" | tail -1)"
[ -n "$path" ]
grep -qF -- "${dep_v}=\"\${${dep_v}:-${path}}\"" "$REMOTE_DEPLOY"
done
}
@test "the shipped env serves the fleet shape: three 196608-token contexts" {
serve_argv
[ "$status" -eq 0 ]
[ "$(argv_value --alias)" = "frank-small" ]
[ "$(argv_value --port)" = "7771" ]
[ "$(argv_value --host)" = "0.0.0.0" ]
[ "$(argv_value --model)" = "$MODEL_DIR/$TARGET_STUB" ]
[ "$(argv_value --parallel)" -eq 2 ]
[ "$(argv_value --n-gpu-layers)" -gt 0 ]
# llama.cpp divides --ctx-size across slots: two slots means the pool
# must be 2 x the window, and the window never exceeds the native one.
# llama.cpp divides --ctx-size across slots and a mamba hybrid cannot
# share one cache, so the observable contract is the per-slot window.
[ "$(argv_value --parallel)" -eq 3 ]
ctx="$(argv_value --ctx-size)"
par="$(argv_value --parallel)"
[ $((ctx / par)) -eq 262144 ]
[ $((ctx % par)) -eq 0 ]
[ $((ctx / par)) -eq 196608 ]
[ $((ctx / par)) -le 262144 ]
}
@test "the KV contract is asymmetric: unquantized K, q8_0 V, flash-attn on" {
@@ -103,18 +126,22 @@ argv_value() {
[ "$(argv_value --flash-attn)" = "on" ]
}
@test "the KV budget fits the 3090 with room for checkpoints" {
# K f16 (16 KiB/token) + V q8_0 (~8.5, budget 25 with slack) over the
# whole pool, plus 6.4 GiB weights and ~2 GiB of compute buffers and
# CUDA graphs, must stay under the card's 24 GiB. This is arithmetic,
# not a boot log: change CTX_SIZE and it bites before deploy does. The
# same arithmetic with f16 V (16 KiB/token, so 32+2 overhead per token)
# lands past the card, which is why the contract is asymmetric.
@test "the KV budget leaves 2-3 GiB of the 3090 free" {
# Rate: K f16 (16 KiB/token) + V q8_0 (~8.5, budgeted 25 with slack).
# The non-KV half is MEASURED on this card on 2026-10-02, not guessed:
# weights 6.4 + projector 0.85 + compute buffers/CUDA graphs ~0.8 => 8.
# Two asserts, both about output the operator sees: the pool must still
# fit with 2 GiB spare, and it must be large enough that 5 GiB spare is
# NOT reachable — an undersized pool is as wrong as an oversized one.
# Arithmetic, not a boot log: change CTX_SIZE and this bites before the
# deploy does. The same pool with f16 V (34 KiB/token) lands past the
# card, which is why the contract is asymmetric.
ctx="$(sed -nE 's/^CTX_SIZE=([0-9]+)$/\1/p' "$ENV_FILE")"
kv_gib=$((ctx * 25 / 1048576))
[ $((kv_gib + 7 + 2)) -le 24 ]
[ $((kv_gib + 8 + 2)) -le 24 ]
[ $((kv_gib + 8 + 5)) -gt 24 ]
f16v_gib=$((ctx * 34 / 1048576))
[ $((f16v_gib + 7 + 2)) -gt 24 ]
[ $((f16v_gib + 8)) -gt 24 ]
}
@test "no speculative draft ships by default" {
@@ -125,30 +152,49 @@ argv_value() {
! grep -q '^DRAFT' "$ENV_FILE"
}
@test "frank-small stays text-only on the GGUF path and speaks the fleet reasoning field" {
# The GGUF carries no vision projector; the image path left with the
# SGLang checkpoint. models.yml declares frank-small text-only since
# the 2026-10-01 night swap.
! grep -q -- '--mmproj' "$SERVE"
# deepseek format = thinking lands in reasoning_content, the field the
# harness has always read on this endpoint (SGLang parity).
@test "vision ships by default and MMPROJ_FILE empty opts out of the image path" {
# The Q5_K_M GGUF carries no `v.*` tensors, so the projector argument IS
# the vision capability: no flag, no eyes.
serve_argv
[ "$status" -eq 0 ]
[ "$(argv_value --mmproj)" = "$MODEL_DIR/$MM_STUB" ]
# The documented opt-out must reach the engine as ABSENCE of the flag,
# not as an argument pointing at an empty string.
sed -i 's|^MMPROJ_FILE=.*|MMPROJ_FILE=|' "$STAGE/test.env"
run env FRANK_SMALL_ENV_FILE="$STAGE/test.env" nvidia-modprobe=true bash "$SERVE"
[ "$status" -eq 0 ]
! grep -qxF -- '--mmproj' <<<"$output"
}
@test "the fleet reasoning contract survives the reslice to three contexts" {
serve_argv
[ "$status" -eq 0 ]
# deepseek format = thinking lands in reasoning_content, the field the
# harness reads on this endpoint; --jinja is what makes
# chat_template_kwargs reach the template at all.
[ "$(argv_value --reasoning-format)" = "deepseek" ]
argv_value --jinja >/dev/null
grep -qxF -- '--jinja' <<<"$output"
}
@test "the serve script refuses a missing runtime or payload" {
@test "the serve script refuses a missing runtime, GGUF or projector" {
rm -f "$MODEL_DIR/$MM_STUB"
serve_argv
[ "$status" -ne 0 ]
[[ "$output" == *"frank-small: missing"* ]]
rm -f "$RUNTIME_DIR/bin/llama-server"
serve_argv
[ "$status" -ne 0 ]
[[ "$output" == *"frank-small: missing"* ]]
}
@test "the deploy handler gates on the binary and the GGUF, then MainPID-hardens health" {
@test "the deploy handler gates on binary, GGUF and projector, then MainPID-hardens health" {
grep -q 'deploy_llm_small' "$REMOTE_DEPLOY"
grep -q 'LLM_SMALL_RUNTIME' "$REMOTE_DEPLOY"
grep -q 'LLM_SMALL_MODEL_FILE' "$REMOTE_DEPLOY"
grep -q 'LLM_SMALL_MMPROJ' "$REMOTE_DEPLOY"
grep -q 'relink_unit frank-small' "$REMOTE_DEPLOY"
grep -q 'systemctl enable frank-small.service' "$REMOTE_DEPLOY"
grep -q '127.0.0.1:7771/health' "$REMOTE_DEPLOY"