Skip to content

Add BinaryBAA and ChosenBAA30 with optimized encoding - #199

Merged
ladnir merged 14 commits into
masterfrom
codex/chosen-baa-vole
Nov 15, 2026
Merged

ladnir merged 14 commits into
masterfrom
codex/chosen-baa-vole

Conversation

@ladnir

@ladnir ladnir commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

This adds two explicit BAA profiles: BinaryBAA<Word> for independent binary lanes (10% tier), and ChosenBAA30<F> for large fields (30% tier). GF(2^128) Silent VOLE defaults to MultType::ChosenBAA30. BinaryBAA is available in binary Silent OT and is rejected by both Silent VOLE peers and the field-compression adapter. The former field-dependent ChosenBaa10 API is removed; legacy full-field ChosenBaa16x8 and ChosenBaa16x4 remain selectable.

  • BinaryBAA uses RM(2,5)[32,16,8], uniform shuffles, and two XOR accumulators. A block carries 128 independent binary codewords. Silent OT supports packed and separate choice bits, with a joint commit/contribute/open seed exchange. Its existing noise convention selects 200 regular or 424 stationary positions at the default security setting.
  • ChosenBAA30 uses RS[16,8,9] and two recursive scans with 256 distinct nonzero coefficients. GF128 VOLE uses the joint seed exchange, pseudo-distance 0.30, and the independent half-rate noise floor, selecting 128 positions. Both peers must upgrade together. Other VOLE fields retain their existing defaults.
  • Standalone forward/transpose interfaces use caller-owned scratch and perform no encoding-time allocation. ChosenBAA30 retains compile-time field policies, with Goldilocks correctness coverage. Optimized Fp128 reference timings belong to a separate AVX-512 harness.
  • GF kernels retain explicit batching and unrolled transforms, with AVX-512/AVX2 VPCLMUL, GFNI when enabled, ARM PMULL, and portable arithmetic. cryptoTools fixes ARM dispatch. SIMD scratch stays in non-coroutine helpers.
  • Retain heap-owned ChosenBAA30 metadata and aligned scratch across GF128 VOLE calls. Every call still regenerates its permutations and coefficients from a fresh joint seed. Reconfiguration retains output-buffer capacity while invalidating old outputs; clear() releases both outputs and workspace. The reuse regression compares paired outputs with fresh workspaces while changing lengths and seeds.
  • Fix BinarySolver::solveOne retaining spans into expired stack parameters by awaiting solve in the wrapper. The delayed-start regression reproduces the prior failure under Clang ASan.

At k=2^20, n=2^21, the binary numerical distance procedure gives >10% with a 47.093-bit sampling margin; the q256 exact direct-rank certificate gives >30.524% with a 59.13394-bit margin. These are length-specific ideal-uniform-setup bounds, not protocol-security proofs or guarantees for AES-expanded randomness. The binary calculation uses the original floating-point procedure and its rounding allowance.

Latest setup/encoding optimization batches uniform-shuffle draws and destination prefetches, packs coefficient bytes from contiguous PRNG views, and uses four-element fully unrolled GF128 scan batches on x86 VPCLMUL builds. The exact seed-to-code mapping is preserved; ARM, portable, and other-field scan schedules remain unchanged.

Sequential Peach A/B measurements (same hardware/compiler below; three seeds, two warmups and eleven samples per seed; medians of per-seed medians):

Codeword length Setup before / after Forward before / after Transpose before / after
2,097,152 (k=2^20) 10.38 / 8.20 ms 17.11 / 15.21 ms 17.08 / 15.62 ms
2,823,424 (2^20-item PSI shape) 14.59 / 11.38 ms 24.37 / 21.74 ms 24.60 / 22.55 ms

Setup reuses capacity but generates fresh randomness each sample; encoding excludes setup. Metadata and output checksums match the previous implementation for all compared seeds. A scalar setup reference covers batch tails and rejection sampling. Focused BAA tests, all 28 enabled Silent tests, all 56 dependent PSI tests, and kernel ASan/UBSan checks pass. The dependent PSI warm elapsed time improves from 392.8 to 377.3 ms with one core per party. See reproduction details and benchmark source.

Previously recorded sequential Peach measurements (Ryzen 7950X, pinned CPU 2 at 4.5 GHz, GCC 15.2, AVX-512/VPCLMUL/GFNI, six seeds, two warmups, 31 samples per direction):

Profile Forward Transpose
Binary RM, 128 packed lanes 10.57 ms 9.57 ms
GF(2^128) RS, q256 17.35 ms 16.85 ms

Setup/allocation are excluded. The optimized kernel maps and seed schedules are unchanged by the API split. Reproduction commands and backend-specific results are in libOTe_Tests/benchmarks/ChosenBaaDirections.md.

The RS addition-only, q2, and constant-mixing exploration is archived in gen-BAA commit ad9f485, under field-universality/libote-baa-exploration/2026-11-14; the RS addition-only 10% bound remains unproved. These experiments are not public profiles.

Validation: all five focused code/seed/VOLE/BinaryBAA-OT/Tungsten-OT tests pass, and all 28 enabled Silent protocol regressions pass (the optional SPIN test is disabled). Portable code, seed, VOLE, and BinaryBAA OT checks pass. Packed/separate choices, regular/stationary noise, and semi-honest/malicious modes are covered. All 56 dependent volePSI tests pass. The fallback CI build exposed a missing explicit test include when Silent OT is disabled; the fix is included, and a compile check with Silent OT/VOLE/SoftSpoken/bitpolymul disabled passes. CI is tracked by this PR's current checks.

@ladnir ladnir changed the title Add chosen-block BAA over GF128 for Silent VOLE Add chosen-block BAA codes and optimized GF128 encoders Nov 14, 2026
@ladnir ladnir changed the title Add chosen-block BAA codes and optimized GF128 encoders Add BinaryBAA and ChosenBAA30 with optimized encoding Nov 15, 2026
@ladnir
ladnir merged commit 803e676 into master Nov 15, 2026
5 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.

1 participant