# ModReduce after EvalMult in CKKS

**URL:** <https://openfhe.discourse.group/t/modreduce-after-evalmult-in-ckks/342>\
**Category:** Library Questions\
**Created:** [February 8, 2023, 4:43am UTC](https://openfhe.discourse.group/t/modreduce-after-evalmult-in-ckks/342 "2023-02-08T04:43:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyptic6796](https://avatars.discourse-cdn.com/v4/letter/c/a6a055/32.png) [@Cyptic6796](https://openfhe.discourse.group/u/Cyptic6796)\
**Post date:** [February 8, 2023, 4:43am UTC](https://openfhe.discourse.group/t/modreduce-after-evalmult-in-ckks/342/1 "2023-02-08T04:43:42Z")

</div>

Hello,  
I have a question regarding the usage of ModReduce after EvalMult.  
In the basic usage of ckks, there is no ModReduce after Evalmult [link](https://github.com/openfheorg/openfhe-development/blob/745a4920fd711d789d08d250f1f444bac23195fd/src/pke/examples/simple-real-numbers.cpp#L198)  
while, in the usage in the threshold ckks, ModReduce is used after EvalMult [link](https://github.com/openfheorg/openfhe-development/blob/745a4920fd711d789d08d250f1f444bac23195fd/src/pke/examples/threshold-fhe.cpp#L544)

From what I understand, modReduce is used to reduce the error from evalmult, is this correct and when should we use ModReduce and when we don’t have to?

Thanks so much for your help!

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [February 9, 2023, 1:47am UTC](https://openfhe.discourse.group/t/modreduce-after-evalmult-in-ckks/342/2 "2023-02-09T01:47:43Z")

</div>

Generally speaking, CKKS requires ModReduce (aka Rescale) after every EvalMult. After EvalMult, the scale of the message gets roughly squared (and the error also increases), and then we need to call ModReduce to go back to original scale of the message (the error gets also scaled down). For a more advanced description, I recommend reading the Introduction of [https://eprint.iacr.org/2020/1118.pdf](https://eprint.iacr.org/2020/1118.pdf)

OpenFHE includes four different variants of CKKS. See **CKKS Scheme** in Section 2.1.1 of [https://eprint.iacr.org/2022/915.pdf](https://eprint.iacr.org/2022/915.pdf) for their description. Note that three of these modes do ModReduce automatically. So you do not need to include these calls explicitly. This is why the basic CKKS example does not have a call to ModReduce or Rescale.
