adamuremek commited on
Commit
941c2a7
·
verified ·
1 Parent(s): de45830

Update model card with baseline comparison

Browse files
Files changed (1) hide show
  1. README.md +25 -14
README.md CHANGED
@@ -42,17 +42,26 @@ allow about 1% false alarms, then fixed; the 2026 test set was scored once.
42
 
43
  Test confusion matrix: 4,230 benign correct, 51 benign flagged, 1,278 malware caught, 851 malware missed.
44
 
45
- ### Compared with a simple baseline
46
 
47
- The baseline is gradient-boosted trees (LightGBM) on a byte histogram, byte entropy and file size.
 
48
 
49
- | Model | Validation AUC | Test AUC | Test detection at 1% false positives |
 
 
 
50
  |---|---|---|---|
51
- | Baseline (LightGBM on byte counts) | 0.980 | 0.923 | 43.3% |
52
- | **This model** | **0.984** | **0.952** | **58.4%** |
 
 
 
 
 
53
 
54
- The two are close on 2025 files. The neural network's advantage shows on 2026 files, where it detects
55
- about 15 percentage points more malware at the same false-alarm rate.
56
 
57
  ### Why the test score is lower than validation
58
 
@@ -86,10 +95,11 @@ python src/predict.py /path/to/file.exe
86
 
87
  ```python
88
  import sys; sys.path.insert(0, "src")
89
- from predict import predict
90
 
91
- predict("/path/to/file.exe")
92
- # {'label': 'benign', 'probability': 0.0003, 'threshold': 0.9856, 'size_bytes': 245760}
 
93
  ```
94
 
95
  The file is opened read-only and read as bytes, 1 MB at a time. It is never executed.
@@ -125,9 +135,10 @@ This is a research and learning project, not a replacement for antivirus softwar
125
  |---|---|
126
  | `dataset/` | Manifest, build script, numeric features and the dataset README |
127
  | `notebooks/part1_data_exploration.ipynb` | Data exploration and justification |
128
- | `notebooks/part2_model.ipynb` | Model training and evaluation *(in preparation)* |
129
- | `model/model.pt` | Trained weights with the decision threshold stored inside |
130
- | `model/test_results.json`, `model/roc_final.png` | Validation and test figures, ROC curves |
131
- | `src/` | Model definition (`whole_model.py`), `predict.py`, training and evaluation scripts |
 
132
  | `requirements.txt` | Python packages needed |
133
  | `app/app.py` | Drag-and-drop demo *(in preparation)* |
 
42
 
43
  Test confusion matrix: 4,230 benign correct, 51 benign flagged, 1,278 malware caught, 851 malware missed.
44
 
45
+ ### Compared with two baselines
46
 
47
+ Both baselines were trained on the same files and scored on the same test set, each with its own
48
+ threshold chosen on validation for 1% false alarms.
49
 
50
+ - **MalConv** (Raff et al., 2017): a byte-level convolutional network that reads the first 1 MB.
51
+ - **LightGBM** on a byte histogram, byte entropy and file size.
52
+
53
+ | Test set (2026) | MalConv | LightGBM | **This model** |
54
  |---|---|---|---|
55
+ | Parameters | 1,042,953 | – | **534,098** |
56
+ | AUC | 0.860 | 0.923 | **0.952** |
57
+ | Malware detected (recall) | 34.3% | 44.4% | **60.0%** |
58
+ | Precision | 95.3% | 95.3% | **96.2%** |
59
+ | F1 | 0.504 | 0.606 | **0.739** |
60
+ | Balanced accuracy | 66.7% | 71.6% | **79.4%** |
61
+ | False-positive rate | 0.84% | 1.10% | 1.19% |
62
 
63
+ On validation (2025) the three score an AUC of 0.957, 0.980 and 0.984. The gap widens on 2026 files:
64
+ this model detects nearly twice as much new malware as MalConv with half the parameters.
65
 
66
  ### Why the test score is lower than validation
67
 
 
95
 
96
  ```python
97
  import sys; sys.path.insert(0, "src")
98
+ from predict import load_model, predict
99
 
100
+ model, threshold = load_model() # model/model.pt + model/model_config.json
101
+ predict("/path/to/file.exe", model, threshold=threshold)
102
+ # "Malware" or "Benign" (or a message if the file is not a PE file)
103
  ```
104
 
105
  The file is opened read-only and read as bytes, 1 MB at a time. It is never executed.
 
135
  |---|---|
136
  | `dataset/` | Manifest, build script, numeric features and the dataset README |
137
  | `notebooks/part1_data_exploration.ipynb` | Data exploration and justification |
138
+ | `notebooks/part2_model.ipynb` | MalConv baseline, model design, training, threshold choice and test evaluation |
139
+ | `model/model.pt`, `model/model_config.json` | Trained weights (plain `state_dict`), network settings and decision threshold |
140
+ | `model/malconv_baseline.pt` | Weights of the MalConv baseline |
141
+ | `model/test_results.json`, `model/malconv_test_results.json`, `model/roc_final.png` | Validation and test figures, ROC curves |
142
+ | `src/` | Model definition (`whole_model.py`), MalConv (`malconv.py`), `predict.py`, training and evaluation scripts |
143
  | `requirements.txt` | Python packages needed |
144
  | `app/app.py` | Drag-and-drop demo *(in preparation)* |