aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / docs / campaigns / open-model-qwen3 / v8-checks.sh
| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # OPEN-MODEL-QWEN3 v8 feature checks (SPEC-v8.md Section 3). CPU only, shell + jq, reads run records only. Required for a v8 |
| 18 | # campaign PASS in addition to the 334 declared rows (they add requirements; no row or threshold changes). |
| 19 | # v8-checks.sh RUN_BASE V7_S3_DIR LAUNCH... |
| 20 | # RUN_BASE the v8 run base (<L>/s3-report.json per launch, R1.reference.json) |
| 21 | # V7_S3_DIR evidence-v7/run/s3-reports (the v7 GB10 records, s3-report-<L>.json) |
| 22 | # C1 shown: attempt 1 shows nothing; attempt k>1 shows exactly attempt k-1's reply (shown_refused_text_sha256 == its |
| 23 | # text_sha256) when attempt k-1 was refused with a reply, and nothing after a timeout or an error. |
| 24 | # C2 never kept: a launch has at most one parsed attempt, it is the last one, and its reply equals no refused reply of the launch. |
| 25 | # C3 limits: at most 3 attempts, numbered 1..n. |
| 26 | # C4 replay: R1.reference.json says allen "default" and its prompt_tokens and prompt_ids_sha256 equal the accepted R1 attempt's |
| 27 | # (exact token identity; the declared row R1-P checks the same pair). |
| 28 | # C5 unchanged: attempt 1's prompt_tokens and prompt_ids_sha256 equal the v7 record of the same launch (only retries changed). |
| 29 | # N1 has no model attempt (refused before any model call): C1 to C3 hold vacuously, C5 requires both records to have no attempt. |
| 30 | # Prints one line per failure and "V8 CHECKS PASS" or "V8 CHECKS FAIL"; exit 0 or 1; exit 2 on usage. |
| 31 | set -u |
| 32 | BASE=${1:?RUN_BASE}; V7=${2:?V7_S3_DIR}; shift 2; [ $# -gt 0 ] || { echo "usage: v8-checks.sh RUN_BASE V7_S3_DIR LAUNCH..." >&2; exit 2; } |
| 33 | fail=0; bad() { echo "FAIL $*"; fail=1; } |
| 34 | for L in "$@"; do |
| 35 | S=$BASE/$L/s3-report.json; O=$V7/s3-report-$L.json |
| 36 | [ -f "$S" ] || { bad "$L: no s3-report.json"; continue; } |
| 37 | A=$(jq -c '.proposal_attempts // []' "$S") |
| 38 | # C1 |
| 39 | jq -r '. as $a | range(0; length) as $k | $a[$k] as $x |
| 40 | | (if $k == 0 then null |
| 41 | elif ($a[$k-1].outcome == "refused" and ($a[$k-1].text_sha256 // null) != null) then $a[$k-1].text_sha256 |
| 42 | else null end) as $want |
| 43 | | select(($x.shown_refused_text_sha256 // null) != $want) |
| 44 | | "attempt \($x.attempt) shown=\($x.shown_refused_text_sha256 // "none") expected=\($want // "none")"' <<<"$A" | |
| 45 | while read -r m; do echo "FAIL $L C1 $m"; done | grep . && fail=1 |
| 46 | # C2 |
| 47 | jq -e '([.[] | select(.outcome == "parsed")] | length) as $p | (last // {}) as $z |
| 48 | | ($p == 0) or ($p == 1 and ($z.outcome == "parsed") |
| 49 | and ([.[] | select(.outcome == "refused") | .text_sha256] | index($z.text_sha256) | not))' <<<"$A" >/dev/null || |
| 50 | bad "$L C2: more than one parsed attempt, a parsed attempt that is not last, or an accepted reply equal to a refused one" |
| 51 | # C3 |
| 52 | jq -e 'length <= 3 and ([.[].attempt] == [range(1; length + 1)])' <<<"$A" >/dev/null || bad "$L C3: attempts $(jq -c '[.[].attempt]' <<<"$A")" |
| 53 | # C5 |
| 54 | if [ -f "$O" ]; then |
| 55 | n8=$(jq -c '[.[0] // {} | .prompt_tokens, .prompt_ids_sha256]' <<<"$A"); n7=$(jq -c '[.proposal_attempts[0]? // {} | .prompt_tokens, .prompt_ids_sha256]' "$O") |
| 56 | [ "$n8" = "$n7" ] || bad "$L C5: attempt 1 prompt $n8, v7 $n7" |
| 57 | else bad "$L C5: no v7 record $O"; fi |
| 58 | # C4 |
| 59 | if [ "$L" = R1 ]; then |
| 60 | R=$BASE/R1.reference.json |
| 61 | if [ -f "$R" ]; then |
| 62 | acc=$(jq -c '[.[] | select(.outcome == "parsed")] | last // {} | [.prompt_tokens, .prompt_ids_sha256]' <<<"$A") |
| 63 | ref=$(jq -c '[.prompt_tokens, .prompt_ids_sha256]' "$R") |
| 64 | [ "$(jq -r '.allen // "missing"' "$R")" = default ] || bad "R1 C4: reference allen=$(jq -r '.allen // "missing"' "$R"), expected default" |
| 65 | [ "$acc" = "$ref" ] || bad "R1 C4: accepted attempt prompt $acc, CPU reference $ref" |
| 66 | else bad "R1 C4: no R1.reference.json"; fi |
| 67 | fi |
| 68 | done |
| 69 | [ $fail = 0 ] && echo "V8 CHECKS PASS" || echo "V8 CHECKS FAIL" |
| 70 | exit $fail |