omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / research / om-bench / CONTRACT.md
| 1 | # om-bench measurement contract v1 (omega-mv #653) |
| 2 | |
| 3 | Status: FROZEN at the commit that adds this file. `manifests/contract.sha256` holds the sha256 of this file; |
| 4 | it is committed before any held-out candidate is scored. A change after that is a new version (v2) with a |
| 5 | new hash, and results under v1 stay labelled v1. Owner and judge: OmegaEval. Candidate lanes (OmegaIntent, |
| 6 | OmegaMind, OmegaCorpus, OmegaFast3) never grade themselves under this contract. |
| 7 | |
| 8 | Every number published under this contract carries one label on the same line: MEASURED (with an evidence |
| 9 | path), MODELED (with the formula or Wolfram query) or NOT_RUN. |
| 10 | |
| 11 | ## 1. Question |
| 12 | |
| 13 | Can a model write working Omega (.om) for small, fully specified stdin/stdout tasks without a person fixing |
| 14 | the code by hand, and does it get the answer right? Compared with the same model writing Python and C. |
| 15 | |
| 16 | ## 2. Task set |
| 17 | |
| 18 | - 176 tasks from 44 families, 4 variants each (v1-v4); 1633 test cases. Each task: a plain-English statement, |
| 19 | 2 visible example cases (cases 00 and 01, shown in the prompt), and hidden cases. Scoring uses every case. |
| 20 | - Expected outputs come from oracles written by OmegaEval (`families_public.py`; sealed families in a private |
| 21 | file), never from a candidate lane and never from a model. |
| 22 | - Scoring: stdout bytes exactly equal AND exit code 0. stderr is ignored. |
| 23 | - Splits are partitioned by family, so no family appears in two splits: |
| 24 | |
| 25 | | split | families | tasks | visibility | use | |
| 26 | |---|---|---|---|---| |
| 27 | | train | 8 | 32 | public | examples and corpus material | |
| 28 | | dev | 4 | 16 | public | driver development, smoke tests | |
| 29 | | heldA | 16 | 64 | sealed: aggregates only, task ids as opaque hashes | the scored set for v1 | |
| 30 | | final | 16 | 64 | sealed, untouched | one-time final test of a later version | |
| 31 | |
| 32 | - Hashes: `manifests/splits.json` lists sha256 of every public file and, for each sealed task, a keyed opaque |
| 33 | id (HMAC-SHA256 under a private key) plus one commitment: the sha256 of the sorted list of its file hashes. |
| 34 | Per-file hashes of sealed files are NOT published, because a short expected output (`YES\n`) could be |
| 35 | recovered by hashing guesses. The full private hash list is kept by OmegaEval |
| 36 | (`handoffs/OmegaEval/heldout-sha256.txt`, 2569 lines) and can be checked against the commitments. |
| 37 | - Final-test consumption log: `CONSUMPTION.md`. Every read of the final split by anyone, including structural |
| 38 | load checks that score nothing, is recorded there. A candidate scored on final consumes it. |
| 39 | - Leak check (`leakcheck.py`, v2): every cross-family pair of statements is compared by word Jaccard, |
| 40 | character-5-gram Jaccard and content-word overlap after stop-word removal and a synonym map. A pair is |
| 41 | flagged when word >= 0.6, or char5 >= 0.6, or (overlap >= 0.9 and word >= 0.45). Each flagged pair has a |
| 42 | recorded hand verdict in `leak-reviews.json`. The run fails if a flag is unreviewed or a cross-split pair is |
| 43 | a duplicate. Planted control PLANT1 (a paraphrase of a dev task) must be flagged; PLANT2 (a looser |
| 44 | paraphrase of a train task) is reported but not required. v2 was tuned after seeing PLANT1, so PLANT1 is not |
| 45 | a blind control; the v1 rule missed it, and that miss is reported. Result of record: `leakcheck-v3` |
| 46 | (same rule as v2; ids re-keyed): 176 tasks, 15400 pairs, 8 flags all reviewed, 4 cross-split, 0 duplicates, |
| 47 | PLANT1 flagged, PLANT2 not flagged, rc 0. Flag ids in `leak-reviews.json` are the keyed opaque ids. |
| 48 | - Leak-check verdicts that change the statistics: two heldA families share one computation pattern; they are |
| 49 | ONE cluster in every family-clustered statistic (15 heldA clusters, not 16). One train family is a special |
| 50 | case of one heldA family; it is reported as a near-transfer risk. |
| 51 | |
| 52 | ## 3. Arms |
| 53 | |
| 54 | All arms use the same subject model, the same reference card (`REFERENCE-CARD.md`, sha256 in |
| 55 | `manifests/splits.json`), the same task statement, the same common I/O sentence and the same 2 visible |
| 56 | examples. Only the language and the loop differ. |
| 57 | |
| 58 | | arm | what the model gets | attempts | status in v1 | |
| 59 | |---|---|---|---| |
| 60 | | a | plain generation, Omega | 1, greedy | RUN | |
| 61 | | b | a + compiler feedback: after a refusal the model sees the omc error line, the meaning of the error number and the offending source line, then tries again | up to 1+3, greedy | RUN | |
| 62 | | aeq | equal-attempt baseline for b: up to 4 independent samples at temperature 0.8 (seeds 654-657), first one that compiles is kept, no feedback | up to 4 | RUN on heldA if time allows | |
| 63 | | c | structured construction through OmegaIntent's omq (#838): the model fills `??` holes and omq answers each | - | NOT_RUN (omq not merged; needs an agent loop) | |
| 64 | | d | constrained decoding (OmegaMind) | - | NOT_RUN (not delivered) | |
| 65 | | e | trained Omega specialist | - | NOT_RUN (does not exist yet) | |
| 66 | | fpy | the same model writes Python 3 | 1, greedy | RUN | |
| 67 | | fc | the same model writes C11, built with `gcc -O2 -std=gnu11 -lm` | 1, greedy | RUN | |
| 68 | | pilot A / pilot B | OmegaIntent agent-loop pilot (section 9) | - | NOT_RUN (cloud model unfunded) | |
| 69 | |
| 70 | Arm b's attempt 0 uses the same prompt and greedy decoding as arm a and is charged in full to b. Whether it is |
| 71 | byte-identical to arm a's reply is reported as a reproducibility measurement, not assumed. |
| 72 | |
| 73 | ## 4. Subject model and environment profile |
| 74 | |
| 75 | - Model: Qwen3-4B-Instruct-2507, Q8_0 GGUF, sha256 |
| 76 | `7e0200979d2b23423891febbd8d84b3c65783cbffafc7a4d38cdea9a0b3d044f`, quantized with llama.cpp 0f3a71be1 from |
| 77 | the bf16 release. Chosen as a small CPU model so the run needs no GPU and costs $0 marginal. |
| 78 | - Server: llama.cpp `llama-server` 0.3.0-dev commit 0f3a71be1 (the build bundled at |
| 79 | `/usr/local/lib/ollama/llama-server`, sha256 `f6e05586c5e7dd2110b2d8efadf23ff3b081dcdd53be67cfd32884af7b476163`), |
| 80 | CPU only (`-ngl 0`, no GPU visible), `taskset -c 3-4`, `-t 2 -c 16384 --parallel 1`, port 18653. |
| 81 | `max_tokens` 2048 per reply; greedy = temperature 0, top_k 1, seed 653; prompt cache on. Cores 0-2 run |
| 82 | another lane's decoder (agreed split with OmegaMind, 2026-10-26); a 2-core probe decoded 150 tokens at |
| 83 | 8.13 tok/s (MEASURED, `handoffs/OmegaEval/env/llm-probe-2core.json`). |
| 84 | - Omega compiler: `seed/out/omc` sha256 `2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f`, |
| 85 | as built at omega-mv `0b77e6ea294aa3d69ccbdb86b9c14d133abea689`; this branch's base `369dbc96` has no |
| 86 | change under `seed/`. The judge refuses any other omc hash. |
| 87 | - Host: DGX Spark, arm64, Linux 7.0.0-1019-nvidia; candidate builds and runs pinned to cores 3-4; gcc 13.3.0; |
| 88 | Python 3.12.3. The box runs other work (load around 25 on 20 cores), so every time is "host, busy box". |
| 89 | - Limits: compile 60 s, each test case 10 s wall. A timeout or signal is a mechanical runtime failure. |
| 90 | - No sandbox: unprivileged user namespaces are refused on this host (`unshare -rn` fails). Mitigation: the |
| 91 | authorization scan (section 6) runs before any candidate executes, and a flagged candidate is never run. |
| 92 | |
| 93 | ## 5. Judging |
| 94 | |
| 95 | - Omega arms: judged by `gate.om` (seed/qualification/om2), the seeded .om runner, built by the pinned omc and |
| 96 | given the pinned omc hash. The host comparator in `ombench.py judge` must agree with gate.om case by case |
| 97 | (`ombench.py crosscheck`); any disagreement makes the arm's result INVALID. |
| 98 | - Python and C arms: judged by the host comparator alone (disclosed below). |
| 99 | - A task with no recorded generation is NOT_RUN and is never counted as a pass. The judge prints |
| 100 | `NOT_RUN k of N`, exits 2, and the denominator is the full split size. `DENOMINATOR FAULT` if the number of |
| 101 | judged tasks differs from the split size. A malformed task prints `CORPUS FAULT [task] reason` and exits 1. |
| 102 | |
| 103 | ## 6. Outcome classes (one per task) |
| 104 | |
| 105 | | class | meaning | counts as | |
| 106 | |---|---|---| |
| 107 | | pass | every case correct | success | |
| 108 | | wrong_output | builds and runs cleanly, some answer wrong | correctness failure | |
| 109 | | compile_refused | the compiler refused the final program | mechanical intervention | |
| 110 | | no_code | no code block in the reply | mechanical intervention | |
| 111 | | runtime_mechanical | crash, Omega runtime trap (exit 100-114), signal, timeout, other non-zero exit or empty output on some case | mechanical intervention | |
| 112 | | authz_violation | the program reaches outside stdin/stdout/stderr: Omega host words (ids >= 100 in seed/omc/genkw.awk) or read/write on other descriptors; Python: any import outside the allowlist `sys math collections itertools functools heapq bisect string re fractions decimal operator array statistics typing dataclasses copy`, or calls to `open exec eval compile __import__ breakpoint globals vars`, or `.system .popen .fork .remove .unlink` (parsed with `ast`); C: file, process, network or dynamic-load calls | authorization violation, never executed | |
| 113 | | NOT_RUN | no generation recorded | never a pass, stays in the denominator | |
| 114 | |
| 115 | ## 7. Metrics (all reported together; none alone) |
| 116 | |
| 117 | - Primary: mechanical intervention rate = (compile_refused + no_code + runtime_mechanical) / N. Target 0. |
| 118 | A lower rate never counts as an improvement if correctness drops. |
| 119 | - Correctness: pass / N. |
| 120 | - Authorization violations: count. |
| 121 | - Regressions: tasks that passed under the previous run of the same arm and contract version and fail now |
| 122 | (first run: none to compare, reported as such). |
| 123 | - End-to-end time per task: model wall time for all attempts + compile + judge (MEASURED, busy box). |
| 124 | - Tokens: prompt tokens sent, prompt tokens actually processed (after cache), completion tokens, all attempts. |
| 125 | - Cost: $0 marginal (local model). Compute MODELED as model wall time x 5 cores. Energy NOT_MEASURED. |
| 126 | - Reproducibility: arm a is re-run on the 16 dev tasks; report how many replies are byte-identical (sha256). |
| 127 | - Runtime: for passing tasks, run time per case for Omega vs the model's own C and Python on the same task |
| 128 | (MEASURED). Runtime as a percentage of OmegaReview's measured machine ceiling is NOT_RUN for this task set: |
| 129 | the inputs are at most a few KiB, so time is process start-up, not compute. The pilot families (section 9) |
| 130 | are where the ceiling comparison applies. |
| 131 | |
| 132 | ## 8. Statistics and predeclared verdicts |
| 133 | |
| 134 | All computed in Wolfram; queries and outputs filed with the results. |
| 135 | |
| 136 | - Rates get 95% Wilson intervals over tasks, and a family-clustered interval (cluster = family; the merged |
| 137 | heldA cluster counts once). |
| 138 | - Sample size (Wolfram, two-sided 5%, power 80%, unpaired normal approximation): |
| 139 | `twoProp[0.8,0.55] -> 54`, `twoProp[0.75,0.5] -> 58`, `twoProp[0.5,0.25] -> 58` tasks per arm; Wilson |
| 140 | half-width at p = 0.5 is 0.122 for n = 64 and 0.245 for n = 16 (`z*Sqrt[0.25/n]`). heldA has 64 tasks, so a |
| 141 | 25-point difference is detectable; smaller differences are reported as not resolved. |
| 142 | - Paired arm comparisons (same tasks): exact two-sided McNemar test on discordant tasks. |
| 143 | - "b reduces mechanical interventions vs a": McNemar p < 0.05 AND b's correctness is not lower than a's. |
| 144 | - "b beats an equal number of plain attempts": the same test of b vs aeq. |
| 145 | - "Omega is as writable as Python/C for this model": NOT claimed unless the Omega pass rate's interval |
| 146 | overlaps the Python/C rate AND the mechanical rates are within 10 points. Otherwise the gap is reported. |
| 147 | - One declared run per arm. A re-run is allowed only for a documented load or infrastructure fault; then both |
| 148 | runs are reported. |
| 149 | |
| 150 | ## 9. Pilot task set (OmegaIntent agent loop, ADRs aien-architecture-mv #340/#341) |
| 151 | |
| 152 | Families: fixed-point log2 to micro-bits, PRNG plus hash train/eval split, mean and variance, histogram |
| 153 | entropy, dot product. Arms: A = plain .om authoring with final omc feedback; B = A plus omq answers at each |
| 154 | `??` hole. Measures: first-try success, fixes per task, tokens, wall time, runtime as % of OmegaReview's |
| 155 | measured X925 ceiling. Tasks, oracles, splits and verdicts belong to OmegaEval under this contract. The cloud |
| 156 | model run is NOT_RUN in v1 (no funded account); the family definitions are added as a separate task set |
| 157 | with its own hashes when built. |
| 158 | |
| 159 | ## 10. Controls (must pass before any result is published; `controls/run-controls.sh`) |
| 160 | |
| 161 | - Reference programs pass; planted wrong programs (mutants) are classed wrong_output by both judges. |
| 162 | - Empty output, runtime trap, timeout, compile error and authorization-violating programs land in their |
| 163 | classes; the authorization program is never executed. |
| 164 | - gate.om given a wrong omc hash returns INVALID. |
| 165 | - A run with 9 of 10 generations missing prints `NOT_RUN 9 of 10`, exits 2. |
| 166 | - Corpus faults (task with no cases; case missing its expected output) print `CORPUS FAULT` and exit 1. |
| 167 | - Python and C wrong and authorization controls land in their classes. |
| 168 | Each control asserts the diagnostic text, not only the exit code. |
| 169 | |
| 170 | Pre-freeze fixes found by these controls (control run 1, `controls-r1.txt`; reruns `controls-r2.txt` and, |
| 171 | from the published copy in this directory, `controls-r3.txt`: CONTROLS FAILS=0): |
| 172 | - brackets mutant (depth-at-end check removed) passed every case: no case was never-negative yet unclosed. |
| 173 | Added such cases to brackets.v1 and brackets.v3 (dev/public families), 1629 -> 1633 cases. Sealed task |
| 174 | files unchanged. |
| 175 | - crosscheck read gate.om verdict lines in the wrong shape and reported every case missing; parser fixed. |
| 176 | - Python authorization control `import sys, os` slipped past a regex scan; replaced with the `ast` allowlist above. |
| 177 | - Python wrong-output control printed an integer too large for `str()` and crashed (runtime class); control |
| 178 | replaced with an off-by-one program. |
| 179 | |
| 180 | Reproduction: `bench/materialize.py PUB SEALED manifests/splits.json` regenerated every public file |
| 181 | byte-identically and every sealed file byte-identically (diff -r empty, run from this directory). Scored runs |
| 182 | use `run-arms.sh RUNROOT SPLIT ARM...` (generate, judge, gate.om cross-judge for Omega arms, summary). |
| 183 | |
| 184 | ## 11. Tools outside the Omega closure (disclosed) |
| 185 | |
| 186 | | tool | does | Omega replacement | |
| 187 | |---|---|---| |
| 188 | | Python 3.12.3: `materialize.py`, `families_*.py` | writes tasks and expected outputs | port oracles to .om, cross-checked against the Python oracle | |
| 189 | | Python: `ombench.py` | prompts the model, extracts code, runs authorization scan, host comparator | gate.om already judges Omega; port the scan to .om using genkw word ids | |
| 190 | | Python: `leakcheck.py` | similarity screen | .om text tokenizer + set overlap | |
| 191 | | llama.cpp `llama-server` | runs the subject model | out of scope (model runtime) | |
| 192 | | gcc 13.3.0 | builds arm fc | none needed: it is the C baseline | |
| 193 | |
| 194 | gate.om is the only judge in the Omega closure. Nothing here is "verified by CI": everything was run on the |
| 195 | Spark, not in CI. |