tfhe-rs icon indicating copy to clipboard operation
tfhe-rs copied to clipboard

Problem with test_tools::assert_noise_distribution

Open mvanbeirendonck opened this issue 2 years ago • 4 comments

Describe the bug There appears to be an inconsistency in test_tools::assert_noise_distribution

This function computes the modular distance of the errors on the torus: https://github.com/zama-ai/concrete/blob/fbca4f8e998628e08a235550e4bb30fdae126972/concrete-core/src/backends/core/private/mod.rs#L119-L122

However, it is often called with std/variance that is the output of concrete-npe:

https://github.com/zama-ai/concrete/blob/fbca4f8e998628e08a235550e4bb30fdae126972/concrete-core/src/backends/core/private/crypto/bootstrap/fourier/tests.rs#L362-L372

Those last standard deviations/variances are not on the torus, but given as u32 or u64.

Because of this inconsistency, even if you introduce maximum errors of +/- 0.5 on the torus in any of those tested routines, the tests will still pass. There are other tests that use assert_noise_distribution where the std or variance input doesn't come from concrete-npe that don't seem to have this problem.

To Reproduce One of the easiest ways to reproduce: just comment out something critical in the external product. The bootstrapping tests will still pass.

mvanbeirendonck avatar Jan 18 '22 11:01 mvanbeirendonck