interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / calibration / docs / EVALUATOR.md

330 lines · 26609 bytes Raw Blame History Source

EXP-001 primary evaluator: turing-cal-eval

Source: tools/turing_cal_eval.c (C11 + POSIX). Build: make turing-cal-eval -> build/turing-exp001-eval/turing-cal-eval. Its SHA-256 is part of the frozen runtime digest (calibration/scripts/runtime_digest.sh, seven binaries, including the independent scorer). Statistics: UNCERTAINTY_PROTOCOL.md. Coders and the TPS1 / TSY1 / TCR1 / TCA1 byte layouts: CODER_SPEC.md. Verdict rule: preregistration/EXP-001.md section 5a. All decisions use int64 micro-bits (ub; 1 bit = 1,000,000 ub).

1. Commands

turing-cal-eval run  [--dry-run] --repo DIR --manifest CANDIDATE_MANIFEST --cand-dir DIR [--cand-dir DIR ...]
                     --dataset DATASET_MANIFEST [--overlap OVERLAP_AUDIT] --out BUNDLE_DIR --work WORK_DIR
                     [--only NAME,NAME,...]
turing-cal-eval gate [--dry-run] --bundle BUNDLE_DIR --independent SCORER_INDEPENDENT_JSON

Exit codes: 0 finished (whatever the verdict); 2 refused before any sealed score existed (the attempt is VOID, void_receipt_<n>.json); 1 a terminal failure (a criterion FAILs, final_receipt.json with verdict FAIL, see section 3). A crash (any other exit) before run has started scoring is VOID and follows the same retry rule. A crash after scoring started is a terminal FAIL of the criterion whose step crashed, recorded by hand in final_receipt.json with the stderr tail; it is never retried (FAILURE_REPORTING.md section 2).

2. What run does, in order

  1. Profile: SHA-256 of the TOML must equal the sidecar; outside a dry run the TOML may not contain FILL_AT_FREEZE.
  2. Candidate manifest: its profile_sha256 must equal the profile; outside a dry run status = frozen and frozen_at present. Every shared_background_sha256 entry is re-hashed in --repo. The evaluator's own SHA-256 must equal the frozen turing-cal-eval runtime digest (sealed mode). In sealed mode independent_scorer_source_sha256 must equal calibration/scripts/indep_source_digest.sh run in --repo (INDEP_SOURCE). Each candidate file must match file_sha256; after loading, its model digest and exact L(M) bits must match the manifest (this pass loads, checks and frees every candidate before any scoring).
  3. Dataset manifest: profile_digest must equal the profile; split must be sealed_test (sealed mode) or development (dry run); payload_digest must equal the file list; files in group then index order, both groups present; every trace re-hashed.
  4. Freeze order (sealed mode; two-step freeze, BLINDING_PROTOCOL.md section 2). C_f is the dataset manifest's freeze_commit. Checks, in order: overlap audit present (void if not) and PASS; C_f is 40 hex; the audit names C_f; origin/main exists in --repo and C_f is its ancestor (fetch first; void if not); the candidate manifest and the profile given to the run hash to the files at C_f (git show C_f:<path>); C_f's commit time is before released_utc; every file's seed equals the turing.cal.sealed.v1 seed for (C_f, profile digest, g, j). In both modes the manifest frozen_at must be before released_utc when both exist.
  5. For each sealed file and candidate: produce the TPS1 probability stream and TSY1 symbol stream, write them, re-read and parse them, encode with coder A (TCR1 range) and coder B (TCA1 rANS) from the same parsed TPS1, write, re-read, decode, compare with the symbols (S1). Coded headers must carry the TPS1 digest (S3, BINDING). All candidates must see the same symbol stream (S3, SYMBOL_STREAM). Per crumb (crumb boundary: DATA_FORMAT.md section 1.2): ideal length, each coder on the crumb alone (56-byte header included), round trip.
  6. Per-crumb bootstrap (B = 10000, seed 0x4558503030315543 + group, common random numbers across candidates), envelope per file and per crumb for every candidate, reversal audit, criteria S1-S7 and S9.
  7. Write the bundle and the pending receipt and report (final_receipt.pending.json, REPORT.pending.md).

Before step 5 the evaluator records the notebook: operator (git config user.name), host (hostname), kernel (uname system, release, machine), commit (git rev-parse HEAD of --repo) and whether the tree is clean (git status --porcelain empty). All five go into the receipt under notebook. Outside a dry run a tree that is not clean is refused (DIRTY_TREE) before any measurement; a dry run records the state and continues.

3. Refusal codes, void attempts and terminal failures

Four outcomes (FAILURE_REPORTING.md section 2 is the rule; this is how the evaluator applies it):

CodeMeaningOutcome
ARGbad or missing argument; --only outside a dry runno receipt
IOa file could not be read or writtenno receipt in the pre-pass (profile, candidate manifest, dataset manifest unreadable) and for the out/work dirs; void later before scoring; after scoring started a terminal FAIL with failed_criterion NONE, every criterion NOT_REACHED, verdict FAIL
OUT_PATHsealed --out does not resolve to a path ending in /<C_f>/run/bundleno receipt
ATTEMPTSthree void receipts already exist in the bundle: EXP-001 is INCONCLUSIVE (INFRA)no receipt
DRY_RUN_TARGETa dry run tried to write under calibration/experiments/EXP-001no receipt
EXISTSfinal_receipt.json already exists; a verdict is never replacedno receipt
RETRY_DIFFERSa retry's command or inputs differ from the first void of stage evaluationvoid
PROFILE_DIGESTprofile differs from its sidecar, or a manifest names another profilevoid
NOT_FROZENFILL_AT_FREEZE left, manifest not frozen, or no frozen_at (sealed mode)void
FORMATmalformed manifest, dataset manifest, CTR1 file, stream or criterionvoid before scoring (every CTR1 file is read and validated by ty_ctr1_read in run, tools/turing_cal_eval.c line 853, before g_scored = 1 at line 896, so a malformed trace is always a void); S3 terminal FAIL for a stream that fails to serialize or parse; at the gate, pending receipt without its binding fields: no receipt
DIGESTa candidate file or shared-background file differs from the manifestvoid
RUNTIME_DIGESTthe evaluator binary is not the frozen onevoid
INDEP_SOURCEthe independent scorer source in --repo differs from the frozen hashvoid
MODEL_DIGESTa loaded model's digest differs from the manifestvoid
LM_BITSa loaded model's L(M) differs from the manifestvoid
SPLITsealed mode with development data, or a dry run with sealed datavoid
DATASET_DIGESTpayload digest or a trace file differs from the dataset manifestvoid
OVERLAPoverlap audit missing or unreadable (void); audit result not PASS (S2 terminal FAIL)see meaning
FREEZE_COMMITdataset freeze_commit not 40 hex (no receipt, pre-pass); audit names another commit, no origin/main or C_f not its ancestor (void); candidate manifest or profile differ from the files at C_f (S2 terminal FAIL)see meaning
FREEZE_AFTER_RELEASEno release time (void); C_f committed, or candidates frozen, at or after the data release (S2 terminal FAIL)see meaning
SEED_DERIVATIONa sealed seed is not the rule's seed for C_fS2 terminal FAIL
BINDINGa coded header is not bound to the TPS1 digestS3 terminal FAIL
SYMBOL_STREAMcandidates see different symbol streamsS3 terminal FAIL
CODERa coder fails to encode a whole file or a crumbS1 terminal FAIL
CRUMB_SUMper-crumb ideal lengths do not add up to the whole-file ideal lengthS4 terminal FAIL
NO_CRUMBSa group has no crumbsS6 terminal FAIL for group 1, S9 terminal FAIL for group 2
MODEgate --dry-run disagrees with the bundleno receipt
NOT_INDEPENDENTsealed-mode gate given a byte copy of scorer_primary.jsonno receipt
INDEP_MISSINGgate: the independent scorer file is missing or unreadable (lane D crashed or wrote nothing)S8 terminal FAIL, no retry
INDEP_FORMATgate: the independent scorer file cannot be read at the value pass (it was readable when hashed)S8 terminal FAIL, no retry
DIRTY_TREEoutside a dry run, --repo is not a git checkout at its top level, or git status --porcelain is not emptyvoid

A decoder mismatch (CORRUPT, TRAIL or a round-trip difference) is not a refusal: it is recorded and makes S1 FAIL through the normal criterion path. An independent file that parses but reports "problems" other than 0, has no "problems" field, or differs from scorer_primary.json in any compared value is not a refusal either: the gate completes and S8 is FAIL (section 6.3).

4. Dataset manifest

make_dataset_manifest.sh --sealed SEALED_ROOT OUT.json (after generate_sealed_data.sh; checks COMPLETE, seed_commitment.json and manifest.json, re-hashes every control trace) or make_dataset_manifest.sh --dev RUN_DIR "G1 SEEDS" "G2 SEEDS" PROFILE_SHA256 OUT.json (dry run only; released_utc = NOT_SEALED). Schema turing.cal.dataset_manifest.v1; one file entry per line; payload_digest = SHA-256 over the LF-terminated lines <g> <index> <seed> <sha256> <bytes> in group then index order.

5. Bundle and work directory

Exact layout, run root and INDEX column formats: DATA_FORMAT.md section 4. Bundle (--out; for the sealed run ~/aien-data/turing-cal/eval/<C_f>/run/bundle, outside git, the only location the evaluator accepts in sealed mode; which of its files are later copied into calibration/experiments/EXP-001/ is FAILURE_REPORTING.md section 6): profile.digest, ideal_lengths.json (per file and per crumb), scorer_primary.json, uncertainty.json, probability_streams/INDEX, arithmetic/results.json, ans/results.json, encoded_artifacts/INDEX, decoder_receipts/, final_receipt.pending.json, REPORT.pending.md, and after gate scorer_independent.json, final_receipt.json, REPORT.md. Work dir (--work, outside git): the large files probability_streams/*.tps, symbols/*.tsy, arithmetic/*.tcr, ans/*.tca. The INDEX files and results records carry every large file's SHA-256 and byte count, so the bundle pins them.

Roots in the receipt: candidate_root = SHA-256 of the candidate manifest; dataset_root = the dataset payload_digest; probability_root, coding_root and analysis_root = SHA-256 over the sorted lines <sha256> <relpath>\n (sha256sum format) of, respectively, probability_streams/INDEX; arithmetic/results.json, ans/results.json, encoded_artifacts/INDEX; ideal_lengths.json, scorer_primary.json, scorer_independent.json, uncertainty.json.

6. scorer_primary.json and the independent scorer (S8): the field contract

This section is the whole contract for scorer_independent.json. The independent scorer reads the run root (DATA_FORMAT.md section 4: the dataset manifest, the bundle with its INDEX files, the work dir with the large streams), the CTR1 trace files named in the dataset manifest, the profile and candidate manifest copied from C_f into docs/, and the candidate .tym files; it never reads omega source. The data formats it needs are in DATA_FORMAT.md (CTR1 layout, crumb boundary, profile digest, run root and bundle layout) and CODER_SPEC.md.

What lane D recomputes and what it reads (exact; CAL-0 review 2 Q3):

So S8 catches: any error in the model-to-probability step, the ub(q) rule, the per-crumb and per-group sums, the crumb split, the bootstrap or the T arithmetic of the primary evaluator; a stream or coded file that differs from recomputation, from its INDEX entry or from its TPS1 binding; a coded file that does not decode to the data. S8 cannot catch: a coder that is correct but codes less tightly than it could (the coded length is a fact of the file; the S4 envelope bounds it, not S8); an error both scorers share because the documents themselves are wrong; anything upstream of the CTR1 files (their content is pinned by the dataset manifest, and S2 and the overlap audit cover their provenance).

The independent scorer used for S8 is tools/turing_verify_indep (lane D: written from these documents only, C, built by make turing-verify-indep into build/turing-verify-indep/indep-scorer; its line in the runtime listing is named turing-verify-indep). Its source is pinned by independent_scorer_source_sha256 in the candidate manifest (rule turing.cal.indep_source.v1, calibration/scripts/indep_source_digest.sh) and its binary is one of the seven binaries of the runtime digest. It runs in the evaluator environment, from the frozen tree at C_f, with the command in BLINDING_PROTOCOL.md section 2 step 8. Any change to its source after the sealed data is released makes S8 FAIL (a scorer that can be revised after seeing the data is not independent). The two rules differ in what they catch: the INDEP_SOURCE refusal (void) is for a wrong scorer source tree in --repo, found before scoring; S8 FAIL is the policy for results produced by a scorer built from revised source, which the gate itself cannot detect and which the frozen tree and the verbatim step 8 command prevent.

6.1 File layout

{
  "schema": "turing.cal.scorer.v1",
  "scorer": "<free text naming the scorer>",
  "dry_run": true | false,
  "profile_sha256": "<64 hex, copied from profile.digest>",
  "candidate_manifest_sha256": "<64 hex, SHA-256 of the candidate manifest file bytes>",
  "dataset_manifest_sha256": "<64 hex, SHA-256 of the dataset manifest file bytes>",
  "problems": 0,
  "values": [
    {"key": "g1.crumbs", "value": 1234},
    ...
  ]
}

The gate reads the file line by line. Rules the writer must follow:

  1. Each header field is on its own line as "name": "value" (any number of spaces after the colon). schema, profile_sha256, candidate_manifest_sha256 and dataset_manifest_sha256 must equal the primary file's values exactly (lower-case hex). scorer and dry_run are not compared.
  2. Each value is one object on one line: {"key": "<key>", "value": <integer>}. Spaces after a colon are free; the order of lines is free.
  3. Every value is a base-10 signed 64-bit integer. There are no float fields. A value written with a fraction or exponent (1.0, 1e6) is not an integer and never matches.
  4. The key set must be exactly the primary key set: no missing key, no extra key, no repeated key.
  5. The independent file carries "problems": <integer> on its own line: the number of failed checks lane D found (section 6 above). The gate fails S8 unless it is exactly 0; a file without it fails S8. The primary file has no such field, and a dry-run self-comparison does not check it.
  6. Anything else in the file (for example a criteria object) is ignored.

6.2 Keys and definitions

Units: _ub = micro-bits (1 bit = 1,000,000 ub); _bits = bits; _bytes = bytes. Groups g = 1, 2. Candidates C are the seven manifest names (B0_uniform, B1_order0, B2_order1, B3_heuristic, M_candidate, M_mem, M_mem_seed1), in candidate-manifest order. Files j = the dataset-manifest index within group g.

KeyValue
g<g>.crumbsnumber of crumbs over all files in group g
g<g>.eventsnumber of events over all files in group g
g<g>.<C>.lm_bitsexact L(M) in bits (the TYM0 bit count; equals the candidate manifest lm_bits)
g<g>.<C>.ideal_ubsum of ideal(event) over group g
g<g>.<C>.range_bits8 x byte size of the TCR1 files of group g (56-byte header included), summed
g<g>.<C>.rans_bits8 x byte size of the TCA1 files of group g (56-byte header included), summed
g<g>.<C>.T_ideal_vs_B2.point_ubideal_ub(B2) - ideal_ub(C) - (lm_bits(C) - lm_bits(B2)) x 1e6
g<g>.<C>.T_ideal_vs_B2.lo_ub, .hi_ubbootstrap interval, below
g<g>.<C>.T_range_vs_B2.point_ub(range_bits(B2) - range_bits(C) - lm_bits(C) + lm_bits(B2)) x 1e6
g<g>.<C>.T_rans_vs_B2.point_ubsame with rans_bits
g<g>.<C>.T_range_vs_B2.lo_ub, .hi_ub (and rans)the ideal lo/hi shifted by -(o(C) - o(B2)), where o(M) = coded_bits(M) x 1e6 - ideal_ub(M) for that coder
g<g>.f<j>.<C>.ideal_ubsum of ideal(event) over file j of group g
g<g>.f<j>.<C>.range_bytesbyte size of that file's TCR1 file (header included)
g<g>.f<j>.<C>.rans_bytesbyte size of that file's TCA1 file (header included)

For C = B2_order1 every T value is 0.

Bootstrap interval (per group g). Let the pool be the group's crumbs, Cn of them, and u(C, k) the ideal ub of crumb k under candidate C. Seed st = 0x4558503030315543 + g (unsigned 64-bit). Draw with splitmix64 (`st += 0x9E3779B97F4A7C15; z = st; z = (z ^ z>>30) * 0xBF58476D1CE4E5B9; z = (z ^ z>>27) * 0x94D049BB133111EB; return z ^ z>>31`). Rejection limit lim = UINT64_MAX - ((UINT64_MAX % Cn) + 1) % Cn; draw r until r <= lim, index = r % Cn. For b = 0..9999, draw Cn indices in order; one index is shared by all candidates (common random numbers) and adds u(C, index) to S(C, b). Then t_b = S(B2, b) - S(C, b) - (lm_bits(C) - lm_bits(B2)) x 1e6; sort the 10000 values ascending; lo_ub = element 250, hi_ub = element 9749 (0-based). All arithmetic is signed 64-bit integer.

6.3 The comparison rule

gate sets S8 = PASS only when all of these hold; otherwise S8 = FAIL:

In sealed mode a byte-identical copy of scorer_primary.json is refused (NOT_INDEPENDENT); a dry run allows the self-comparison and labels it in the receipt notes.

gate then applies the verdict rule (FAIL if any criterion FAIL or NOT_REACHED, else INCONCLUSIVE if any is INCONCLUSIVE, else PASS), computes analysis_root, and writes final_receipt.json and REPORT.md exactly once (exclusive create).

7. Tests

make test-turing-exp001-eval runs tests/turing/test_tc_eval.sh with the plain and the ASan build on the small committed fixture: every row of the refusal table that a tampered input can trigger (dry-run target, tampered candidate, wrong model digest, profile edited, stale dataset manifest, shared background changed, dataset file or trace changed, gate mode mismatch, write-once, draft manifest in sealed mode, runtime digest, development split in sealed mode, missing overlap audit, audit naming another commit, C_f not on origin/main, FILL_AT_FREEZE, self-comparison, dirty or non-git tree, independent scorer source changed, retry with a different command) must exit 2 with the named code; three void attempts give INCONCLUSIVE INFRA and a fourth is refused; the sealed freeze-order failures (overlap FAIL, manifest edited after C_f, seed not derived from C_f, released before C_f, frozen after release) and a gate failure after scoring must exit 1 with a terminal-fail final_receipt.json and no void receipt; freeze_receipt.sh must refuse an unfilled runtime digest and existing sealed data and PASS otherwise; the sealed pending receipt must carry the notebook record; S8 must PASS for a reordered, re-spaced copy and FAIL for a float value, a different profile digest and a repeated key; S8 must FAIL (final, no second gate) for a missing, an unparsable and a problem-reporting independent file; void, INCONCLUSIVE and terminal receipts must carry the three binding fields; a sealed --out outside <root>/<C_f>/run/bundle and a dataset without a 40-hex freeze_commit must be refused with no receipt; voids from record_void.sh, sealed generation and the evaluator must share one counter, the third ending EXP-001 and every later start (record_void.sh, generation, evaluator ATTEMPTS) refused; generate_sealed_data.sh must refuse without the PASS freeze receipt naming C_f on origin/main; the positive dry run and gate must finish, and plain and ASan output must agree. make turing-exp001-eval-dry TE_DATA=<dev run dir> runs the full development dry run with the independent scorer, which must give S8 PASS and verdict PASS (refuses to start when ~/workspace/.spark-quiet exists).