Effect of scaleModSize on Multiplication

HI,

I have been studying multiplication in the following code,

I have noticed that scaleModSize =50, gives perfect multiplication. However, scaleModSize =59 gives weird multiplication. The outputs are consistent – that is it continues the same for every run. I would like to know the reason behind this fluctuations. The outputs are as follows:

scaleModSize =50
Given vector 1: (0.25, 0.5, 0.75, 1, 2, 3, 4, 5, … ); Estimated precision: 43 bits

Vector 3: (5, 4, 3, 2, 1, 0.75, 0.5, 0.25, … ); Estimated precision: 43 bits

Multiplication of given vector1 with vector3: (1.25, 2, 2.25, 2, 2, 2.25, 2, 1.25, … ); Estimated precision: 41 bits

scaleModSize =59
Multiplication of given vector1 with vector3: (-0.75, 3.70323e-12, 0.25, 3.69937e-12, 3.69349e-12, 0.25, 3.69187e-12, -0.75, … ); Estimated precision: 48 bits

PS: I have noticed that the scaleModSize=59 the multiplication results is the correct multiplication minus 2.

Thanks very much.

The default firstModSize is 60 bits. When you set scaleModSize to 59 bits and no extra moduli, you leave very little space for the message to be decrypted.

To obtain correct decryption, the expected magnitude of the messages to be decrypted should fit into firstModSize - scaleModSize bits (or otherwise, leave an extra modulus).

Please see the forum posts linked in this thread Crashes when firstModSize and scalingModSize are equal in CKKS - #2 by andreea.alexandru for further explanations.