Skip to content

parameter selection computations during lowerings for BGV/CKKS #536

Closed

Description

@asraa

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

Activity

  1. added
    dialect: bgv
    on Mar 18, 2024
  2. AlexanderViand-Intel commented on Mar 20, 2024

    @AlexanderViand-Intel

    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$)
  3. AlexanderViand-Intel commented on Apr 4, 2024

    @AlexanderViand-Intel

    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.

  4. added
    newcomer project
    on Jun 30, 2024
  5. changed the title [-]bgv: parameter selection computations during lowerings for BGV[/-] [+]parameter selection computations during lowerings for BGV/CKKS[/+] on Nov 3, 2024
  6. added
    dialect: ckks
    on Nov 3, 2024
  7. j2kun commented on Feb 27, 2025

    @j2kun
    Collaborator

    @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.

  8. github-actions commented on Mar 3, 2025

    @github-actions

    Note

    Re-commenting because this issue was closed with unresolved TODOs.

    This issue has 1 outstanding TODOs:

    This comment was autogenerated by todo-backlinks

  9. j2kun commented on Mar 3, 2025

    @j2kun
    Collaborator

    Let's move that TODO to a new ticket

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

    dialect: bgvdialect: ckksnewcomer project

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions