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

bgv: parameter selection computations during lowerings for BGV #536

Open
asraa opened this issue Mar 18, 2024 · 3 comments
Open

bgv: parameter selection computations during lowerings for BGV #536

asraa opened this issue Mar 18, 2024 · 3 comments
Labels
dialect: bgv Issues concerning the bgv dialect

Comments

@asraa
Copy link
Collaborator

asraa commented Mar 18, 2024

For BGV, 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.

@asraa asraa added the dialect: bgv Issues concerning the bgv dialect label Mar 18, 2024
Copy link

github-actions bot commented Mar 19, 2024

This issue has 1 outstanding TODOs:

This comment was autogenerated by todo-backlinks

@AlexanderViand-Intel
Copy link
Collaborator

AlexanderViand-Intel commented 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

  • $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$)

@AlexanderViand-Intel
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dialect: bgv Issues concerning the bgv dialect
Projects
None yet
Development

No branches or pull requests

2 participants