This document explains the implications and configuration of multi parameters in Concrete.
In Concrete, integers are encrypted and processed based on a set of cryptographic parameters. By default, the Concrete optimizer selects multiple sets of these parameters, which may not be optimal for every use case. In such cases, you can choose to use mono parameters instead.
When multi parameters are enabled, the optimizer selects a different set of parameters for each bit-width in the circuit. This approach has several implications:
Faster execution in general
Slower key generation
Larger keys
Larger memory usage during execution
When enabled, you can control the level of circuit partitioning by setting the multi_parameter_strategy as described in configuration.
To disable multi parameters, use parameter_selection_strategy=fhe.ParameterSelectionStrategy.MONO
configuration option.
This document explains the multi-precision option for bit-width assignment for integers.
The multi-precision option enables the frontend to use the smallest bit-width possible for each operation in Fully Homomorphic Encryption (FHE), improving computation efficiency.
Each integer in the circuit has a certain bit-width, which is determined by the input-set. These bit-widths are visible when graphs are printed, for example:
However, adding integers with different bit-widths (for example, 3-bit and 4-bit numbers) directly isn't possible due to differences in encoding, as shown below:
When you add a 3-bit number and a 4-bit number, the result is a 5-bit number with a different encoding:
To address these encoding differences, a graph processing step called bit-width assignment is performed. This step updates the graph's bit-widths to ensure compatibility with Fully Homomorphic Encryption (FHE).
After this step, the graph might look like this:
Most operations cannot change the encoding, requiring the input and output bit-widths to remain the same. However, the table lookup operation can change the encoding. For example, consider the following graph:
This graph represents the computation (x**2) + y
where x
is 2-bits and y
is 5-bits. Without the ability to change encodings, all bit-widths would need to be adjusted to 6-bits. However, since the encoding can change, bit-widths are assigned more efficiently:
In this case, x
remains a 2-bit integer, but the Table Lookup result and y
are set to 6-bits to allow for the addition.
This approach to bit-width assignment is known as multi-precision and is enabled by default. To disable multi-precision and enforce a single precision across the circuit, use the single_precision=True
configuration option.