Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplicative depth limitation for HPS, HPSPOVERQ and HPSOVERQLEVELED modes of BFV #280

Closed
yspolyakov opened this issue Jan 19, 2023 · 2 comments · Fixed by #422
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@yspolyakov
Copy link
Contributor

yspolyakov commented Jan 19, 2023

If I change the multiplicative technique from HPS to HPSPOVER or HPSPOVERQLEVELED, the example at https://github.com/openfheorg/openfhe-integer-examples/blob/master/src/strsearch_enc_1.cpp stops working correctly. The BEHZ mode works fine.

@yspolyakov yspolyakov added the bug Something isn't working label Jan 19, 2023
@yspolyakov yspolyakov added this to the Release 1.0.3 milestone Jan 19, 2023
@sarojaduality
Copy link
Collaborator

sarojaduality commented Feb 10, 2023

I replicated the bug in modes HPS, HPSPOVERQ, and HPSPOVERQLEVELED with a simpler example in the branch: Erabelli_280-bfv-mult-bug in the example bfv-mult-bug.cpp.

The noise estimate after decryption gives a value of inf. Here are some of the other noise estimates and parameters:
sigma: 3.19
Berr: 19.14
alpha: 36
Bkey: 1
delta: 512
t: 786433
V: 19618.5
dcrtBits: 60
n: 65536

The mode HPS fails with multiplicative depth 67 and higher.
mult depth: 67
sizeQ: 44

The modes HPSPOVERQ and HPSPOVERQLEVELED fail with multiplicative depth 31 and higher.
mult depth: 31
sizeQ: 21

The depth 31 worked, when I increased the value of P slightly, to be greater than Q, but higher depths still failed. Maybe the bug is due to slightly incorrect or permuted moduli in the precomputations. This would add to the noise, but not enough to fail for lower multiplicative depths for some reason.

There are no issues with the BEHZ mode. It worked with depths up until 116, and higher depths get killed on my 32 GB machine.

@yspolyakov
Copy link
Contributor Author

yspolyakov commented Mar 16, 2023

We will most likely need to update the implementation to use the digits decomposition approach from Section 3.3 of https://eprint.iacr.org/2021/204.pdf. The problem is probably related to the 52-bit precision limitation of doubles, i.e., the accumulated rounding errors in complex scaling start significantly increasing the ciphertext noise (see the correctness discussion in Section 2 of https://eprint.iacr.org/2018/117.pdf)

Currently, the HPS mode should not be used for more than 66 levels. HPSPOVERQ and HPSOVERQLEVELED should not be used for depths larger than 30. The workaround is to use BEHZ for these deep computation scenarios.

@yspolyakov yspolyakov changed the title Bug in HPSPOVERQ and HPSOVERQLEVELED Multiplicative depth limitation for HPS, HPSPOVERQ and HPSOVERQLEVELED Mar 16, 2023
@yspolyakov yspolyakov changed the title Multiplicative depth limitation for HPS, HPSPOVERQ and HPSOVERQLEVELED Multiplicative depth limitation for HPS, HPSPOVERQ and HPSOVERQLEVELED modes of BFV Mar 16, 2023
@dsuponitskiy dsuponitskiy linked a pull request May 8, 2023 that will close this issue
@kimandrik kimandrik mentioned this issue May 28, 2023
@yspolyakov yspolyakov linked a pull request Jun 2, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants