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 / campaigns / open-model-qwen3 / rows-oq3-v4.jq

149 lines · 10569 bytes Raw Blame History
1# OPEN-MODEL-QWEN3 v4 extra rows (ACCEPTANCE-v4.md Section 3), jq module. PREPARED, NOT FROZEN.
2# Includes rows-oq3-v3.jq unchanged (jq -L <this folder>) for the row helpers SB, F, D and N2-R and the
3# independent reply reading. Every requirement is read from the task's declared "requirements" array, written
4# before any run; the score is computed on the exact saved bytes. Results are PASS or FAIL; a missing input is
5# FAIL (fail closed).
6#
7# Evidence object $ev (built by v4-rows.sh): the v3 fields (task, report, s5, auths, committed) plus
8# seed_text the pre-seed text of the destination (edit launches) or null
9# source_now {path, sha256} of the task's declared source file in the workspace after the run, or null
10include "rows-oq3-v3";
11
12# ---- counting rules (same as ACCEPTANCE-v3 Section 12) -------------------------------------------------------
13# lines every line with a non-whitespace character, code lines and fence marker lines included.
14# headings markdown headings, 1 to 6 "#", a space, text; fenced code blocks (``` or ~~~, CommonMark close rule:
15# same marker, at least as long, nothing after it; an unclosed fence runs to the end) are skipped. A
16# heading's text is compared trimmed, case-insensitive, trailing closing #s removed.
17# word the declared word occurs in the saved text as a whole word, ASCII case-insensitive: the character
18# before and after it is not a letter or digit (so "first-aid" matches "First-Aid kit", and "greens" does
19# not match "evergreens"). Words use only letters, digits and hyphen.
20# topic as word, for any one of the topic's declared accepted forms (full list in ACCEPTANCE-v4 Section 3).
21# code_blocks the number of complete fenced blocks (an opening fence with a matching closing fence).
22# tail after the closing fence of the last complete block there is a heading (any level) whose text equals the
23# declared heading; the words (whitespace-separated tokens) of the non-empty lines after that heading,
24# up to the next heading or the end of the file, number at least min_words.
25# prefixed_lines lines whose text, after leading whitespace, starts with the declared prefix.
26
27def v4_ltrim: sub("^\\s+"; "");
28def v4_scan($t):
29 reduce ($t | split("\n") | to_entries[]) as $e ({open: null, closed: 0, last_close: null, h: []};
30 ($e.value | sub("\\s+$"; "")) as $l
31 | if .open == null then
32 ($l | capture("^\\s*(?<m>`{3,}|~{3,})(?<i>.*)$"; "") // null) as $o
33 | if $o != null and (($o.m | startswith("`") | not) or ($o.i | contains("`") | not))
34 then .open = {c: ($o.m | .[0:1]), n: ($o.m | length)}
35 elif ($l | test("^#{1,6} +\\S")) then
36 .h += [{i: $e.key, text: ($l | sub("^#{1,6} +"; "") | sub(" +#+$"; "") | v4_ltrim | sub("\\s+$"; "") | ascii_downcase)}]
37 else . end
38 else
39 (.open) as $op
40 | if ($l | test("^\\s*" + (if $op.c == "`" then "`" else "~" end) + "{" + ($op.n | tostring) + ",}\\s*$"))
41 then .open = null | .closed += 1 | .last_close = $e.key else . end
42 end);
43def v4_word_in($t; $w): ($t | test("(^|[^A-Za-z0-9])" + $w + "($|[^A-Za-z0-9])"; "i"));
44def v4_norm_title: v4_ltrim | sub("\\s+$"; "") | ascii_downcase;
45
46# One declared requirement evaluated on the saved text: {found, met}.
47def v4_eval($t):
48 . as $r
49 | (v4_scan($t)) as $s
50 | ($t | split("\n")) as $L
51 | if $r.kind == "min_lines" then v3_nonempty($t) as $n | {found: $n, met: ($n >= $r.n)}
52 elif $r.kind == "max_lines" then v3_nonempty($t) as $n | {found: $n, met: ($n <= $r.n)}
53 elif $r.kind == "headings" then
54 ($r.titles | map(v4_norm_title)) as $want
55 | ($s.h | map(.text)) as $have
56 | {found: $have, missing: ($want | map(select(. as $x | ($have | index($x)) == null))),
57 met: ($want | all(. as $x | ($have | index($x)) != null))}
58 elif $r.kind == "word" then v4_word_in($t; $r.word) as $m | {found: $m, met: $m}
59 elif $r.kind == "topic" then
60 ($r.accepted | map(select(. as $w | v4_word_in($t; $w)))) as $hits | {found: $hits, met: ($hits | length > 0)}
61 elif $r.kind == "code_blocks" then {found: $s.closed, met: ($s.closed >= $r.n)}
62 elif $r.kind == "prefixed_lines" then
63 ($L | map(select(v4_ltrim | startswith($r.prefix))) | length) as $n | {found: $n, met: ($n >= $r.n)}
64 elif $r.kind == "tail" then
65 (if $s.last_close == null then null
66 else ($s.h | map(select(.i > $s.last_close and .text == ($r.heading | v4_norm_title))) | first) end) as $hd
67 | (if $hd == null then null
68 else ($s.h | map(select(.i > $hd.i)) | first | .i) as $nx
69 | $L[$hd.i + 1: (if $nx == null then ($L | length) else $nx end)]
70 | map(select(test("\\S"))) | join(" ") | [scan("\\S+")] | length end) as $w
71 | {found: {heading_after_last_block: ($hd != null), words: $w}, met: ($hd != null and $w >= $r.min_words)}
72 else {found: null, met: false} end;
73
74# RQ<k>: requirement number k (0-based index) of the task, one declared row each.
75def v4_row_req($id; $k):
76 . as $ev | ($ev.committed.text) as $t | ($ev.task.requirements[$k]) as $r
77 | (if $t == null then null else ($r | v4_eval($t)) end) as $e
78 | {row: "\($id)-RQ\($k + 1)", criterion: "Requirement \($k + 1): \($r.label)",
79 threshold: "the file saved at the destination exists and meets the declared requirement (kind \($r.kind)), counted on the saved text by the rule of rows-oq3-v4.jq; nothing saved = FAIL",
80 value: {requirement: $r, evaluated: $e},
81 result: ($t != null and $e != null and $e.met) | v3_okv};
82
83# CUT: the accepted reply was not cut at the token limit.
84def v4_row_cut($id):
85 . as $ev | (v3_accepted) as $acc
86 | {row: "\($id)-CUT", criterion: "Accepted reply not cut at a token limit",
87 threshold: "an accepted (parsed) attempt exists and its finish_reason is not max_tokens",
88 value: {accepted: ($acc | if . == null then null else {attempt, tokens, finish_reason} end)},
89 result: ($acc != null and $acc.finish_reason != "max_tokens" and $acc.finish_reason != null) | v3_okv};
90
91# SRC: the referenced source file is unchanged and is not the destination.
92def v4_row_src($id):
93 . as $ev | ($ev.task.source) as $s
94 | {row: "\($id)-SRC", criterion: "Source file unchanged and distinct from the destination",
95 threshold: "the sha256 of the declared source file in the workspace after the run equals the declared sha256; the source path differs from the destination",
96 value: {source: $s, now: $ev.source_now, destination: $ev.task.destination},
97 result: ($s != null and $ev.source_now != null and $ev.source_now.sha256 == $s.sha256 and $s.path != $ev.task.destination) | v3_okv};
98
99# EO: edit outcome on the saved bytes: every seed line kept, the new line under the heading before the next
100# heading, and nothing else added (non-empty line count = seed + 1).
101def v4_row_eo($id):
102 . as $ev | ($ev.committed.text) as $t | ($ev.seed_text) as $sd
103 | (if $t == null then null else $t | v3_lines end) as $L
104 | (if $sd == null then null else $sd | v3_lines | map(select(test("\\S"))) end) as $S
105 | (if $L == null or $S == null then null else ($S | map(select(. as $x | ($L | index($x)) == null))) end) as $lost
106 | (if $L == null then null else ($L | index($ev.task.under)) end) as $h
107 | (if $h == null then null
108 else ($L[$h + 1:] | (map(test("^#{1,2} ")) | index(true)) as $nx | (if $nx == null then . else .[0:$nx] end) | index($ev.task.new_line)) end) as $at
109 | {row: "\($id)-EO", criterion: "Edit outcome on the saved bytes",
110 threshold: "every non-empty seed line is a line of the saved text; a line equal to new_line follows the under heading before the next level-one or level-two heading; the saved text has exactly one more non-empty line than the seed",
111 value: {lost: $lost, heading_line: $h, new_line_offset: $at, saved_non_empty: (if $t == null then null else v3_nonempty($t) end), seed_non_empty: (if $S == null then null else ($S | length) end)},
112 result: ($L != null and $S != null and ($lost | length) == 0 and $h != null and $at != null
113 and v3_nonempty($t) == ($S | length) + 1) | v3_okv};
114
115# CUT and NC for refusals: nothing committed on a declared refusal.
116def v4_row_nc($id):
117 . as $ev
118 | {row: "\($id)-NC", criterion: "Nothing committed on refusal",
119 threshold: "no authorization record, no S5 path and no file found at any S5 path for this launch",
120 value: {authorizations: ($ev.auths | length), file_sha256: $ev.committed.file_sha256, s5_path: ($ev.s5.path // null)},
121 result: (($ev.auths | length) == 0 and $ev.committed.file_sha256 == null and ($ev.s5.path // null) == null) | v3_okv};
122
123def v4_rows_base:
124 . as $ev | ($ev.task.id) as $id | ($ev.task.kind) as $k
125 | (($ev.task.requirements // []) | length) as $nreq
126 | (if $k == "long" then
127 [v3_row_sb($id), v3_row_f($id), v4_row_cut($id)]
128 + [range(0; $nreq) as $i | v4_row_req($id; $i)]
129 + (if ($ev.task.source // null) != null then [v4_row_src($id)] else [] end)
130 + [v3_row_d($id; true)]
131 elif $k == "edit" then [v3_row_sb($id), v4_row_cut($id), v4_row_eo($id), v3_row_d($id; true)]
132 elif $k == "identity" then [v3_row_sb($id), v4_row_cut($id), v3_row_d($id; true)]
133 elif $k == "negative-boundary" then [v3_row_d($id; false), v4_row_nc($id)]
134 elif $k == "negative-budget" then [v3_row_d($id; false), v4_row_nc($id), v3_row_n2r]
135 else [{row: "?", criterion: "unknown launch kind", threshold: "-", value: $ev.task, result: "FAIL"}] end);
136
137# BE: no CPU, stub, reference or fallback backend served the launch (added after the first draft, before any run).
138# Source: run.json "daemon" array, one entry per daemon start, "backend" parsed from the daemon log by
139# run-campaign.sh. This is the only backend field a receipt carries; there is no per-operation backend field.
140# Fail closed: no daemon entry, an empty backend, any backend not containing OmegaGb10, or any backend naming
141# cpu, stub, reference or fallback is FAIL.
142def v4_row_be($id):
143 . as $ev | (($ev.daemon // []) | map(.backend // "")) as $b
144 | {row: "\($id)-BE", criterion: "No CPU, stub or fallback backend",
145 threshold: "run.json daemon is non-empty; every daemon backend contains OmegaGb10 and none contains cpu, stub, reference or fallback (case-insensitive)",
146 value: {backends: $b},
147 result: (($b | length) > 0 and ($b | all(test("OmegaGb10") and (test("cpu|stub|reference|fallback"; "i") | not)))) | v3_okv};
148
149def v4_rows: . as $ev | ($ev.task.id) as $id | ($ev | v4_rows_base) + [$ev | v4_row_be($id)];