Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGMA README Updates #220

Merged
merged 46 commits into from
May 30, 2024
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
30679ff
Adding GPU-MPC
May 17, 2024
3631ee6
Adding gitignore
May 17, 2024
87eae6b
Added weights as a submodule
May 17, 2024
02d429b
Added mnist as a submodule
May 17, 2024
7ef4472
Added cutlass as a submodule
May 17, 2024
a4f613a
Added SEAL as a submodule
May 17, 2024
28a6b8d
Fixed plots for sequential runs of Fig5a and Fig5b
May 18, 2024
2de6295
Added test for rotary embedding
May 21, 2024
22775c1
Removed printfs
May 22, 2024
a3af98f
Changed llama13b parameters
May 22, 2024
a53836e
Added a flag for correctness
May 24, 2024
22f7bf6
Added support for llama on the cpu
May 26, 2024
7e27e28
Added run_experiment.py
May 26, 2024
b744ce5
Added sigma.h
May 26, 2024
f81f8e5
Changed keybuf size
May 27, 2024
561b739
Changed keybuf size
May 27, 2024
ae64b28
Increased input bitlength of softmax
May 27, 2024
a855f05
Updated README.md
May 27, 2024
5163855
Create README.md
neha-jawalkar May 27, 2024
c06b675
Update README.md
neha-jawalkar May 27, 2024
0068691
Create README.md
neha-jawalkar May 27, 2024
076dc67
Update README.md
neha-jawalkar May 27, 2024
fc1f0d6
Update README.md
neha-jawalkar May 27, 2024
c423f4c
Update README.md
neha-jawalkar May 27, 2024
b1a46d8
Update README.md
neha-jawalkar May 27, 2024
70b94fa
Update README.md
neha-jawalkar May 27, 2024
e31a09e
Update README.md
neha-jawalkar May 27, 2024
2810cc2
Update README.md
neha-jawalkar May 27, 2024
d5538a0
Update README.md
neha-jawalkar May 27, 2024
b77979b
Update README.md
neha-jawalkar May 27, 2024
c3a5c46
Update README.md
neha-jawalkar May 27, 2024
a9c6df1
Update config.json
neha-jawalkar May 27, 2024
877453b
Merge remote-tracking branch 'origin/sigma-2'
May 28, 2024
70689c0
Legend in Fig11 and changed paths in llama7b.cpp
May 28, 2024
6e4216d
Update README.md
neha-jawalkar May 28, 2024
54c62ae
Update README.md
neha-jawalkar May 28, 2024
f1bcc31
Update README.md
neha-jawalkar May 29, 2024
fc7f7dd
Explicitly setting the path for cuda toolkit in sytorch
May 29, 2024
27e5da6
Updated README and sigma.cu
May 29, 2024
a3fa0e1
Updated README.md
May 29, 2024
78cd153
Updated run_experiment.py and sigma.cu
May 29, 2024
8d7f83c
Not reserving mempool
May 29, 2024
052fa09
Fixed error
May 29, 2024
50a1bf1
Update README.md
neha-jawalkar May 30, 2024
76f2b46
Update README.md
neha-jawalkar May 30, 2024
2fb7a5d
Fixed merge conflicts in SIGMA README
May 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 10 additions & 27 deletions GPU-MPC/experiments/sigma/README.md
Original file line number Diff line number Diff line change
@@ -55,62 +55,45 @@ cd experiments/sigma

### Prerequisites and caveats

1. Since FSS generates large keys, please ensure that you have a writeable disk with at least 500GB of free space. This is only required by our largest model (Llama2-13B). Other models require less space, and an idea of how much free space is needed per model can be estimated from the key size reported in Table 9 of the paper.

2. In the online phase, SIGMA loads the entire key from the disk into CPU memory. Thus, the CPU must have (free) memory that is at least as large as the key that will be read from the disk.
1. Since FSS generates large keys, writing keys to disk and reading keys from disk can take a long time. To ensure that the artifact runs in a reasonable amount of time, we avoid going to disk and instead have the dealer generate keys in CPU memory. These keys are then used by the evaluator. Please make sure that the CPU memory is large enough to support the key size of the model being run. Key sizes can be estimated from Table 9 of the paper.

3. Currently, we only support sequence lengths that are powers-of-2.


### Run standalone

Make produces the `sigma` executable which is in `experiments/sigma`.

Each party (the server and the client) needs to run two processes in sequence: the dealer and the evaluator. In addition to other arguments, the dealer requires the user to specify the directory in which it will store keys (see prerequisites and caveats). The evaluator requires the user to specify the directory to read keys from, the IP address of its peer, and the number of CPU threads to use for computation.

The syntax for running the dealer is
```javascript
./sigma <model name> <sequence length> <role=0 for dealer> <party=0/1 (server/client)> <key directory>
```
Make produces the `sigma` executable which is in `experiments/sigma`. Each party (the server and the client) needs to run this executable. The executable requires the user to specify the model, sequence length, party number (0 for the server/1 for the client), the IP address of the other party, and the number of CPU threads to use for computation.

The syntax for running the evaluator is
The syntax is
```javascript
./sigma <model name> <sequence length> <role=1 for evaluator> <party=0/1 (server/client)> <key directory> <peer IP> <CPU threads>`
./sigma <model name> <sequence length> <party=0/1 (server/client)> <peer IP> <CPU threads>
```

We currently support the following models: `bert-tiny, bert-base, bert-large, gpt2, llama-7b, llama-13b`.

**Example:** To run GPT2, the server will run (in sequence):
**Example:** To run GPT2, the server will run:
```javascript
./sigma gpt2 128 0 0 /tmp/
./sigma gpt2 128 1 0 /tmp/ <client IP> 64
./sigma gpt2 128 0 <client IP> 64
```

The client will run (_on a different machine_):
```javascript
./sigma gpt2 128 0 1 /tmp/
./sigma gpt2 128 1 1 /tmp/ <server IP> 64
./sigma gpt2 128 1 <server IP> 64
```

Results are stored in the `output/P<party number>/models/<model name>-<sequence length>/` folder.

### Running the artifact

Before the artifact can be run, we need to specify the dealer and evaluator configurations in `config.json`.
Before the artifact can be run, we need to configure it via `config.json`.

For the server(=P0), `config.json` looks like:
```javascript
{
"P0": {
"dealer": {
"gpu": <The ID of the GPU to use>,
"key_dir": <The directory in which the dealer will store keys>
},
"evaluator": {
"gpu": <The ID of the GPU to use>,
"peer": <The IP address of the remote peer>,
"cpu_threads": <The number of CPU threads to use for computation>
}
}
}
```
@@ -132,9 +115,9 @@ optional arguments:

Table 7 can be reproduced by throttling the network bandwidth (with `tc`, for example) and re-running `python run_experiment.py --perf true` to generate Table 5.

Results are stored in `output/P<party-number>/Table<table-number>.json` or `output/P<party-number>/Fig<figure-number>.json`.
Results are stored in `output/P<party-number>/Table<table-number>.json` or `output/P<party-number>/Fig<figure-number>.png`.

Log files (which might help with debugging) can be found in the `output/P<party number>/models/<model name>-<sequence length>/logs/` folder.
Log files (which might help with debugging) can be found in the `output/P<party number>/models/<model name>-<sequence length>/logs.txt` file.


## Citation