You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parameter selection computations during lowerings for BGV/CKKS #536
For BGV/CKKS, a user may specify a number of bits for a prime modulus. We should likely integrate a library that can generate prime moduli given the number of bits needed.
Likewise, we need analysis passes that can compute optimal # of moduli bits per level and integrate that into secret-to-bgv/secret-to-ckks
In addition to the plaintext/ciphertext moduli, there's a bunch of other parameters that are less user-visible but still necessary for bgv->poly. Here's a (likely still incomplete) list of parameters and parameter-derived constants that we need to select/compute (or take as input):
Ring & Security Parameters
$N$ - ring dimension / degree of the polynomial modulus $X^N+1$
$p$ - plaintext modulus - plaintext space is $\mathbb{Z}_p/(X^N+1)$
$Q$ - ciphertext modulus
Ciphertext Modulus Chain: Individual $q_i$ with $Q = \prod q_i$ for $i \in [0, l]$.
Depending on the variant/ noise management approach, we can parameterize this in different ways
(one bit width for all, individual bit widths, one relative scale relation, individual scale relations, etc).
This also determines the number of RNS limbs to be $l$.
$\lambda$ - security parameter
$\sigma$ - standard deviation of the error distribution (frequently hardcoded to 3.2, see Section 2.5.1 here)
Key-Switching Parameters
$P$ - "special" prime (key-switching happens mod $PQ$) $\omega$ - number of digits in the digit decomposition
Parameter-Derived Metadata
NTT twiddle factors (powers of roots of unity) EDIT: I think those we can leave for the poly->target lowerings
Fast Basis Conversion/Modswitch constants (things such as $p^{-1}Q'/Q \mod Q$)
Linking this to #543, which is similar, but about NTT twiddle factors and is leaning towards generating them externally and hardcoding them into the HEIR source code, rather than adding some math library to the dependencies.
changed the title [-]bgv: parameter selection computations during lowerings for BGV[/-][+]parameter selection computations during lowerings for BGV/CKKS[/+]on Nov 3, 2024
@ZenithalHourlyRate's work has finished this issue for BGV, and aside from the scaling factors this is also done for CKKS (prime selection is the same for both). We ended up using OpenFHE's prime selection routine since we have it as a dependency already.
Maybe we should close this in favor of more specific individual issues on parameter selection that is ongoing.
Activity
AlexanderViand-Intel commentedon Mar 20, 2024
In addition to the plaintext/ciphertext moduli, there's a bunch of other parameters that are less user-visible but still necessary for bgv->poly. Here's a (likely still incomplete) list of parameters and parameter-derived constants that we need to select/compute (or take as input):
Ring & Security Parameters
Depending on the variant/ noise management approach, we can parameterize this in different ways
(one bit width for all, individual bit widths, one relative scale relation, individual scale relations, etc).
This also determines the number of RNS limbs to be
Key-Switching Parameters
Parameter-Derived Metadata
NTT twiddle factors (powers of roots of unity)EDIT: I think those we can leave for the poly->target loweringsAlexanderViand-Intel commentedon Apr 4, 2024
Linking this to #543, which is similar, but about NTT twiddle factors and is leaning towards generating them externally and hardcoding them into the HEIR source code, rather than adding some math library to the dependencies.
[-]bgv: parameter selection computations during lowerings for BGV[/-][+]parameter selection computations during lowerings for BGV/CKKS[/+]j2kun commentedon Feb 27, 2025
@ZenithalHourlyRate's work has finished this issue for BGV, and aside from the scaling factors this is also done for CKKS (prime selection is the same for both). We ended up using OpenFHE's prime selection routine since we have it as a dependency already.
Maybe we should close this in favor of more specific individual issues on parameter selection that is ongoing.
github-actions commentedon Mar 3, 2025
Note
Re-commenting because this issue was closed with unresolved TODOs.
This issue has 1 outstanding TODOs:
This comment was autogenerated by todo-backlinks
j2kun commentedon Mar 3, 2025
Let's move that TODO to a new ticket