Skip to content

Speed exact rank certificates with sparse witness products - #6860

Open
fluorine wants to merge 1 commit into
CrocSwap:mainfrom
fluorine:perf-sparse-rank-products
Open

fluorine wants to merge 1 commit into
CrocSwap:mainfrom
fluorine:perf-sparse-rank-products

Conversation

@fluorine

@fluorine fluorine commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Change and mathematical scope

The rational-rank tool’s complete kernel witnesses have large identity blocks, but its checker still multiplies every zero. Evaluate each exact dot product using its smaller nonzero support. Certificate generation also clears denominators once and constructs one final Fraction per coefficient. All four product checks, canonical kernels, pivots, inversion, input limits and certificate bytes remain. No new κ is claimed.

On Nick Petalas’s unchanged PR6272 synthetic 48×64 rank-eight fixture, checking uses 69,280 integer multiplications instead of 320,000. Generation replaces 6,656 Fraction multiply/add pairs with 832 final reductions. Seven alternating fresh-process produce/save/check pairs give median 3.5729 → 3.1467 seconds (11.93% less wall time), Windows / CPython 3.12.2. An earlier seven-pair run gives 14.18% less. All 56 CLI commands pass with identical certificate bytes. Both raw reports are included. Ranges overlap and one pair in each run regresses; these are noisy local medians on a synthetic fixture. Temporary bytecode-prefix directories include standard-library source-import cost in both arms.

Task and overlap

User-assigned process optimization, card replay-runtime, refined scope. Canonical base: 7c49fe32c55de02c2c873655c804b16e4c3fef0a; selected binding-only baseline passes. The package retains the current reference script and PR6272 fixture byte for byte, with source pins, equivalence proof and Open next questions.

PR5789 supplies the complete rank interface. PR6272 already accelerates verification by denominator clearing; this builds on that optimized baseline. Pending PR6705 at e56d08c60910a4a635b708f26acbcc3326639dd5 changes pivot discovery; this targets coefficient production and product evaluation, leaving that stage unchanged. Combined performance is unmeasured. PR5954 and PR6270 optimize other rank/solve callers. Title/body and Discussion overlap checks are bounded coverage.

Validation

  • Registered normal and optimized replay: 596 complete certificate equalities and cross-verification, 70 sparse/empty product shapes, actual and forced denominator-cap fallback, corrupt inverse/factorization/left/right witnesses, invalid inputs, and faulty-producer rejection.
  • Existing seven rational-rank tests pass normally and optimized. PR6272’s unchanged verifier passes both modes: 591 complete certificates, 802 product/mutant cases and 24 certificate rejections.
  • Committed-byte preflight (13 package/input files), official export/bundle check, and both read-only Git-free replays with empty PATH/PYTHONPATH pass; all 14 bundle files remain unchanged. New-code whitespace check passes; the byte-exact baseline retains its original trailing blank line.
  • Hosted Linux and Windows checks pass at exact contribution head 4d73d3df7183e0b1a5f3a34cb3e059eefe45a07e in scoped run 42344842877: normal/optimized package replay, existing tests and retained product conformance. Linux also passes committed-byte and POSIX-mode preflight. The checking workflow is on a separate fork branch and excluded from this 12-file contribution.
  • Full source-history checking remains unclaimed from the shallow checkout. No full supplier replay, Lean, independent human or proof-kernel review.
python3.12 -B scripts/research_package.py --package research/sparse-rank-witness-products
python3.12 -B -m unittest discover -s tests -p test_research_rational_rank.py -v
python3.12 -B research/sparse-rank-witness-products/benchmark.py --pairs 7 --output /tmp/fresh-rank-benchmark.json

The benchmark refuses an existing output, authenticates sources before timing, rejects source drift or differing certificate bytes, and never uses timing as a CI threshold. The existing exact 16,384-bit scale fallback remains.

Credit and open next questions

Ali Romman / PR5789 supplies the interface and complete checker. Nick Petalas / PR6272 supplies the integer-product predecessor, retained fixture and benchmark precedent. Existing notices remain. Sparse products and denominator clearing are classical. New implementation, proof and checks: Joseph Anglada with substantial OpenAI Codex assistance, Apache-2.0.

The package README/TASK explains the next bounded steps: measure an actual source-bound consumer matrix and compare a separately verified combination with PR6705. Native, physical, precision, compiler and theorem admission are outside this change.

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.

1 participant