From 2f25d5ec7309544ff152bceefb72ecaa5b6fb1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Test=C3=A9?= Date: Thu, 26 Sep 2024 10:28:02 +0200 Subject: [PATCH] chore(shortint): update multi-bit gpu parameters set Update with the latest improvements from the optimizer. --- .github/workflows/gpu_fast_h100_tests.yml | 2 +- .github/workflows/gpu_fast_tests.yml | 2 +- .../workflows/gpu_full_multi_gpu_tests.yml | 2 +- .../gpu_signed_integer_h100_tests.yml | 2 +- .../workflows/gpu_signed_integer_tests.yml | 2 +- .../gpu_unsigned_integer_h100_tests.yml | 2 +- .../workflows/gpu_unsigned_integer_tests.yml | 2 +- .../multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs | 71 +++++++++---------- 8 files changed, 42 insertions(+), 43 deletions(-) diff --git a/.github/workflows/gpu_fast_h100_tests.yml b/.github/workflows/gpu_fast_h100_tests.yml index b42242016b..e1c0b8176b 100644 --- a/.github/workflows/gpu_fast_h100_tests.yml +++ b/.github/workflows/gpu_fast_h100_tests.yml @@ -44,7 +44,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/.github/workflows/gpu_fast_tests.yml b/.github/workflows/gpu_fast_tests.yml index 6025b4f068..5fabcff11e 100644 --- a/.github/workflows/gpu_fast_tests.yml +++ b/.github/workflows/gpu_fast_tests.yml @@ -43,7 +43,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/.github/workflows/gpu_full_multi_gpu_tests.yml b/.github/workflows/gpu_full_multi_gpu_tests.yml index fd1fde920d..5b2e54ec56 100644 --- a/.github/workflows/gpu_full_multi_gpu_tests.yml +++ b/.github/workflows/gpu_full_multi_gpu_tests.yml @@ -44,7 +44,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/.github/workflows/gpu_signed_integer_h100_tests.yml b/.github/workflows/gpu_signed_integer_h100_tests.yml index 41b1b5a9d1..1e99fcd13f 100644 --- a/.github/workflows/gpu_signed_integer_h100_tests.yml +++ b/.github/workflows/gpu_signed_integer_h100_tests.yml @@ -45,7 +45,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/.github/workflows/gpu_signed_integer_tests.yml b/.github/workflows/gpu_signed_integer_tests.yml index 7830cb8994..9d54a9764d 100644 --- a/.github/workflows/gpu_signed_integer_tests.yml +++ b/.github/workflows/gpu_signed_integer_tests.yml @@ -52,7 +52,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/.github/workflows/gpu_unsigned_integer_h100_tests.yml b/.github/workflows/gpu_unsigned_integer_h100_tests.yml index 1e39b65079..49d5d93107 100644 --- a/.github/workflows/gpu_unsigned_integer_h100_tests.yml +++ b/.github/workflows/gpu_unsigned_integer_h100_tests.yml @@ -45,7 +45,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/.github/workflows/gpu_unsigned_integer_tests.yml b/.github/workflows/gpu_unsigned_integer_tests.yml index 55cad79964..5c6c972b37 100644 --- a/.github/workflows/gpu_unsigned_integer_tests.yml +++ b/.github/workflows/gpu_unsigned_integer_tests.yml @@ -52,7 +52,7 @@ jobs: - backends/tfhe-cuda-backend/** - tfhe/src/core_crypto/gpu/** - tfhe/src/integer/gpu/** - - tfhe/shortint/parameters/** + - tfhe/src/shortint/parameters/** - tfhe/src/high_level_api/** - tfhe/src/c_api/** - 'tfhe/docs/**.md' diff --git a/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs b/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs index 58f233cc49..0e4cf20b4d 100644 --- a/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs +++ b/tfhe/src/shortint/parameters/multi_bit/p_fail_2_minus_64/ks_pbs_gpu.rs @@ -5,40 +5,39 @@ use crate::shortint::parameters::{CarryModulus, MessageModulus}; // Group 2 -// p-fail = 2^-64.577, algorithmic cost ~ 65, 2-norm = 3 +// p-fail = 2^-64.545, algorithmic cost ~ 62, 2-norm = 3 pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { - lwe_dimension: LweDimension(786), - glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + lwe_dimension: LweDimension(718), + glwe_dimension: GlweDimension(2), + polynomial_size: PolynomialSize(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( - 8.135492209468212e-06, + 2.62974076167165e-05, )), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.845267479601915e-15, )), - pbs_base_log: DecompositionBaseLog(23), + pbs_base_log: DecompositionBaseLog(22), pbs_level: DecompositionLevelCount(1), - ks_base_log: DecompositionBaseLog(4), - ks_level: DecompositionLevelCount(3), + ks_base_log: DecompositionBaseLog(3), + ks_level: DecompositionLevelCount(5), message_modulus: MessageModulus(2), carry_modulus: CarryModulus(2), max_noise_level: MaxNoiseLevel::new(3), - log2_p_fail: -64.577, + log2_p_fail: -64.545, ciphertext_modulus: CiphertextModulus::new_native(), encryption_key_choice: EncryptionKeyChoice::Big, grouping_factor: LweBskGroupingFactor(2), deterministic_execution: false, }; - -// p-fail = 2^-64.605, algorithmic cost ~ 83, 2-norm = 5 +// p-fail = 2^-64.725, algorithmic cost ~ 82, 2-norm = 5 pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { - lwe_dimension: LweDimension(842), + lwe_dimension: LweDimension(836), glwe_dimension: GlweDimension(1), polynomial_size: PolynomialSize(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( - 3.0957909745987987e-06, + 3.433444883863949e-06, )), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.845267479601915e-15, @@ -50,20 +49,20 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: message_modulus: MessageModulus(4), carry_modulus: CarryModulus(4), max_noise_level: MaxNoiseLevel::new(5), - log2_p_fail: -64.605, + log2_p_fail: -64.725, ciphertext_modulus: CiphertextModulus::new_native(), encryption_key_choice: EncryptionKeyChoice::Big, grouping_factor: LweBskGroupingFactor(2), deterministic_execution: false, }; -// p-fail = 2^-64.168, algorithmic cost ~ 661, 2-norm = 9 +// p-fail = 2^-64.367, algorithmic cost ~ 657, 2-norm = 9 pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { - lwe_dimension: LweDimension(984), + lwe_dimension: LweDimension(978), glwe_dimension: GlweDimension(1), polynomial_size: PolynomialSize(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( - 2.671498718807819e-07, + 2.962875621642539e-07, )), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.168404344971009e-19, @@ -75,7 +74,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: message_modulus: MessageModulus(8), carry_modulus: CarryModulus(8), max_noise_level: MaxNoiseLevel::new(9), - log2_p_fail: -64.168, + log2_p_fail: -64.367, ciphertext_modulus: CiphertextModulus::new_native(), encryption_key_choice: EncryptionKeyChoice::Big, grouping_factor: LweBskGroupingFactor(2), @@ -83,65 +82,65 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_2_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: }; // Group 3 -// p-fail = 2^-64.579, algorithmic cost ~ 73, 2-norm = 3 + +// p-fail = 2^-68.192, algorithmic cost ~ 64, 2-norm = 3 pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_1_CARRY_1_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { - lwe_dimension: LweDimension(786), - glwe_dimension: GlweDimension(4), - polynomial_size: PolynomialSize(512), + lwe_dimension: LweDimension(720), + glwe_dimension: GlweDimension(2), + polynomial_size: PolynomialSize(1024), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( - 8.135492209468212e-06, + 2.540544392252957e-05, )), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.845267479601915e-15, )), pbs_base_log: DecompositionBaseLog(22), pbs_level: DecompositionLevelCount(1), - ks_base_log: DecompositionBaseLog(4), - ks_level: DecompositionLevelCount(3), + ks_base_log: DecompositionBaseLog(3), + ks_level: DecompositionLevelCount(5), message_modulus: MessageModulus(2), carry_modulus: CarryModulus(2), max_noise_level: MaxNoiseLevel::new(3), - log2_p_fail: -64.579, + log2_p_fail: -68.192, ciphertext_modulus: CiphertextModulus::new_native(), encryption_key_choice: EncryptionKeyChoice::Big, grouping_factor: LweBskGroupingFactor(3), deterministic_execution: false, }; -// p-fail = 2^-65.005, algorithmic cost ~ 79, 2-norm = 5 +// p-fail = 2^-64.655, algorithmic cost ~ 79, 2-norm = 5 pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_2_CARRY_2_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { - lwe_dimension: LweDimension(843), + lwe_dimension: LweDimension(837), glwe_dimension: GlweDimension(1), polynomial_size: PolynomialSize(2048), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( - 3.0428360625436423e-06, + 3.3747142481837397e-06, )), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.845267479601915e-15, )), - pbs_base_log: DecompositionBaseLog(22), + pbs_base_log: DecompositionBaseLog(21), pbs_level: DecompositionLevelCount(1), ks_base_log: DecompositionBaseLog(3), ks_level: DecompositionLevelCount(5), message_modulus: MessageModulus(4), carry_modulus: CarryModulus(4), max_noise_level: MaxNoiseLevel::new(5), - log2_p_fail: -65.005, + log2_p_fail: -64.655, ciphertext_modulus: CiphertextModulus::new_native(), encryption_key_choice: EncryptionKeyChoice::Big, grouping_factor: LweBskGroupingFactor(3), deterministic_execution: false, }; - -// p-fail = 2^-64.173, algorithmic cost ~ 645, 2-norm = 9 +// p-fail = 2^-64.372, algorithmic cost ~ 641, 2-norm = 9 pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: MultiBitPBSParameters = MultiBitPBSParameters { - lwe_dimension: LweDimension(984), + lwe_dimension: LweDimension(978), glwe_dimension: GlweDimension(1), polynomial_size: PolynomialSize(8192), lwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( - 2.671498718807819e-07, + 2.962875621642539e-07, )), glwe_noise_distribution: DynamicDistribution::new_gaussian_from_std_dev(StandardDev( 2.168404344971009e-19, @@ -153,7 +152,7 @@ pub const PARAM_GPU_MULTI_BIT_GROUP_3_MESSAGE_3_CARRY_3_KS_PBS_GAUSSIAN_2M64: message_modulus: MessageModulus(8), carry_modulus: CarryModulus(8), max_noise_level: MaxNoiseLevel::new(9), - log2_p_fail: -64.173, + log2_p_fail: -64.372, ciphertext_modulus: CiphertextModulus::new_native(), encryption_key_choice: EncryptionKeyChoice::Big, grouping_factor: LweBskGroupingFactor(3),