test(quality): trim the Original jobs to the correctness references

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Pavlo Ratushnyi
2026-10-17 21:28:27 +02:00
co-authored by Claude Sonnet 5.5
parent 0ac97bf63a
commit b978a45e4e
9 changed files with 69 additions and 82 deletions
@@ -1,10 +0,0 @@
set -uo pipefail
# Quality gate job: the Original's logits after the 16,000-token prompt at prefill chunks 4096 and 6144 (job 994 did 8192 and 2048),
# same teacher-forced method (see 994).
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
LONG="--max-context 20480 --kv-resident 20480 --turn-token $(cat $Q/L16.turn) --prompt-cache 1 --prompt-cache-root 0 --prompt-cache-every 0"
orig_run L-c4096 L16 0 "" --prefill 4096 $LONG $(kar_args) --expert-cache 2048 --expert-cache-per-layer --adapt-every 0
orig_run L-c6144 L16 0 "" --prefill 6144 $LONG $(kar_args) --expert-cache 2048 --expert-cache-per-layer --adapt-every 0
date -u +%FT%TZ
@@ -1,11 +0,0 @@
set -uo pipefail
# Quality gate job: symmetric KAR-level-2 vs GGUF PLE comparison in the Original. Each variant's own free greedy paths (K0..K4 = KAR run R1,
# G0..G4 = GGUF run R5) are read under both PLE sources, so neither source is favoured by the tokens it produced itself.
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
COMMON="--prefill 2048 --max-context 4096 --short-read 4096 --prompt-cache 0"
READS=K0,K1,K2,K3,K4,G0,G1,G2,G3,G4
orig_run R7-kar $READS 0 "" $COMMON $(kar_args) --expert-cache 2048 --expert-cache-per-layer --adapt-every 0
orig_run R7-gguf $READS 0 "" $COMMON --expert-cache 2048 --expert-cache-per-layer --adapt-every 0
date -u +%FT%TZ
@@ -1,23 +1,23 @@
set -uo pipefail
# Quality gate job: the Original's logits for the first generated tokens of corpus prompts 0..4 with the prompt read by the BATCHED path
# (the path of a real request; the other reads put the whole path through the verify windows). Per prompt one process:
# path = prompt + up to 40 of the Original's pass-0 tokens, --turn-token = the prompt's last token (absent from those 40), so the prompt
# is read batched up to its last token and the generated part goes through the windows (--short-read 40), where STRATA_LOGPOS logs it.
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
for i in 2 0 3 4 1; do
T=$(python3 - $Q $i <<'PY'
import sys, json
q, i = sys.argv[1], int(sys.argv[2])
meta = json.load(open(f"{q}/cases/meta.json"))[f"O{i}"]
ids = [int(x) for x in open(f"{q}/cases/O{i}.ids").read().split(",")]
n = meta["n_prompt"]; t = ids[n - 1]; gen = ids[n:]
k = min(40, next((j for j, x in enumerate(gen) if x == t), 40))
open(f"{q}/cases/B{i}.ids", "w").write(",".join(map(str, ids[: n + k])))
print(t)
PY
)
orig_run B$i-batched B$i 0 "" --prefill 2048 --max-context 4096 --short-read 40 --turn-token $T --prompt-cache 1 --prompt-cache-root 0 --prompt-cache-every 0 $(kar_args) --expert-cache 2048 --expert-cache-per-layer --adapt-every 0
done
date -u +%FT%TZ
set -uo pipefail
# Quality gate job: the Original's logits for the first generated tokens of corpus prompts 2 and 0 (the Original diverges from itself at token 4 / 6 there) with the prompt read by the BATCHED path
# (the path of a real request; the other reads put the whole path through the verify windows). Per prompt one process:
# path = prompt + up to 40 of the Original's pass-0 tokens, --turn-token = the prompt's last token (absent from those 40), so the prompt
# is read batched up to its last token and the generated part goes through the windows (--short-read 40), where STRATA_LOGPOS logs it.
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
for i in 2 0; do
T=$(python3 - $Q $i <<'PY'
import sys, json
q, i = sys.argv[1], int(sys.argv[2])
meta = json.load(open(f"{q}/cases/meta.json"))[f"O{i}"]
ids = [int(x) for x in open(f"{q}/cases/O{i}.ids").read().split(",")]
n = meta["n_prompt"]; t = ids[n - 1]; gen = ids[n:]
k = min(40, next((j for j, x in enumerate(gen) if x == t), 40))
open(f"{q}/cases/B{i}.ids", "w").write(",".join(map(str, ids[: n + k])))
print(t)
PY
)
orig_run B$i-batched B$i 0 "" --prefill 2048 --max-context 4096 --short-read 40 --turn-token $T --prompt-cache 1 --prompt-cache-root 0 --prompt-cache-every 0 $(kar_args) --expert-cache 2048 --expert-cache-per-layer --adapt-every 0
done
date -u +%FT%TZ
@@ -1,35 +1,33 @@
set -uo pipefail
# Quality gate: long-context retrieval (needle: "the secret passcode is 4817-QX") at 100k and 180k tokens on the unmodified Original, same token ids
# as jobs 915/916 (long-180k/prompt{100000,180000}.ids). Phase 1: free greedy answer of 600 tokens per prompt (batched prefill chunk 8192, int8 KV
# streamed, tier static). Phase 2 (new process): teacher-forced read of prompt + the first K<=100 answer tokens, the batched prompt then the answer
# through the verify windows (--turn-token = the prompt's last token), top-16 logprobs per row. Also writes long-force/answer<N>.ids for the port.
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
L=$G/long-180k; F=$Q/long-force; mkdir -p $F
T=$(python3 -c "print(open('$L/prompt100000.ids').read().strip().split(',')[-1])")
python3 - $L $Q/ret1.txt <<'PY'
import sys
L, out = sys.argv[1:3]
open(out, "w").write("".join(f"GEN 600 {open(f'{L}/prompt{n}.ids').read().strip()}\n" for n in (100000, 180000)) + "QUIT\n")
PY
COMMON="--prefill 8192 --max-context 262144 --kv-resident 20480 --prompt-cache 1 --prompt-cache-root 0 --prompt-cache-every 0 --turn-token $T --short-read 128 --expert-cache 2048 --expert-cache-per-layer --adapt-every 0"
orig_serve RET-orig-free $Q/ret1.txt $COMMON $(kar_args)
python3 - $L $Q/runs/RET-orig-free/out.txt $T $F $Q/ret2.txt <<'PY'
import sys
L, out, T, F, req = sys.argv[1:6]; T = int(T)
seqs, cur = [], []
for line in open(out):
if line.startswith("T "): cur.append(int(line.split()[1]))
elif line.startswith("DONE"): seqs.append(cur); cur = []
lines = []
for n, ans in zip((100000, 180000), seqs):
k = min(100, len(ans), next((j for j, x in enumerate(ans) if x == T), 10**9))
open(f"{F}/answer{n}.ids", "w").write(",".join(map(str, ans[:k])))
open(f"{F}/answer{n}.full", "w").write(",".join(map(str, ans)))
print(n, "answer tokens", len(ans), "forced K", k)
lines.append("GEN 1 " + open(f"{L}/prompt{n}.ids").read().strip() + "," + ",".join(map(str, ans[:k])))
open(req, "w").write("\n".join(lines) + "\nQUIT\n")
PY
orig_serve RET-orig-read $Q/ret2.txt $COMMON $(kar_args)
date -u +%FT%TZ
set -uo pipefail
# Quality gate: long-context retrieval (needle: "the secret passcode is 4817-QX") at 100k and 180k tokens on the unmodified Original, same token ids
# as jobs 915/916 (long-180k/prompt{100000,180000}.ids). Phase 1: free greedy answer of 600 tokens per prompt (batched prefill chunk 8192, int8 KV
# streamed, tier static). Writes long-force/answer<N>.ids (first K<=100 tokens) for the port and ret2.txt (the teacher-forced read request: job 9965, only queued if the engines' answers differ).
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
L=$G/long-180k; F=$Q/long-force; mkdir -p $F
T=$(python3 -c "print(open('$L/prompt100000.ids').read().strip().split(',')[-1])")
python3 - $L $Q/ret1.txt <<'PY'
import sys
L, out = sys.argv[1:3]
open(out, "w").write("".join(f"GEN 600 {open(f'{L}/prompt{n}.ids').read().strip()}\n" for n in (100000, 180000)) + "QUIT\n")
PY
COMMON="--prefill 8192 --max-context 262144 --kv-resident 20480 --prompt-cache 1 --prompt-cache-root 0 --prompt-cache-every 0 --turn-token $T --short-read 128 --expert-cache 2048 --expert-cache-per-layer --adapt-every 0"
orig_serve RET-orig-free $Q/ret1.txt $COMMON $(kar_args)
python3 - $L $Q/runs/RET-orig-free/out.txt $T $F $Q/ret2.txt <<'PY'
import sys
L, out, T, F, req = sys.argv[1:6]; T = int(T)
seqs, cur = [], []
for line in open(out):
if line.startswith("T "): cur.append(int(line.split()[1]))
elif line.startswith("DONE"): seqs.append(cur); cur = []
lines = []
for n, ans in zip((100000, 180000), seqs):
k = min(100, len(ans), next((j for j, x in enumerate(ans) if x == T), 10**9))
open(f"{F}/answer{n}.ids", "w").write(",".join(map(str, ans[:k])))
open(f"{F}/answer{n}.full", "w").write(",".join(map(str, ans)))
print(n, "answer tokens", len(ans), "forced K", k)
lines.append("GEN 1 " + open(f"{L}/prompt{n}.ids").read().strip() + "," + ",".join(map(str, ans[:k])))
open(req, "w").write("\n".join(lines) + "\nQUIT\n")
PY
date -u +%FT%TZ
@@ -0,0 +1,12 @@
set -uo pipefail
# Quality gate: phase 2 of the retrieval check, only queued when the port's answer differs from the Original's (see 9964/9966): the Original reads
# prompt + the first K<=100 answer tokens (ret2.txt written by 9964): batched prompt (--turn-token = the prompt's last token), the answer through the
# verify windows, top-16 logprobs per row (STRATA_LOGPOS).
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header
L=$G/long-180k
T=$(python3 -c "print(open('$L/prompt100000.ids').read().strip().split(',')[-1])")
COMMON="--prefill 8192 --max-context 262144 --kv-resident 20480 --prompt-cache 1 --prompt-cache-root 0 --prompt-cache-every 0 --turn-token $T --short-read 128 --expert-cache 2048 --expert-cache-per-layer --adapt-every 0"
orig_serve RET-orig-read $Q/ret2.txt $COMMON $(kar_args)
date -u +%FT%TZ
@@ -1,10 +1,8 @@
set -uo pipefail
# Quality gate job 8: the port's logits after the 16,000-token prompt at prefill chunks 8192, 2048, 4096 and 6144 (static tier), windows traced.
# Quality gate job 8: the port's logits after the 16,000-token prompt at prefill chunks 8192 and 2048 (static tier), windows traced.
source ~/work/gpu-runs/quality/q-common.sh
mem_ok 60 || { echo "abort: MemAvailable < 60 GiB"; exit 3; }
header; sha256sum $BIN
port_long PL-c8192 $PORT_TIER LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0 LELEKA_ORIGINAL_SERVE_SEED=off LELEKA_ORIGINAL_SERVE_CAPACITY=8192
port_long PL-c2048 $PORT_TIER LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0 LELEKA_ORIGINAL_SERVE_SEED=off LELEKA_ORIGINAL_SERVE_CAPACITY=2048
port_long PL-c4096 $PORT_TIER LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0 LELEKA_ORIGINAL_SERVE_SEED=off LELEKA_ORIGINAL_SERVE_CAPACITY=4096
port_long PL-c6144 $PORT_TIER LELEKA_ORIGINAL_SERVE_ADAPT_EVERY=0 LELEKA_ORIGINAL_SERVE_SEED=off LELEKA_ORIGINAL_SERVE_CAPACITY=6144
date -u +%FT%TZ