Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In CKKS, knowing the range of the plaintext inside each ciphertext is crucial for (worst-case) noise analysis (e.g. #1685), and further the selection of parameters.
Currently we have the following ways to know the range
As an example, the current parameter generation process is modified to use the analysed range to select first-mod-bits when the user specifies the first-mod-bits to be 0; other usage will be explored in further noise model PRs.
Example
The dot_product_8f example is an inner product of
[-1, 1] : <8xf32>with addition of0.1 : f32, so maximal possible value is 8.1, and the analyse result isNote that if we use plaintext backend, it will infer that the maximal value is 2.5, and select a smaller parameter; when the user changes the input, the selected parameter may not be valid.
Then the parameter selection process chose 51 as its first mod bits
Limitation
For now only the dot_product example (and the cross_level example, which requires 12 extra bits) can work through the analysis; other example like hv_matmul does not have the range result due to complex IR structure.