Skip to content

Reduce Gaussian phase payload work by 25–50 percent - #5370

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
aliromman:codex/ten-more-04
Oct 24, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
aliromman:codex/ten-more-04

Conversation

@aliromman

Copy link
Copy Markdown
Contributor

This local algorithmic improvement reduces the retained Gaussian phase pass from 18V+h to 9V+(9/2)V_odd+h payload tape transitions. Even phases stream directly; odd phases use one real-half scratch tape. The bill includes reads, writes, moves, scratch clearing, input retirement and output rewind. From an origin head, the saving is 25–50%. The phase polynomial, output bits, affine word, compact operations and inverse chronology are preserved. There is no change to the complete kappa calculation.

The proof, exact receipt and source manifest define the result. V is payload volume, V_odd is the portion with odd phase, and h is the initial head offset. The proof covers valid complete record layouts and all coefficient widths b>=2, exactly modulo 2^b and on signed Gaussian integers with the stated headroom. It uses three payload roles in total and at most b scratch bits. Encoded phase arithmetic and the full caller remain separate charges.

For both actual event8814 right/left recipes, V=32768 and V_odd=16384. Each phase pass decreases from 589824 to 368640 transitions, exactly 37.5%. The complete monomial wrapper also has the same endpoint and retains every ordinary call. The percentage applies to the phase component, not the whole monomial, wall time or recursive supplier.

Base: canonical main 7c472563474e60185e6ca101a17622133d047e56, priority revision 7. @jmbarrancoml supplied the scan, affine/compact routines and proof in PR #2250; the consumed source proof retains Douglas Colkitt's compact construction. @JoyboyBrian supplied the actual fixture in PR #5327, with Cinna Davis and the native/Clifford lineage credited in the packet source. The Word RAM phase work in PR #4538 and Gaussian normalization in PR #3127 are related work with different operations/models, not consumed implementations.

Use CPython 3.12 with no third-party packages, from the repository root:

python3.12 -B scripts/research_package.py --package research/streaming-gaussian-phase-tariff

Expected status: PASS_STREAMING_GAUSSIAN_PHASE_TARIFF_NO_NEW_KAPPA. Normal and optimized CPython 3.12.13, committed-byte checks, the official 14-file export and a Git-free optimized replay passed. Source and typed-receipt corruption were rejected. Evidence includes 21824 coefficient/phase cases, 768 tensor/polynomial/inverse patterns, four actual complete monomial comparisons, two compact tensor round trips, three arithmetic discriminators and three executed input rejections. Every measured payload bill equals the proved formula; unchanged source execution and an independent integer phase oracle agree.

No full supplier, native catalogue replay, encoded-control lowering, Lean, Docker or selected cold replay was run. Optional full-history checks are unavailable in this shallow checkout. Full caller composition, recursive C, precision and supplier pricing remain open. The selected frontier is unchanged. Prepared by Ali Romman with substantial OpenAI Codex assistance; Apache-2.0. No independent human or proof-kernel review is claimed.

@jwr404

jwr404 commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Independent review (James Reed, with Claude Code). Head 999f5d4047c05d9baef769e586b658b9a1e1e76d.

Verdict: correct. The streamed phase pass is output-identical to the retained routine, and both exact tariffs hold under an independent differential fuzz.

Code check

Against the retained selected-complex-compact-adapters/monomial.py::phase_pass:

  • Phase 0 / 2. These stream both halves as ± copies, the same as the original's emit(real, ·), emit(imag, ·).
  • Phase 1 (×i). The original emits (−imag, +real). The new code buffers real, emits the source's imag with negative = (phase == 1), then real with negative = (phase == 3), giving (−imag, +real). ✓
  • Phase 3 (×−i). The output is (+imag, −real) in both. ✓
  • Negation. It is the same two's-complement loop, exact modulo 2^b. The single scratch tape holds at most b bits and is retired every time.

Differential fuzz

My own driver calls both phase_pass implementations on identical inputs over 300 random cases:

  • n = 1–3 axes, with random phase, linear_Z4 and strict-upper quadratic_rows;
  • coefficient width b ∈ {2..5}, with one or two Gaussian pairs per record;
  • random payload bits, the forward and inverse directions, and initial head offsets h ∈ [0, 5].

Results:

check result
output bytes identical (new vs retained) 300 / 300
new meter = 9V + (9/2)V_odd + h exactly 300 / 300
retained meter = 18V + h exactly 300 / 300

V_odd was computed from the retained tensor_phase, not from the package.

The headline arithmetic is right: 18·32768 = 589,824 and (9 + 4.5/2)·32768 = 368,640, which is 37.5% when exactly half the volume has odd phase. The general range is 25% (all odd) to 50% (all even). The registered replay passes locally.

The scope note is accurate: the percentage applies to the phase component only, not the whole monomial or the supplier.

@Mister-Meeseeks
Mister-Meeseeks merged commit e36f783 into CrocSwap:main Oct 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants