Skip to content

Conversation

@ZenithalHourlyRate
Copy link
Collaborator

@ZenithalHourlyRate ZenithalHourlyRate commented Nov 10, 2025

The prime selection logic from #1400 for CKKS just uses the same prime selection logic as BGV, and might cause some severe scaling factor mismatch issue / rescaling noise due to the nature of RNS-CKKS instantiation.

To better mitigate the issue, CKKS should have its own prime selection logic, and OpenFHE is the standard reference.

This also helps #2364 and #2379. I believe with this PR, the high-precision level-specific scaling factor in populate-scale-ckks can be safely instantiated after the "reduced error" prime selection logic in generate-param-ckks.

Relates to #1640 but that issue has lots of TODO related to high precision scaling factor so it can not be closed.

For @j2kun: Can the specific issue in #2364 be reproduced with these prime selection logic?

Copy link
Collaborator

@j2kun j2kun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!


/// By original we mean the method in RNS-CKKS implementation
/// Corresponds to FIXED* in OpenFHE
static std::vector<int64_t> moduliQGenerationOriginal(int logFirstMod,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just call it moduliQGenerationOpenFHEFixed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name changed.

@j2kun
Copy link
Collaborator

j2kun commented Nov 13, 2025

For @j2kun: Can the specific issue in #2364 be reproduced with these prime selection logic?

The problem in that situation was that the parameters were selected before HEIR, so I don't get to select parameters.

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Nov 13, 2025
@copybara-service copybara-service bot merged commit 0d623e9 into google:main Nov 18, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants