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 / tools / exp445 / measure.sh

42 lines · 2536 bytes Raw Blame History
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# tools/exp445/measure.sh <base-url> <model> <dev cases dir> -- token length of every PUBLIC dev task's
18# reference solution in each arm's spelling, as the served model's tokenizer counts it (omega#445,
19# sizes the per-round output cap in docs/one_layer/EXP445_PROTOCOL.md). No program is generated:
20# each request asks for 1 output token and the count is prompt_tokens(message = spelling) minus
21# prompt_tokens(empty message). Spellings: text = reference.osc; bytes = `x445 tohex` of the
22# compiled IR; structured = `omega_emit lift` of the same IR. Prints: task text bytes structured.
23set -euo pipefail
24HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25ROOT="$(cd "$HERE/../.." && pwd)"
26[ $# -eq 3 ] || { echo "usage: measure.sh <base-url> <model> <dev cases dir>" >&2; exit 2; }
27BASE="${1%/}" MODEL="$2" CASES="$3"
28make -s -C "$ROOT" PHYSICS_DIR=/nonexistent PHYSICS_LOCK_CHECK=0 omega-emit build/compiler/oscc >&2
29T="$(mktemp -d "${TMPDIR:-/tmp}/exp445-measure.XXXXXXXX")"; trap 'rm -rf "$T"' EXIT
30ptoks() { # ptoks <file>: prompt tokens of one user message holding the file
31 jq -n -c --arg m "$MODEL" --rawfile c "$1" '{model: $m, messages: [{role: "user", content: $c}], max_tokens: 1, temperature: 0}' |
32 curl -sS -m 120 -H 'Content-Type: application/json' --data-binary @- "$BASE/chat/completions" | jq -e -r '.usage.prompt_tokens'
33}
34: > "$T/empty"; base="$(ptoks "$T/empty")"
35echo "# task text bytes structured (tokens; empty-message baseline $base subtracted)"
36for c in "$CASES"/*/; do
37 id="$(basename "$c")"
38 "$ROOT/build/compiler/oscc" "$c/hidden/reference.osc" "$T/$id" > /dev/null
39 "$ROOT/build/omega_emit/x445" tohex "$T/$id.ir" > "$T/$id.hex"
40 "$ROOT/build/omega_emit/omega_emit" lift "$T/$id.ir" > "$T/$id.json"
41 echo "$id $(( $(ptoks "$c/hidden/reference.osc") - base )) $(( $(ptoks "$T/$id.hex") - base )) $(( $(ptoks "$T/$id.json") - base ))"
42done