## 5 Proposed Approach and System
### Local Computation
In order to ensure the verifiability of these shares, device \(i\) also publicly discloses the commitments \(\{\mathbf{c}_{im}\}_{m\in[1,M]}\) to the coefficients of \(f_{i}\) to all edge nodes. These commitments are defined as: \[\mathbf{c}_{im}=\left\{ \begin{array}{cl}\psi\bar{\mathbf{g}}_{i}^{(t)}&for \ m=0\\ \psi^{\mathbf{r}_{im}}&for\ m=1,\cdots,T\end{array} \right.,\] (19) where \(\psi\) represents a generator of \(\mathbb{F}_{p}\), and all computations are performed modulo \(\lambda\), with \(\lambda\) defined as a large prime such that \(p\) divides \(\lambda-1\). ### Secure Similarity Computation

Algorithm 1 outlines the similarity computation processes as follows:

1. Partial similarity computation: In our privacy-preserving similarity computation method, each edge node calculates partial similarities using the secret shares of gradients provided by all devices. Specifically, edge node \(m\) computes the partial similarities as \[\llbracket\bar{\mathbf{c}}_{i}^{(t)}\rrbracket_{T}^{m}=\llbracket\bar{ \mathbf{g}}_{i}^{(t)}\rrbracket_{T}^{m}\odot\sum_{i=1}^{T}\llbracket\bar{ \mathbf{g}}_{i}^{(t)}\rrbracket_{T}^{m},\] (20) where \(\llbracket\bar{\mathbf{g}}_{i}^{(t)}\rrbracket_{T}^{m}\) represents the normalized gradient of each device \(C_{i}\), and \(\sum_{i=1}^{T}\llbracket\bar{\mathbf{g}}_{i}^{(t)}\rrbracket_{T}^{m}\) denotes the sum of all gradients. 2. Publication: Each edge node \(m\) publicly discloses the partial similarities \(\{\llbracket\bar{\mathbf{c}}_{i}^{(t)}\rrbracket_{T}^{m}\}_{i\in[1,N]}\) on the blockchain. 3. Similarity reconstruction: Upon receiving adequate partial similarities from multiple edge nodes, the smart contract is activated to reconstruct the quantized similarities\(\mathcal{G}_{i}^{(t)}\) using Lagrange interpretation. Subsequently, the smart contract converts \(\mathcal{G}_{i}^{(t)}\) from the finite field to the real domain. \[cs_{i}^{(t)}=\frac{\phi^{-1}(\mathcal{G}_{i}^{(t)})}{q^{2}} \tag{21}\]

for \(i\in[1,N]\), where \(q\) is the integer parameter in Equation (17) and the de-mapping function \(\phi^{-1}:\mathbb{F}_{p}\rightarrow\mathbb{R}\) is defined as follows:

\[\phi^{-1}(\tilde{x})= \begin{cases}&\tilde{x}\quad if\ 0\leq\tilde{x}\leq\frac{p-1}{2} \\ &\tilde{x}-p\quad if\ \frac{p-1}{2}\leq\tilde{x}\leq p\end{cases} . \tag{22}\]

The variable \(\mathcal{G}_{i}^{(t)}\) quantifies the alignment between the normalized gradient \(\widetilde{\mathbf{g}}_{i}^{(t)}\) of each device \(i\) and the total gradient sum \(\sum_{i=1}^{N}\widetilde{\mathbf{g}}_{i}^{(t)}\). A negative value of \(\mathcal{G}_{i}^{(t)}\) indicates an opposite direction between \(\widetilde{\mathbf{g}}_{i}^{(t)}\) and \(\sum_{i=1}^{N}\widetilde{\mathbf{g}}_{i}^{(t)}\), which can detrimtally impact the global model. To filter out adversarial gradients during aggregation, the rectified linear unit (ReLU) function is employed:

\[ReLU(x)= \begin{cases}x\quad if\ x>0\\ 0\quad if\ x\leq 0\end{cases} . \tag{23}\]

This allows us to compute the score \(S_{i}^{(t)}=ReLU(\mathcal{G}_{i}^{(t)})\) for each device \(j\). Subsequently, the smart contract broadcasts \(\{S_{i}^{(t)}=ReLU(\mathcal{G}_{i}^{(t)})\}_{i\in[1,N]}\) to all edge nodes. ### Secure Model Aggregation

1. Local gradient aggregation: Each edge node \(m\) locally aggregates the secret shares, weighted by their corresponding scores. \[[\bar{\mathbf{g}}^{(t)}]_{T}^{m}=\frac{1}{sum}\sum_{i=0}^{N}S_{i}^{t}\cdot[ \bar{\mathbf{g}}_{i}^{(t)}]_{T}^{m},\] (24) where \(sum=\sum_{i=1}^{N}S_{i}^{t}\). The entity then publishes \([\bar{\mathbf{g}}^{t}]_{T}^{i}\) to the blockchain for public verification. 2. Reconstruction of the global gradients: Upon receiving computation results from a sufficient number of devices, the smart contract is activated to reconstruct the quantized global gradients \(\bar{\mathbf{g}}^{(t)}\) through Lagrange interpretation.