71 lines
2.6 KiB
Bash
Executable file
71 lines
2.6 KiB
Bash
Executable file
#!/bin/sh
|
|
# 12b_servability_gate.sh — permanent 12B servability detection gate.
|
|
#
|
|
# C-path reality (documented unsupported, NOT silently shippable): Gemma-4-12B
|
|
# at the only manifest-allowed Q4_0 grade produces the degenerate high-ID logits
|
|
# signature (argmax in the ~236xxx band) — proven with oracle-validated
|
|
# independent math (artifacts/2026-08-30-12b-diagnosis/DIAGNOSIS.md). Correct
|
|
# 12B serving requires Q8_0 projection support (engine task: "12B serving:
|
|
# Q8_0 projection support + config/detection router").
|
|
#
|
|
# This ctest drives scripts/remediate-12b.sh --verify as the servability
|
|
# DETECTOR (sane = argmax < 200000). It asserts the classifier runs and the
|
|
# status is reported loudly:
|
|
# - model absent -> SKIP (exit 0)
|
|
# - classified sane -> PASS "servable" (future: after Q8_0+router land)
|
|
# - classified as the known degenerate 236xxx signature -> PASS with an
|
|
# explicit UNSUPPORTED notice (documented, not silently shipped)
|
|
# - verifier error -> FAIL (exit 1)
|
|
#
|
|
# Usage: 12b_servability_gate.sh [MODEL.gguf]
|
|
# (no arg: auto-locate GEM_MODEL_DIR/.state/models gemma-4-12B-it-Q4_0.gguf)
|
|
set -eu
|
|
|
|
root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
|
|
model=${1:-}
|
|
if [ -z "$model" ]; then
|
|
for d in ${GEM_MODEL_DIR:-} "$root/.state/models"; do
|
|
[ -n "$d" ] || continue
|
|
candidate="$d/gemma-4-12B-it-Q4_0.gguf"
|
|
if [ -r "$candidate" ]; then
|
|
model=$candidate
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
if [ -z "$model" ] || [ ! -r "$model" ]; then
|
|
echo "12B servability gate: SKIP (no 12B Q4_0 model present)"
|
|
exit 0
|
|
fi
|
|
|
|
out=$("$root/scripts/remediate-12b.sh" --verify "$model" --prompt Hello 2>/dev/null || true)
|
|
parsed=$(printf '%s' "$out" | python3 -c '
|
|
import json, sys
|
|
try:
|
|
d = json.load(sys.stdin)
|
|
print("sane" if d.get("pass") else "degenerate", d.get("model", {}).get("argmax", "?"))
|
|
except Exception:
|
|
print("parse-error ?")
|
|
' || echo 'parse-error ?')
|
|
status=$(printf '%s' "$parsed" | awk '{print $1}')
|
|
argmax=$(printf '%s' "$parsed" | awk '{print $2}')
|
|
|
|
echo "12B servability gate: model=$model"
|
|
case "$status" in
|
|
sane)
|
|
echo "PASS: 12B classified SERVABLE (argmax $argmax < 200000)."
|
|
exit 0
|
|
;;
|
|
degenerate)
|
|
echo "UNSUPPORTED (documented): 12B Q4_0 logits fall in the degenerate"
|
|
echo "high-ID band (argmax $argmax). Correct 12B serving requires Q8_0"
|
|
echo "projection support + the config/detection router (engine task)."
|
|
echo "PASS as documented-unsupported (not silently shipped)."
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "FAIL: servability verifier could not classify $model"
|
|
echo "$out"
|
|
exit 1
|
|
;;
|
|
esac
|