## Instructions for PaddleFL-MPC Model Encryption Demo
([简体中文](./README_CN.md)|English)
### 1. Introduction
This document introduces how to run encrypt PaddlePaddle's model, then train or update encrypted model, or predict with encrypted model. Model encryption is suitable for protecting user data and model.
### 2. Scenarios
Model encryption demo contains three scenarios:
***Encrypt Model and Train**
Each party loads PaddlePadlde model and then encrypts it. Each party feeds the encrypted data to train the encrypted model. Each party can get one share for the encrypted model. PaddlePaddle model can be reconstructed with three encrypted model shares.
***Encrypt Pre-trained Model and Update**
Pre-trained model is encryption and distributed to multipel parties. All parties update the encrypted model by feeding encrypted data. PaddlePaddle model can be reconstructed with three encrypted model shares.
***Encrypt Pre-trained Model and Predict**
Pre-trained model is encryption and distributed to multipel parties. All parties predict encrypted data with encrypted model. Prediction ouput can be reconstructed with three encrypted prediction shares.
3.**Update Model**:Users init mpc context with mpc_init OP, then load encrypted model with `aby3.load_mpc_model`. Users update the encrypted model with encrypted data.
```python
# Step 1. initialize MPC environment and load MPC model into
This figure shows how to predict with encrypted model.
1.**Train Model**:Users train PaddlePaddle model with plaintext data.
2.**Encrypt Model**: Users encrypt model with api `aby3.encrypt_model` and distribute model shares to other users. The api is same with `Update Model`.
3.**Predict Model**: Users initialize mpc context with `mpc_init OP`, then load encrypted model with api `aby3.load_mpc_model`. Users predict encryped data with encryted model.
```python
# Step 1. initialize MPC environment and load MPC model to predict