Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/tree/main/om/q38-head # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-sovereign-core-mv / om / q38-head` `f0acdc7` feat(q38): wire opt-in exact GPU head for greedy serving Drake Stapleton committed 2026-11-01 ``` .. .crumb 425 README.md 4823 check.py 3728 mutants.py 1657 replay.py 1855 run.sh 1006 select.om 2578 validation.json 2815 ``` README.md # Exact 27B head selection in Omega `select.om` computes a conservative mask for a two-pass output head. The compact head proposes scores; full-precision recomputation must cover every row whose upper bound reaches the largest lower bound. Equality is retained, so a later full-precision scan can preserve first-index ties. This is an allocation-free host function and numerical reference for subsequent GPU work. It is not connected to the serving path and does not establish an inference or first-token speedup. Tracking: Core #710 . ## Contract - `h`: the 5120-element normalized binary32 vector used by both head calculations. - `s`: up to 248320 compact binary32 scores. - `c`: nonnegative, upward-rounded binary32 coefficients satisfying `abs(full[i]-s[i]) <= c[i] * norm2(h)`. Coefficients must account for quantization and the actual arithmetic of both heads. This function cannot establish their provenance or adequacy. - `mask`: caller-owned bytes; entries below `count` become zero or one; later entries are untouched. - Return: the number of retained rows. Trap 5 rejects zero/excessive count, nonfinite inputs or negative coefficients before changing any mask byte. The calculation assumes round-to-nearest-even, retained subnormals and the compiler's separate floating-point operations. Binary32 products are exact in binary64. Summation, square root, bound multiplication and endpoint arithmetic are rounded outward by one binary64 representable step. Finite binary32 input magnitudes cannot overflow these binary64 intermediates. Zero radius uses exact binary32-to-binary64 conversion without unnecessary padding. The mask alone is not a token or a sampled distribution. Recompute retained rows using the original full-head arithmetic, then choose the largest score in ascending row order. Sampling requires a separately proved top-k/distribution contract or a full-head fallback. ## Reproduce Set `OMEGA_NATIVE_OMC` to the seeded compiler with SHA256 `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`, and `OMEGA_BRIDGE` to the native binding source matching the hashes in `run.sh`. Then run: ``` bash om/q38-head/run.sh ``` The runner builds and calls the compiled Omega unit through Omega Bridge. Python is an external test instrument only. It checks ties, subnormal and extreme values, the final hidden dimension, unchanged output on refusal, count boundaries, high-precision decimal intervals and five deliberately wrong programs. Output goes under `target/q38-head`, or `Q38_HEAD_OUT` when supplied. `replay.py LIBRARY CAPTURE_DIR SCREEN_DIR` additionally checks independently captured full GPU scores. The capture directory holds `capture.json`, per-position `*-hidden.f32` and `*-logits.f32`; the screen directory holds `coef.f32` and `*-screen.f32`. Every binary array is little-endian binary32. Model data is not committed here. `validation.json` records the executed host gate, five caught behavioral mutants and eight captured-state replays. The replay retained every full-precision winner with at most 47 candidates, using a more conservative coefficient than the initial feasibility screen. Its approximately six-millisecond median selector cost is host overhead measured during this experiment, not a speedup or an uncontended benchmark. ## Experimental GPU serving path `AIEN_Q38_EXACT_HEAD=1` opts the dense 27B loader into the experimental CUDA++ exact-head interface. It requires a library exporting `omega_gpu_q38_exact_extra_bytes`. The loader reuses the existing checked compact-head exporter with the Omega plan's 10384-rounding coefficient, and retains the full-precision head. The CUDA++ Omega units own the fixed normalization envelope, scratch layout, bounds kernel and six-step GPU schedule. The host bindings marshal resources and dispatch it. The option defaults off, is mutually exclusive with `AIEN_Q38_FP8_HEAD=1`, and adds the plan's extra memory reserve before model admission. Sampled requests disable screening and calculate every logit. Greedy requests use the original full-precision weights to recheck the retained candidates. GPU primitive and captured-state replays pass in CUDA++ PR #251. An initial private-server run also matches the full 256-token reference and continuation gate. Complete serving qualification and accepted speed/first-token measurements remain pending. This is a development experiment, not a default-path speed claim. ## Remaining work Finish the full-model acceptance suite, sampling fallback and uncontended timing. Measure command recording and completion overhead as well as GPU execution. The old q36 XBOUND kernel reads only 2048 hidden values and is not reused for 27B. Host selection results alone do not satisfy the serving gates.