interplane.Get Omega
Read in your language

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

branch main Branches Tags History

aien-sovereign-core-mv / docs / inference / evidence / adr0004-step0-baseline-20261015 / door-window.sh

76 lines · 3353 bytes Raw Blame History
1#!/usr/bin/env bash
2# ADR 0004 step 0, G30-door baseline: the door's served path (SamplingObserver, full logits read
3# back every decode step) on own30b_check's 4 prompts with one fixed seed. Run under one
4# quietlock hold. Starts aien-serve-http on PORT (never 18091, never 18092), sends the 4 prompts
5# twice (passes 1 and 2), stops it with SIGTERM, starts a second process and sends them once more
6# (pass 3), so the receipt shows the tokens repeat inside one process and across processes.
7# door-window.sh <aien-serve-http> <evidence-dir> [port]
8# Request: one user message, seed 1, temperature 1.0, top_p 1.0, top_k 0 (sampling-gate.sh
9# gate (a) settings: the whole distribution is sampled, so any logits change can move a token),
10# max_tokens 64, stream false. Reply digest = sha256 of the exact content string (jq -j).
11set -uo pipefail
12BIN=$1 EV=$2 PORT=${3:-18103}
13case "$PORT" in 18091 | 18092) echo "door-window: port $PORT is reserved" >&2; exit 2 ;; esac
14MODEL=$HOME/models/qwen3-30b-a3b-instruct-2507-fp8
15MID=qwen3-30b-a3b-instruct-2507
16HERE=$(cd "$(dirname "$0")" && pwd)
17PROMPTS=$HERE/prompts.json
18mkdir -p "$EV"
19ts() { date -u +%Y-%m-%dT%H:%M:%SZ; }
20log() { echo "$(ts) $*" | tee -a "$EV/window.log"; }
21CUR=
22cleanup() { [ -n "$CUR" ] && kill -0 "$CUR" 2>/dev/null && kill -TERM "$CUR" && wait "$CUR"; }
23trap cleanup EXIT
24
25start() { # session name
26 if ss -ltn | grep -q "127.0.0.1:$PORT "; then log "port $PORT busy"; return 1; fi
27 log "start $1: $BIN --engine omega --model-dir $MODEL --port $PORT (env: no AIEN_* or OWN30B_* set)"
28 env -u AIEN_OMEGA_SPIN_US -u OWN30B_DECODE_GRAPH "$BIN" --engine omega --model-dir "$MODEL" --port "$PORT" \
29 > "$EV/$1.server.log" 2>&1 &
30 CUR=$!
31 local i
32 for i in $(seq 1 300); do
33 if curl -sf "http://127.0.0.1:$PORT/v1/models" > /dev/null 2>&1; then
34 log "start $1: ready, pid $CUR ($(grep -m1 'ready in' "$EV/$1.server.log" | grep -o 'ready in [0-9.]* s'))"
35 return 0
36 fi
37 kill -0 "$CUR" 2>/dev/null || { log "start $1: server exited"; return 1; }
38 sleep 1
39 done
40 log "start $1: not ready in 300 s"
41 return 1
42}
43stop() {
44 kill -TERM "$CUR"
45 wait "$CUR"
46 log "stop: pid $CUR exit $?"
47 CUR=
48}
49pass() { # pass number
50 local n i name text code
51 n=$1
52 for i in 0 1 2 3; do
53 name=$(jq -r ".[$i].name" "$PROMPTS")
54 text=$(jq -r ".[$i].text" "$PROMPTS")
55 code=$(curl -s -o "$EV/pass$n-$name.json" -w '%{http_code}' "http://127.0.0.1:$PORT/v1/chat/completions" \
56 -H 'content-type: application/json' \
57 -d "$(jq -cn --arg m "$MID" --arg p "$text" \
58 '{model: $m, max_tokens: 64, stream: false, temperature: 1.0, top_p: 1.0, top_k: 0, seed: 1,
59 messages: [{role: "user", content: $p}]}')")
60 if [ "$code" != 200 ]; then log "pass$n $name HTTP $code"; return 1; fi
61 log "pass$n $name sha256 $(jq -j '.choices[0].message.content' "$EV/pass$n-$name.json" | sha256sum | cut -d' ' -f1)" \
62 "$(jq -c '{finish: .choices[0].finish_reason, prompt: .usage.prompt_tokens, reply: .usage.completion_tokens,
63 seed: .usage.aien_sampling.seed, mode: .usage.aien_sampling.mode, reply_logprob: .usage.aien_sampling.reply_logprob}' \
64 "$EV/pass$n-$name.json")"
65 done
66}
67
68log "door-window: binary $BIN sha256 $(sha256sum "$BIN" | cut -d' ' -f1), port $PORT"
69start session-a || exit 1
70pass 1 || exit 1
71pass 2 || exit 1
72stop
73start session-b || exit 1
74pass 3 || exit 1
75stop
76log "door-window: done"