CKKS depth-2 (w·x+b)² circuit: adversarial search finds max-error ~2e-3 (5/5 seeds)
Summary
On a depth-2 CKKS circuit, TenSEAL 0.3.16 returns max-errors around
2e-3 under worst-case inputs found by adversarial search
(CMA-ES). Random testing does not surface this; the failing inputs
sit in narrow regions of the input space.
Setup
- Circuit:
f(x) = (w · x + b)², depth 2
- Inputs:
x ∈ [-3, 3]^8
- CKKS params: ring N = 16384, coeff-mod chain
[60, 40, 40, 40, 40, 60], scale 2^40
- Search: AutoOracle (CMA-ES + landscape probe), 500-eval budget,
threshold 1e-2, seeds 41–45
- Smoke test: scalar
f([0.5]·8) agrees with the plaintext
reference to 6 decimal places
Reproduction
pip install fhe-oracle tenseal cma numpy
python benchmarks/library_comparison.py \
--circuit unified-squared-dot --libs tenseal \
--seeds 41 42 43 44 45
Source: https://github.com/BAder82t/fhe-oracle-oss
Results (3 independent runs)
| Run |
Fail rate |
Median max-err |
| Mac native |
5/5 |
2.04e-03 |
| Docker linux/amd64 |
5/5 |
2.11e-03 |
| Docker linux/amd64 (Apr 21) |
5/5 |
2.20e-03 |
Per-seed CSV: library_comparison_unified_ckks.csv in the linked
repo.
Hypothesis
A plausible cause is rescale strategy — deferred rescales on
depth-2 squaring may accumulate more scale-mismatch noise on
adversarial inputs near the domain extremes (search consistently
finds witnesses with |x| near the bound). This is a guess, not
certainty.
What might help
- Confirmation of whether this matches expected behaviour for
TenSEAL's default rescale configuration.
- Documented best-practice for depth-2+ CKKS circuits (explicit
rescale calls, alternative presets).
- A regression-style CI test using fhe-oracle (example available on
request).
Refs
CKKS depth-2
(w·x+b)²circuit: adversarial search finds max-error ~2e-3 (5/5 seeds)Summary
On a depth-2 CKKS circuit, TenSEAL 0.3.16 returns max-errors around
2e-3 under worst-case inputs found by adversarial search
(CMA-ES). Random testing does not surface this; the failing inputs
sit in narrow regions of the input space.
Setup
f(x) = (w · x + b)², depth 2x ∈ [-3, 3]^8[60, 40, 40, 40, 40, 60], scale2^40threshold 1e-2, seeds 41–45
f([0.5]·8)agrees with the plaintextreference to 6 decimal places
Reproduction
pip install fhe-oracle tenseal cma numpy python benchmarks/library_comparison.py \ --circuit unified-squared-dot --libs tenseal \ --seeds 41 42 43 44 45Source: https://github.com/BAder82t/fhe-oracle-oss
Results (3 independent runs)
Per-seed CSV:
library_comparison_unified_ckks.csvin the linkedrepo.
Hypothesis
A plausible cause is rescale strategy — deferred rescales on
depth-2 squaring may accumulate more scale-mismatch noise on
adversarial inputs near the domain extremes (search consistently
finds witnesses with
|x|near the bound). This is a guess, notcertainty.
What might help
TenSEAL's default rescale configuration.
rescale calls, alternative presets).
request).
Refs
benchmarks/library_comparison.pybenchmarks/results/library_comparison_unified_ckks.csv