* scripts/e2e/decode/draftvocab-ab.sh: speedtrain3-ab shape, one binary in every arm, counterbalanced base/en order, arms dv-base, dv-en, dv-en-eqslots; spec-stats give tokens per round, accepted/offered and the accepted-length histogram; validity rejects fallback, missing or unexpected draft-vocab log lines * scripts/e2e/decode/draftvocab-id.sh: teacher-forced replay with LELEKA_ORIGINAL_SERVE_RT_DIR set (the older identity jobs draft over the full head), A/A floor, en against default, optional LELEKA_SPEC=3 control * docs/experiments/2026-10-30-draft-vocab-en.md: what upstream does (format, digests, selection, default off), our status, the port, expectations, what is not verified Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
100 lines
8.4 KiB
Bash
100 lines
8.4 KiB
Bash
#!/usr/bin/env bash
|
|
# Draft-vocab identity gate: the opt-in English draft subset (LELEKA_DRAFT_VOCAB, upstream draft_vocab_en.bin, 40,525 ids) against the default subset (rt/draft_vocab.bin, 106,299 ids).
|
|
# HOLDER JOB (copy of speedtrain3-id.sh): teacher-forced replay of the 256k-class capture night5-long-256k (5 requests, recorded replies, decode capped at 48 tokens each), production shape,
|
|
# top-16 logprobs of every row, STATIC tier (ADAPT_EVERY=0), EQUAL FIXED slot count (EXPERT_SLOTS=8000, per-layer), seed OFF, fixed window LELEKA_SPEC=4, ONE test binary
|
|
# (dt/rt-draftvocab, the leleka-runtime lib test binary of claude/draft-vocab) for every process, so the only variable is LELEKA_DRAFT_VOCAB.
|
|
# LELEKA_ORIGINAL_SERVE_RT_DIR is set in EVERY process: without it the replay stack drafts over the full 248k-row head (no draft_vocab.bin is read at all), which is what the earlier
|
|
# identity jobs (speedtrain3-id.sh etc.) did and is NOT the product path (`--mtp-rt-dir`, as in run-e2e.sh); with it the base arm drafts over the default 106k subset.
|
|
# p1 idBase LELEKA_DRAFT_VOCAB unset, two identical arms I1 I2 (the A/A noise floor, expected 0)
|
|
# p2 idEn LELEKA_DRAFT_VOCAB=<asset> (40,525 ids), two arms I1 I2
|
|
# p3 idSpec3 (only with WITH_CONTROL=1) base with LELEKA_SPEC=3: a window-shape change that touches no weights, the yardstick for "what a different draft/window mix does to the rounding class"
|
|
# The draft only proposes and the verifier decides, so the committed tokens do not depend on the subset in principle. The rows a window verifies DO depend on which draft tokens it holds (the rejected
|
|
# suffix differs), and the batched kernels may round a row differently with different companions; so this gate asks: on every forced row whose context is common (q_pair keys a row by position and the
|
|
# inputs up to it), is the top-16 row identical, and if not, how large is d_top1 against the A/A control and against the LELEKA_SPEC=3 control, and are there argmax flips (must be 0). q_tail_gate.py
|
|
# gives p99 / max / flip rate per process against the recorded tail. Expected: identical or rounding-level, 0 flips; any flip is a finding, not a pass.
|
|
# Accepted drafts per round and tokens per round come from LELEKA_SPEC_STATS=1 (DBG spec-stats lines in the .full logs); the replay does not measure speed.
|
|
# ~8 GPU-min a process, 2 processes (+1 with WITH_CONTROL=1), one at a time under gpu.lock; about 20 min (30 with the control).
|
|
# Install: cp scripts/e2e/decode/draftvocab-id.sh /data/leleka-e2e/decode/dt/jobs/draftvocab-id.sh; stub in ~/work/gpu-runs/holder2/jobs/draftvocab-id.sh (exec bash that file); one line in jobs/PRIORITY.
|
|
set -uo pipefail
|
|
LOCK=/data/leleka-e2e/gpu.lock
|
|
D=/data/leleka-e2e/decode/dt
|
|
O=/data/leleka-e2e/runs/draftvocab-id
|
|
mkdir -p $O
|
|
export LD_LIBRARY_PATH=$HOME/cuda-toolkits/cublas-12.9.1.4/lib:$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-}
|
|
A=$HOME/work/leleka/models/leleka-gates/assets
|
|
G=$HOME/work/gpu-runs
|
|
CAP=/data/leleka-e2e/sm120/capture
|
|
export LELEKA_STRA169_KAR_PROVENANCE=$A/qwen-iq3-s-l2-v4.kar.provenance.json
|
|
export LELEKA_STRA169_IQ3S_SHARD0=$A/model/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf
|
|
export LELEKA_STRA169_IQ3S_SHARD1=$A/model/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf
|
|
export LELEKA_STRA169_MTP_PACK=$A/data/mtp-rt LELEKA_STRA169_MTP_STAGING=$G/mtp-staging-own LELEKA_ORIGINAL_SERVE_BUDGET_GIB=30
|
|
export LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.55
|
|
export LELEKA_SMOKE_PROMPT_CACHE=0 LELEKA_SERVE_PROFILE=1 LELEKA_GRAPH_EXEC_REUSE=off
|
|
export LELEKA_ORIGINAL_SERVE_EXPERT_PROFILE=/data/leleka-e2e/decode/assets/expert-profile-upstream.bin
|
|
export LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS=8000 LELEKA_CHAIN=all
|
|
export LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0 LELEKA_ORIGINAL_SERVE_SEED=off LELEKA_ORIGINAL_SERVE_CPU_WORKERS=1 LELEKA_SPEC=4 LELEKA_SPEC_SUFFIX=0
|
|
export LELEKA_ORIGINAL_SERVE_RT_DIR=$A/data/mtp-rt LELEKA_SPEC_STATS=1 # the product path drafts over rt/draft_vocab.bin; see the header
|
|
VOCAB_EN=/data/leleka-e2e/decode/assets/draft_vocab_en.bin
|
|
VOCAB_EN_SHA=369151522226a5edaa5f12cfd1e2ae7db8f4fbdbd222f3dcf327dced9597fb25 # upstream Strata data/draft_vocab_en.bin (41cf05a0, v0.2.7.1, v0.2.8)
|
|
VOCAB_DEF_SHA=b1e1d3a7a9e4bf862dcd5923ce661fb59bbd07907e594df5cf86a62ac235cb91 # upstream data/draft_vocab.bin = $A/data/mtp-rt/draft_vocab.bin
|
|
WITH_CONTROL=${WITH_CONTROL:-0}
|
|
unset LELEKA_DRAFT_VOCAB
|
|
unset LELEKA_SERVE_DRAFT_AFTER_COMMIT LELEKA_PROMPT_EMBED_ALIAS LELEKA_VRAM_LEDGER LELEKA_DENSE_SLAB
|
|
if [ ! -e "$VOCAB_EN" ] && [ -r "$HOME/work/vanilla-strata/control/data/draft_vocab_en.bin" ]; then # read-only source of the copy
|
|
cp "$HOME/work/vanilla-strata/control/data/draft_vocab_en.bin" "$VOCAB_EN.tmp" && mv "$VOCAB_EN.tmp" "$VOCAB_EN"
|
|
fi
|
|
[ "$(sha256sum "$VOCAB_EN" 2>/dev/null | cut -d' ' -f1)" = "$VOCAB_EN_SHA" ] || { echo "draft_vocab_en.bin digest is not $VOCAB_EN_SHA" >&2; exit 3; }
|
|
[ "$(sha256sum "$A/data/mtp-rt/draft_vocab.bin" | cut -d' ' -f1)" = "$VOCAB_DEF_SHA" ] || { echo "mtp-rt/draft_vocab.bin digest is not $VOCAB_DEF_SHA" >&2; exit 3; }
|
|
for f in $D/rt-draftvocab $D/tools/q_pair.py $D/tools/q_tail_gate.py $CAP/night5-long-256k; do
|
|
[ -e "$f" ] || { echo "missing $f" >&2; exit 3; }
|
|
done
|
|
sha256sum $D/rt-draftvocab $VOCAB_EN
|
|
shape="reply@8192/8192!orig!fast!nocluster!store!qpf!gpool!mspan"
|
|
run() { # label bin extra-env arms
|
|
BIN=$D/$2
|
|
got=0
|
|
for i in $(seq 1 1080); do
|
|
if mkdir $LOCK 2>/dev/null; then echo "draftvocab identity $1 $(date -u +%FT%TZ)" >$LOCK/owner; got=1; break; fi
|
|
sleep 5
|
|
done
|
|
[ $got = 1 ] || { echo "GPU lock held by: $(cat $LOCK/owner 2>/dev/null)"; return 3; }
|
|
avail=$(awk '/MemAvailable/{print int($2/1048576)}' /proc/meminfo); echo "=== $1 bin=$2 extra=[$3] MemAvailable GiB: $avail"; free -g | sed -n 2,3p
|
|
if [ "$avail" -lt 60 ]; then echo "abort: less than 60 GiB available"; rm -f $LOCK/owner; rmdir $LOCK; return 4; fi
|
|
date -u +%FT%TZ
|
|
env $3 LELEKA_ORIGINAL_SERVE_REPLAY=yes LELEKA_BRINGUP_TRACE=1 LELEKA_REPLAY_DIR=$CAP/night5-long-256k LELEKA_PREFIX_TRACE=1 LELEKA_REPLAY_PREFIX_MIB=6000 LELEKA_TRACE_PREFILL_R=1 LELEKA_TRACE_LOGPROBS=16 \
|
|
LELEKA_REPLAY_MAX_NEW=48 LELEKA_REPLAY_FORCE=1 LELEKA_REPLAY_ARMS=$4 \
|
|
nice -n 5 $BIN --ignored --exact --test-threads=1 --nocapture backend::original_serve_replay::original_serve_replay_smoke > $O/$1.full 2>&1
|
|
echo "rc=$? label=$1"; date -u +%FT%TZ
|
|
grep -a -E "^REPLAY|test result|panicked|FAILED|expert cache [0-9]+ slots|leleka-serve dense weights" $O/$1.full | cut -c1-300 | tail -10
|
|
rm -f $LOCK/owner; rmdir $LOCK 2>/dev/null
|
|
sleep 15
|
|
}
|
|
run idBase rt-draftvocab "LELEKA_X=1" "I1=$shape,I2=$shape"
|
|
run idEn rt-draftvocab "LELEKA_DRAFT_VOCAB=$VOCAB_EN" "I1=$shape,I2=$shape"
|
|
[ "$WITH_CONTROL" = 1 ] && run idSpec3 rt-draftvocab "LELEKA_SPEC=3" "I1=$shape,I2=$shape"
|
|
T=$D/tools
|
|
PROCS="idBase idEn"; [ "$WITH_CONTROL" = 1 ] && PROCS="$PROCS idSpec3"
|
|
for p in $PROCS; do echo "== q_tail_gate $p"; python3 $T/q_tail_gate.py $O/$p.full $CAP/night5-long-256k 2>&1 | tail -12; done
|
|
echo "== draft-vocab log lines (idEn must show subset=en ids=40525 and no FALLBACK; idBase none)"
|
|
for p in $PROCS; do echo "-- $p"; grep -a -h "draft-vocab:" $O/$p.full | sort | uniq -c | cut -c1-250; done
|
|
echo "== tokens per round per process (DBG spec-stats, summed over the requests of both arms)"
|
|
for p in $PROCS; do
|
|
echo "-- $p"; grep -a -h "DBG spec-stats" $O/$p.full | awk '{for(i=1;i<=NF;i++){split($i,a,"=");if(a[1]=="rounds")r+=a[2];if(a[1]=="tokens")t+=a[2]}} END{printf "rounds %d tokens %d tokens/round %.3f\n",r,t,t/(r?r:1)}'
|
|
done
|
|
WITH_CONTROL=$WITH_CONTROL python3 - <<'ENDPY'
|
|
import os, sys
|
|
O = "/data/leleka-e2e/runs/draftvocab-id"
|
|
sys.path.insert(0, "/data/leleka-e2e/decode/dt/tools")
|
|
import q_pair
|
|
procs = ["idBase", "idEn"] + (["idSpec3"] if os.environ.get("WITH_CONTROL") == "1" else [])
|
|
rows = {p: [q_pair.rows_of("%s/%s.full" % (O, p), i) for i in (0, 1)] for p in procs}
|
|
q_pair.compare(rows["idBase"][0], rows["idBase"][1], "default subset, arm1 against arm0 (A/A noise floor)")
|
|
q_pair.compare(rows["idEn"][0], rows["idEn"][1], "en subset, arm1 against arm0 (A/A)")
|
|
q_pair.compare(rows["idBase"][0], rows["idEn"][0], "en subset against default subset, arm0")
|
|
q_pair.compare(rows["idBase"][1], rows["idEn"][1], "en subset against default subset, arm1")
|
|
if "idSpec3" in rows:
|
|
q_pair.compare(rows["idBase"][0], rows["idSpec3"][0], "CONTROL: LELEKA_SPEC=3 against LELEKA_SPEC=4, default subset, arm0 (a window-shape change without any weights change)")
|
|
ENDPY
|
|
sha256sum $O/*.full
|
|
date -u +%FT%TZ
|