Skip to content

CKKS depth-2 (w·x+b)² circuit: adversarial search finds max-error ~2e-3 (5/5 seeds) #518

Description

@BAder82t

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions