File size: 2,778 Bytes
0624b71
 
e40d189
0624b71
 
 
 
 
 
e40d189
0624b71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e40d189
 
 
0624b71
 
 
 
 
 
8dd84df
 
0624b71
e40d189
 
 
 
0624b71
8dd84df
 
0624b71
 
 
 
 
 
 
 
 
8dd84df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Figure Data Extraction and Reproduction

This folder contains the data used in Figure 2, Figure 3, and Figure 4 from the Training Lipschitz Transformer paper and scripts to reproduce the figures from the saved CSV files.

## Files

- `reproduce_figures.py`: Script to reproduce the figures from the saved CSV files
- `requirements.txt`: Python dependencies required to run the scripts
- `figure_2/`: Directory containing the CSV files for each subplot of Figure 2
- `figure_3/`: Directory containing the CSV files and a PDF for Figure 3
- `figure_4/`: Directory containing the CSV files for each subplot of Figure 4

## Usage

### 1. Install Dependencies

```bash
pip install -r requirements.txt
```

### 2. Reproduce Figures

Run the reproduction script to create the figures from the CSV files:

```bash
python reproduce_figures.py
```

This will create:
- `figure_2_reproduced.pdf`: Recreation of Figure 2
- `figure_3_reproduced.pdf`: Recreation of the right panel of Figure 3
- `figure_4_reproduced.pdf`: Recreation of Figure 4

## CSV File Structure

Each CSV file contains the processed data for its respective subplot:

### Figure 2 Files
- **figure_2_subplot_1.csv**: MLP model results with frontier points for different optimizers and techniques
- **figure_2_subplot_2.csv**: Transformer model results with frontier points for different optimizers and techniques

### Figure 3 Files
- **figure_3_subplot_1.pdf**: Contains the left panel of Figure 3 with adversarial examples pre-made from the models contained in the `models/MLPs/` directory
- **figure_3_subplot_2.csv**: Contains adversarial robustness data with columns for model_name, epsilon (adversarial perturbation budget), accuracy, avg_correct_prob (mean probability for correct class), and prob_error_bar (error bars for probability measurements)

### Figure 4 Files
- **figure_4_subplot_1.csv**: Contains points used to plot the frontier of validation loss vs. Lipschitz constant with columns for technique, learning rate, w_max, final validation loss, Lipschitz constant, optimizer, etc.
- **figure_4_subplot_2_3.csv**: Contains results for top validation accuracy model for each of our tested techniques with columns for technique, learning rate, w_max, final validation accuracy, Lipschitz constant, optimizer, etc.

## Reproducibility

The reproduction script creates pixel-perfect recreations of the original figures with:
- Identical color schemes and marker styles
- Same axis scaling and formatting
- Matching legend positioning and styling
- Equivalent subplot layouts and spacing

This ensures full reproducibility of Figure 2 (MLP and Transformer optimizer comparisons), Figure 3 (adversarial robustness analysis), and Figure 4 (Lipschitz weight constraints comparison) from the saved CSV data.