diff --git a/docs/deploy.md b/docs/deploy.md index a21c5ac0..c9045574 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -107,6 +107,7 @@ The files live in [`deploy/rust-runtime/profiles/`](../deploy/rust-runtime/profi | `rtx5090-32g` | sm_12x, >= 30 GB VRAM | 32,819,404,800 B = 31,299 MiB (needs that much free at start: 31,299 of the 32,110 MiB an idle card reports; was 30 GiB, see [vram-footprint-5090](experiments/vram-footprint-5090.md)) | 262,144 | sealed **sparse** memfd (`memfd_extents: ple_only`): only the 16.0 GB of the archive the serve path reads (the PLE rows, 2 extents), holes elsewhere; read O_DIRECT, so no page-cache copy | `resident`: page-locked RAM copy (50.3 GB) | 100 GiB / 74 GB (113 GB for `memfd_extents: full`; 58 GB when `--kar-fd` supplies the archive) | one resident copy of every model byte in host RAM (`kar-sparse-memfd.md`) | | `rtx3080-16g` | sm_80..119, 14-24 GB VRAM | 15 GiB (needs 14,500 MiB free) | 8,192 | read-only file | `mapped`: read-only mappings of shard 0 | 22 GiB / 10 GiB; advice `.wslconfig memory=32GB` | VRAM expert tier: `up` fetches `ASSETS/data/expert-profile.bin` (pinned SHA-256 `8f59b4aa...388975baf`; `--no-expert-tier` to run without) | | `rtx5090-32g-file` (experimental, never auto-selected: `--profile rtx5090-32g-file`) | none (explicit name only) | as `rtx5090-32g` | 262,144 | read-only file (`kar_source: file`; no memfd, no holder; start reads about 1 MB of it when its verification stamp is current) | `resident` | 64 GiB / 62 GB (the 55 GB archive is page cache, not a charge) | as `rtx5090-32g` except an explicit `prefix_cache_mib` 6144; [`kar-file-source.md`](kar-file-source.md): what the file form reads, its integrity guarantees, the A/B (`scripts/e2e/decode/kar-file-ab.sh`, not run) | +| `rtx5090-32g-gguf-ple` (experimental A/B arm, never auto-selected: `--profile rtx5090-32g-gguf-ple`) | none (explicit name only) | as `rtx5090-32g` | 262,144 | **no KAR archive** (`kar_source: none`): not required, checked, sealed or passed; the engine loads `qwen4exp-native-mtp-v1` and reads the PLE rows from GGUF shard 1 (page cache, `LELEKA_PLE_DIRECT=0`) | `resident` | 64 GiB / 62 GB (the 28.8 GB PLE table is page cache) | as `rtx5090-32g` except an explicit `prefix_cache_mib` 6144, no memfd lock/heal; `--kar-fd` is refused; [`experiments/kar-off-ab-5090.md`](experiments/kar-off-ab-5090.md): the paired speed and quality A/B against `rtx5090-32g` (no claim before that page says so) | Both profiles also carry a `memory` section (prefix cache `auto`, soft/hard floors 4096/2048 MiB, reserve, lock and heal of the sealed memfd): the engine sizes its caches from the memory left after the fixed footprint, sheds and refuses under pressure, and refuses to start with numbers when the footprint does not fit ([`memory-safety.md`](memory-safety.md)). The unit sets `LimitMEMLOCK=infinity`, which is what lets the lock keep the 55 GB memfd out of swap. diff --git a/scripts/e2e/kar-off/kar_off_quality_job.sh b/scripts/e2e/kar-off/kar_off_quality_job.sh new file mode 100644 index 00000000..4221313f --- /dev/null +++ b/scripts/e2e/kar-off/kar_off_quality_job.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# KAR level-2 PLE against GGUF PLE in the Leleka serve stack, teacher forced (docs/experiments/kar-off-ab-5090.md section "Quality (a)"; the method of docs/quality-gate.md section 1 and 6). +# HOLDER JOB (the KAR arm inherits the sealed memfd; the GGUF arm does not need it: LELEKA_REPLAY_GGUF_PLE=1 binds the model without any archive). +# Both arms run the SAME test executable (rt-kar-off = the replay smoke of this branch), the same capture (quality-245k data/cap-both: five prompts of 45k-243k tokens, each with the recorded +# Original reply and the recorded port reply, 300 tokens) forced along the recorded text, top-16 log-probabilities of every row (LELEKA_TRACE_LOGPROBS=16), STATIC expert tier (adapt-every 0: +# placement independent of copy timing), shipped serve shape (prefix cache reply @ 8192). Each run has two twin arms (ship, shipb), so the A/A difference of one PLE source is the noise floor. +# KQ_ARMS which PLE sources, default "kar gguf" KQ_OUT result dir (default $K/runs/quality) KQ_MAX_NEW cap on the forced tokens per request (default: all recorded) +set -uo pipefail +K=/data/leleka-e2e/kar-off-ab +Q=/data/leleka-e2e/quality-245k +LOCK=/data/leleka-e2e/gpu.lock +OUT=${KQ_OUT:-$K/runs/quality} +BIN=${KQ_BIN:-$K/incoming/rt-kar-off} +A=$HOME/work/leleka/models/leleka-gates/assets +G=$HOME/work/gpu-runs +mkdir -p "$OUT" +exec > >(tee -a "$OUT/job-$(date -u +%H%M%S).log") 2>&1 +( cd / && sha256sum --quiet -c "$Q/inputs/MANIFEST.sha256" ) || { echo "quality-245k MANIFEST.sha256 check failed"; exit 3; } +[ -x "$BIN" ] || { echo "missing $BIN"; exit 3; } +export LD_LIBRARY_PATH=$HOME/cuda-toolkits/cublas-12.9.1.4/lib:$HOME/cuda-toolkits/13.2.2/lib64:${LD_LIBRARY_PATH:-} +PF='!orig!fast!nocluster!store!qpf!gpool!mspan' +ARMS="ship=reply@8192/8192$PF,shipb=reply@8192/8192$PF" +unset LELEKA_SPEC LELEKA_SPEC_ADAPTIVE LELEKA_SPEC_SUFFIX LELEKA_SPEC_POLICY LELEKA_SERVE_DRAFT_AFTER_COMMIT LELEKA_PROMPT_EMBED_ALIAS LELEKA_VRAM_LEDGER LELEKA_DENSE_SLAB \ + LELEKA_FOOTPRINT_LEGACY LELEKA_SM120_ATTN_DAILY LELEKA_DRAFT_FUSED_COMMIT LELEKA_DRAFT_ROUND LELEKA_ROUTE_TAIL_SKIP LELEKA_REPLAY_GGUF_PLE +for src in ${KQ_ARMS:-kar gguf}; do + O=$OUT/$src; mkdir -p "$O" + [ -s "$O/port.full" ] && grep -aq "test result: ok" "$O/port.full" && { echo "arm $src already done: skipped"; continue; } + DEFAULTS=( + LELEKA_STRA169_KAR_PROVENANCE=$A/qwen-iq3-s-l2-v4.kar.provenance.json + LELEKA_STRA169_IQ3S_SHARD0=$A/model/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00001-of-00002.gguf + LELEKA_STRA169_IQ3S_SHARD1=$A/model/Qwen3.8-Flash-Next-GSQ-RCO-IQ3_S-00002-of-00002.gguf + LELEKA_STRA169_MTP_PACK=$A/data/mtp-rt LELEKA_STRA169_MTP_STAGING=$G/mtp-staging-own LELEKA_ORIGINAL_SERVE_BUDGET_GIB=30 + LELEKA_ORIGINAL_SERVE_EXPERT_PER_LAYER=yes LELEKA_ORIGINAL_SERVE_PCIE_FRAC=0.45 + LELEKA_SMOKE_PROMPT_CACHE=0 LELEKA_SERVE_PROFILE=1 LELEKA_GRAPH_EXEC_REUSE=off + LELEKA_ORIGINAL_SERVE_EXPERT_PROFILE=/data/leleka-e2e/decode/assets/expert-profile-upstream.bin + LELEKA_ORIGINAL_SERVE_RT_DIR=$A/data/mtp-rt + LELEKA_ORIGINAL_SERVE_EXPERT_SLOTS=auto LELEKA_CHAIN=all + LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0 LELEKA_ORIGINAL_SERVE_SEED=off + LELEKA_SM120_ATTN_DAILY_MTP=1 + LELEKA_SPEC_STATS=1 LELEKA_SPEC_TRACE=1 LELEKA_BRINGUP_TRACE=1 LELEKA_PREFIX_TRACE=1 LELEKA_TRACE_PREFILL_R=1 LELEKA_TRACE_LOGPROBS=16 + LELEKA_ORIGINAL_SERVE_REPLAY=yes LELEKA_REPLAY_DIR=$Q/inputs/data/cap-both LELEKA_REPLAY_FORCE=1 "LELEKA_REPLAY_ARMS=$ARMS" LELEKA_REPLAY_PREFIX_MIB=6144 + ) + [ -z "${KQ_MAX_NEW:-}" ] || DEFAULTS+=(LELEKA_REPLAY_MAX_NEW=$KQ_MAX_NEW) + [ "$src" = gguf ] && DEFAULTS+=(LELEKA_REPLAY_GGUF_PLE=1) + got=0 + for _ in $(seq 1 4320); do + if mkdir $LOCK 2>/dev/null; then echo "kar-off-quality $src $(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)"; exit 3; } + avail=$(awk '/MemAvailable/{print int($2/1048576)}' /proc/meminfo) + echo "=== arm $src arms=[$ARMS] MemAvailable GiB: $avail" + if [ "$avail" -lt 55 ]; then echo "abort: less than 55 GiB available"; rm -f $LOCK/owner; rmdir $LOCK 2>/dev/null; exit 4; fi + { date -u +%FT%TZ; uname -r; nvidia-smi --query-gpu=name,driver_version,clocks.max.sm,power.limit --format=csv,noheader; sha256sum "$BIN"; wc -l <"$Q/inputs/MANIFEST.sha256" + printf '%s\n' "${DEFAULTS[@]}" | sed 's/^/ENV /'; } >"$O/header.txt" + echo "start $(date -u +%FT%TZ)" + env "${DEFAULTS[@]}" nice -n 5 "$BIN" --ignored --exact --test-threads=1 --nocapture backend::original_serve_replay::original_serve_replay_smoke >"$O/port.full" 2>&1 + echo "rc=$? arm=$src"; date -u +%FT%TZ + grep -a -E "^REPLAY #|REPLAY PASS|test result|panicked|FAILED|REPLAY-ARM" "$O/port.full" | cut -c1-230 | tail -30 + sha256sum "$O/port.full" + rm -f $LOCK/owner; rmdir $LOCK 2>/dev/null + sleep 15 +done +echo "done" diff --git a/scripts/e2e/kar-off/kar_off_stubs.sh b/scripts/e2e/kar-off/kar_off_stubs.sh new file mode 100644 index 00000000..95b37196 --- /dev/null +++ b/scripts/e2e/kar-off/kar_off_stubs.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# Write the GPU-queue stubs of the KAR on / off study (run ON the server, after kar_off_install.sh) and append them to jobs/PRIORITY (a backup is made first): +# kar_off_stubs.sh smoke|speed|codex|quality [extra KEY=VALUE environment words for the payload] +# smoke window, kar_off_speed_job.sh, order "gguf kar", 2 requests per cell: proves both stacks start, the replay runs and the numbers are readable (about 25 min) +# speed window, kar_off_speed_job.sh, default balanced order (3 passes of each arm, all 59 requests) +# codex window, kar_off_codex_job.sh, default balanced blocks (LELK and LELG, 3 repetitions of both tasks) +# quality HOLDER job (inherits the sealed memfd; the GGUF arm needs none): teacher-forced logit comparison KAR against GGUF PLE, kar_off_quality_job.sh +set -euo pipefail +KIND=${1:?smoke|speed|codex|quality}; shift || true +J=$HOME/work/gpu-runs/holder2/jobs +K=/data/leleka-e2e/kar-off-ab +name=kar-off-$KIND +[ -e "$J/$name.sh" ] && { echo "$J/$name.sh exists"; exit 1; } +case $KIND in + smoke) payload=kar_off_speed_job.sh; env_words="KO_ORDER=\"gguf kar\" KO_MAX=2 KO_OUT=$K/runs/smoke";; + speed) payload=kar_off_speed_job.sh; env_words="KO_OUT=$K/runs/speed";; + codex) payload=kar_off_codex_job.sh; env_words="KO_OUT=$K/runs/codex";; + quality) payload=kar_off_quality_job.sh; env_words="";; + *) echo "unknown kind"; exit 2;; +esac +if [ "$KIND" = quality ]; then + cat > "$J/$name.sh" < "$J/$name.sh" <&-" +touch "$J/STOP" +export $env_words $* +setsid nohup bash $K/tools/kar_off_window.sh $name $payload > $K/window-$name.launch 2>&1 < /dev/null & +echo "$name: window launched" +EOF +fi +cp -p "$J/PRIORITY" "$J/PRIORITY.bak-kar-off-$KIND" +echo "$name" >> "$J/PRIORITY" +echo "queued $name ($payload $env_words $*)"