# Error in decryption result after decimal integer secret sharing

ConRresIm opened this issue · comments

I use the pond protocol for secret sharing, but when I decrypt, the result is wrong。The error mainly occurs when the data value are between 100000 and 1000000000。

**TL;DR** With default settings, Pond is only correct for decimals up to 10^8 - 1. Outside of this bound, the protocol fails (but the security guarantee remains). This can be relaxed & configured using the `fixedpoint_config`

parameter.

TFE (and specifically Pond) implements a fixed-point arithmetic to emulate the usual floating point ops common in TensorFlow. This is controlled by the `fixedpoint_config`

parameter provided to the Pond protocol constructor, and its defaults are defined below:

tf-encrypted/tf_encrypted/protocol/pond/pond.py

Lines 116 to 130 in 8b7cfb3

On most platforms, the first condition will evaluate to True by default, so we will end up with a fixed point config of `fixed64`

.

That is defined as follows:

tf-encrypted/tf_encrypted/tensor/fixed.py

Lines 73 to 80 in 8b7cfb3

The relevant number in your case is `precision_integral=7`

, which says that this fixed-point config can only represent decimals less than 10^(7+1) - 1. In this case, the decimal will be accurate to 8 decimal places (`precision_fractional=8`

). These numbers (as well as the others) have been chosen to be able to fit into the `tf.int64`

data type while still maintaining correctness & security.

Closing this since it's not a bug, feel free to follow up with a comment if that's not the case.

Closing this since it's not a bug, feel free to follow up with a comment if that's not the case.

Closing this since it's not a bug, feel free to follow up with a comment if that's not the case.

there are wrong, for decimals less than or equal to 10 ^ 8-1