# LSH Models in Federated Recommendation
## 2 Related Works
### Neural Cooperative Filtering Framework and Process  
The overall framework of the NCF is shown in Figure 1; the first layer of the model accepts two inputs, namely, the user input layer and the item input layer.  
The input layers require only binary labelling (0 or 1) to reflect the historical interaction of users and items. Therefore, one-hot encoding is sufficient. The user and item embedding layer is the second layer.  
The input layer is mapped to the embedding layer to generate hidden vectors for both the user and item. These vectors are then used as inputs to the NCF network, resulting in a prediction score. The model recommendation effect is determined by the dimension and number of the network layers. The NCF model can be formulated as follows:  
\[f(P^{T}v_{u}^{U},Q^{T}v_{i}^{I})=\varphi_{out}(\varphi_{X}(\ldots\varphi_{2}( \varphi_{1}(P^{T}v_{u}^{U},Q^{T}v_{i}^{I}))\ldots)) \tag{1}\]  
where \(\varphi_{i}\) represents the \(i\)-th layer in the NCF, with a total layers of X; \(\varphi_{out}\) represents the output layer. \(P\) and \(Q\) are the user embedding layer parameters and the item embedding layer parameters, respectively. \(v_{u}^{U}\) and \(v_{i}^{I}\) represent the user input vectors and the item input vectors after one-hot encoding, respectively. The model uses cross-entropy as a loss function, as follows:  
\[\text{C}=-\sum_{(u,i)\in\mathcal{Y},y^{-}}y_{ui}\log\hat{y}_{ui}+(1-y_{ui}) \log(1-\hat{y}_{ui}) \tag{2}\]  
where \(\hat{y}_{ui}\) represents the historical interaction results of user \(u\) for item \(i\); if user \(u\) has a scoring record for item \(i\) in the dataset, \(\hat{y}_{ui}\) is equal to 1, otherwise it is 0. The loss function can obtain the optimal results through random gradient descent or the Adam algorithm. In the training process, a positive sample is created using the interaction record between the  
Figure 1: NCF network framework.  
user and the item, labeled as 1. If there is no historical interaction between the user and the item, it is considered a negative sample and labeled as 0.  
Horizontal federated learning is used in NCF to aggregate user privacy data on distributed sides and integrate the model on the server side. A round of federated learning training includes four steps: (1) model initialization, where a model and various parameters are initialized by the central server and sent to each client; (2) local model training, where all online clients train the model delivered by the server on their own local dataset; (3) model aggregation, where after each client has finished their training and uploading, the central server aggregates the model based on the level of client involvement; (4) model update, where the central server distributes the aggregated model to each client, updates the client's model, and then repeats step 2. The formal performance is shown in Equation (3).  
\[w^{*}=\underset{w}{\text{argmin}}\sum_{i=1}^{N}p_{i}F_{i}(w,D_{i}) \tag{3}\]  
where \(F_{i}(\cdot)\) is the local loss function for the \(i\)-th client; usually\(F_{i}(\cdot)\) is set by local experience; \(p_{i}\) is the aggregation weight of the model for the \(i\)-th client.