# FedOpt: Towards Communication Efficiency and Privacy Preservation in Federated Learning
## 4 Federated Optimisation (FedOpt)
### Efficiency and Privacy in FedOpt
#### 4.3.4 Decryption Phase  
Once the local users receive the global encrypted gradient \(E_{add}\), each user begins the decryption process as follows:  
\[\begin{array}{l}E_{add}\mod k\\ =j^{-1}j(\sum_{\rm II=1}^{n}E_{\rm II,k})^{k}+k^{-1}k(\sum_{\rm II=1}^{n}E_{ \rm II,j})^{j}\\ =j^{-1}j(\sum_{\rm II=1}^{n}E_{\rm II,k})^{k-1}(\sum_{\rm II=1}^{n}E_{\rm II,k} )\mod k\\ =\sum_{\rm II=1}^{n}E_{\rm II,k}\mod k\\ =E_{add,k}\mod k\end{array} \tag{11}\]  
In similar fashion,  
\[\begin{array}{l}E_{add}\mod j\\ =k^{-1}k(\sum_{\rm II=1}^{n}E_{\rm II,j})^{j}+j^{-1}j(\sum_{\rm II=1}^{n}E_{ \rm II,k})^{k}\\ =k^{-1}k(\sum_{\rm II=1}^{n}E_{\rm II,j})^{j-1}(\sum_{\rm II=1}^{n}E_{\rm II,j })\mod j\\ =\sum_{\rm II=1}^{n}E_{\rm II,j}\mod j\\ =E_{add,j}\mod j\end{array} \tag{12}\]  
Following the above procedure, the local users utilise the Chinese Remainder Theorem (CRT) in order to obtain the final decrypted global gradients \(B_{\rm II}\)[22]:  
\[E_{add}\equiv\left\{\begin{array}{l}E_{add,j}\mod j\\ E_{add,k}\mod k\end{array}\right. \tag{13}\]  
Since the number of users is sufficient in real-world scenarios, therefore, FedOpt tolerates the users which might drop at any instance of time. Therefore, there is nearly zero effect on eliminating the noises. In the end, each user updates the parameters \(\varpi\) according to \(\varpi\leftarrow\varpi-\frac{\rm II}{N}E_{add}\), where \(N\) is received from the cloud server. Afterwards, the whole operation is performed repeatedly until the loss function \(\varrho\) is achieved.  
The complete FedOpt approach that features two-way (upstream and downstream) compression via SCA and performs optimal encryption through differential privacy is shown in Algorithm 3.  
```
Input : Initial parameters \(\varpi\) Output : Global model with improved parameters\(\varpi_{o}\)
1 Initialisation: all users \(\Pi_{i},i=1,\ldots,\)Total number of users] are initialised with the same parameters \(v_{i}\leftarrow\
u\). Those users who carry different private datasets \(D_{i}\) with \(|\{c:(x,y)\in D_{i}\}|\) = [total classes per user]. The remaining \(\Pi\) are initialised to zero \(\Delta\
u,\mathcal{R}_{i},\mathcal{R}\gets 0\).
2 forepoch \(e=1,\ldots,E\)\(|\)E = Total number of Epochs\(|\)do
3 for\(\Pi_{i}\in\Pi\subseteq\)I(1,\(\ldots,\)[Number of users])do
4 User \(\Pi_{i}\) execute:
5 Plain-text = \(\xi\gets downloads_{CS\rightarrow\Pi_{i}}\) (\(\xi\))
6\(\Delta\
u\leftarrow\text{decrypt}\) (\(\xi\))
7\(v_{i}\gets v_{i}+\Delta\
u\)
8\(\Delta v_{i}\leftarrow\mathcal{R}_{i}+SGD(v_{i},D_{i})-v_{i}\)
9\(\Delta\overline{v_{i}}\gets SCA_{upload}(\Delta v_{i})\)
10\(\mathcal{R}_{i}\leftarrow\Delta v_{i}-\Delta\overline{v_{i}}\)
11\(\xi_{i}\leftarrow\text{encrypt}\) (\(\Delta\overline{v_{i}}\))
12\(upload_{\Pi_{i}\gets CS}(\xi_{i})\)
13 end for
14 Cloud Server CS execute:
15\(collect_{\Pi_{i}\to CS}(\Delta\overline{v_{i}}),e\in\Pi\)
16\(\Delta\
u\leftarrow\mathcal{R}+\frac{1}{\Pi}\sum_{e\in\Pi}\Delta\overline{v_{i}}\)
17\(\Delta\overline{v}\gets SCA_{download}(\Delta\
u)\)
18\(\mathcal{R}\leftarrow\Delta\
u-\Delta\overline{v}\)
19\(v\gets v+\Delta\overline{v_{i}}\)
20\(\xi\leftarrow\text{encrypt}\) \(\Delta\overline{v_{i}}\)
21\(Aggregate_{CS\rightarrow\Pi_{i}}(\xi),i=1,\ldots,GlobalModel\)
22
23 end for return\(\varpi_{o}\)
```  
**Algorithm 3**FedOpt: Communication-Efficiency and Privacy-Preserving