Skip to content

CROSS 3.0.0

Latest

Choose a tag to compare

@JianmingTONG JianmingTONG released this 18 Sep 16:35
· 11 commits to main since this release
e652a56

CROSS 3.0.0

This release brings the public repository up to the v3 tree (jaxite_word.__version__ == "3.0.0") in one release commit on top of v2.0.0 (69c46d2), plus the fixes from a full validation pass on an eight-chip TPU v6e host. It supersedes the reverted #2.

Scope

Only the library, demos, documentation and test configuration are included: jaxite_word/ (library, tests, perf tests, artifact scripts, API_REFERENCE.md), demos/ (the canonical pipeline, the four demos, trainers and tests), README.md, profile_analysis/, pytest.ini and .gitignore. Eight v2 modules superseded by the reorganized kernels are removed (add, sub, matvec, ciphertext and their tests). Not included, to keep the PR to the logic changes: the reference OpenFHE sources and security probe (openfhe_ref_code/), and the notebook and figure updates under figure_drawer/ (the notebook had grown to 5.5 MB of embedded outputs).

What v3 adds over v2

  • Compiler-style deployment path. A model enters once as an ordinary torch.nn.Module and crosses four owners: nn.vectorize (torch.fx trace, one vectorization template per layer, polynomial activation), packing.pack (global slot-layout reconciliation, the PP-op DAG with its constants, and a 128-bit-secure RingConfig derived from the program's own slot demand and depth), Mapping (levels, scales, noise, BSGS plans, keys, controls, device placement, one AOT-compiled executable) and CKKSContext (codec, primitives, operators). Serving is mapping.infer(x) or mapping.execute(ciphertext).
  • Device-parallel batches inside one executable. A global batch B on D chips is split B/D per chip; the public ciphertext boundary stays a rank-5 Polynomial.
  • New Montgomery reduction support. Montgomery reduction is now a first-class backend across the stack, selectable per operator beside Barrett: MontgomeryContext for modular arithmetic, NTTCiphertextMontgomeryContext for the NTT, BConvMontgomery and the Montgomery-BAT basis conversion, and Montgomery paths for HEAdd/HESub, PtCt multiply, Rescale, HEMul and HERot. Ciphertexts stay in the backend's representation during evaluation, with explicit exactly-once conversions at encryption, ModRaise, key setup and decryption. On TPU v6e it is the faster backend for every operator measured (HEMul 3.99 ms vs 4.69 ms Barrett; Rescale 607 µs vs 774 µs; HEAdd 36 µs vs 69 µs; modular multiply over 51 moduli 74 µs vs 87 µs), and bootstrapping_montgomery_test.py gates bit-canonical parity of a full N=256 bootstrap between the two backends.
  • Reorganized HE kernels and operators with per-level operator caches and CKKS bootstrapping matched to OpenFHE (N=256 parity gates, opt-in larger rings).
  • Four encrypted demos on the canonical path (LoLA, LeNet, AlexNetTiny, AlexNetFull) with an asset script that downloads MNIST/CIFAR-10 and trains the checkpoints, plus HPCA'26 artifact scripts (tabV, tabVI, tabVII, tabIX) and a Barrett-vs-Montgomery bootstrap parity gate.

Fixes from the TPUv6e-8 validation pass (from the CROSS_dev branch v3.0.0-release-fixes)

  • Mapping.release(): a materialized Mapping kept its HBM after its Python reference was dropped, because JAX's tracing caches hold the compiled program's closure and, through it, the Mapping with its captured keys and constants. release() drops the executable and bindings, evicts the id(ctx)-keyed codec caches (ckks_ctx.evict_context_caches), clears the JAX caches and marks the Mapping unusable; a build that fails part-way now discards its traced program. CanonicalDemo.release() and the demo adapters delegate to it.
  • LeNetRegressionTest keeps one resident model at a time (three resident models plus a build exhausted the 32 GiB HBM of one chip); the LoLA, LeNet and AlexNet performance gates release their models when done.
  • nn_test.py and mapping_compile_test.py failed at import when launched the documented way from inside jaxite_word/; both now put the repository root on sys.path.
  • profiler.write_results merges results on the union of columns instead of appending rows under a stale header.
  • tabVII.py skips sharded NTT batches that cannot fit 32 GiB HBM with a printed reason instead of a swallowed RESOURCE_EXHAUSTED; tabV.py re-enables its vectorized baseline (BAT 1.63× at 2048³, no gain at launch-bound small shapes).
  • Release hygiene from a pre-publication audit: the demos import the library through a sys.path shim so every demo and test runs from demos/ with no PYTHONPATH as documented; README install and API samples match the code (torch for the demos, rank-5 Polynomial boundary, rescale(), two-argument plaintext mul, real test-file names, source tabVIII.sh); demos README commands name existing test classes and its pre-unification tables are marked historical; a stray curses import and two leftover comments are gone; accidental executable bits cleared; the MIT LICENSE is tracked.

Validation on TPU v6e-8 (8 × TPU v6 lite, JAX 0.11.1, Python 3.13)

Every *_test.py and *_perf_test.py in the tree was executed serially, one process on the slice at a time.

suite files cases result
library functional tests 29 654 all pass (4 opt-in skips)
demo functional tests 10 271 all pass (3 opt-in skips)
kernel performance tests 11 70 all pass
artifact scripts (tabV, tabVI, tabVII, tabIX, bootstrap sweep) 5 187 all pass
encrypted model gates (LoLA, LeNet, AlexNetTiny; B=1, B=8, B=32, B=64) 8 runs — all pass after the fixes

Headline numbers, warm, 128-bit rings:

workload result
LoLA B=1 / B=32 (8 chips × 4) 566 ms / 397 ms per image, all argmax match cleartext
LeNet B=1 / B=32 / B=64 (8 × 8), trained MNIST weights 714 / 475 / 475 ms per image, 200/200 HE argmax = cleartext
AlexNetTiny B=1 / B=32 / B=8-on-8 662 / 463 / 458 ms per image
HEMul (degree 65536, 51 limbs) 3.99 ms one chip; per-shard 3.91 ms with a batch of 8 over 8 chips (7.6× throughput)
NTT degree 65536, 48 limbs, batch 8 1.88 ms one chip → 318 µs sharded over 8
BAT basis conversion fastest in 9 of 10 configurations, up to 7.6× over the default path

Known, documented gaps: the PtCt BAT path is ~2,400× slower than the VPU path (the VPU path is what Mapping uses); AlexNetFull has no TPU inference entrypoint at degree 65536; N=4096/N=8192 bootstrap gates remain opt-in.

Suggested release steps after merge

  1. Tag v3.0.0 on main and publish a GitHub release (previous releases: v2.0.0, v1.0.1); the earlier v3.0.0 tag that pointed at the reverted merge was removed.
  2. Delete the release-v3.0.0 branch.