Update README.md
Browse files
README.md
CHANGED
@@ -18,13 +18,14 @@ dataset_info:
|
|
18 |
num_examples: 76
|
19 |
download_size: 53832
|
20 |
dataset_size: 87854
|
|
|
21 |
---
|
22 |
# Static Analysis Eval Benchmark
|
23 |
|
24 |
A dataset of 76 Python programs taken from real Python open source projects (top 1000 on GitHub),
|
25 |
where each program is a file that has exactly 1 vulnerability as detected by a particular static analyzer (Semgrep).
|
26 |
|
27 |
-
You can run the `_script_for_eval.py` to check the results.
|
28 |
|
29 |
```
|
30 |
python3 -m venv .venv
|
@@ -36,7 +37,7 @@ python _script_for_eval.py
|
|
36 |
For all supported options, run with `--help`:
|
37 |
|
38 |
```
|
39 |
-
usage: _script_for_eval.py
|
40 |
|
41 |
Run Static Analysis Evaluation
|
42 |
|
@@ -46,6 +47,7 @@ options:
|
|
46 |
--cache Enable caching of results
|
47 |
--n_shot N_SHOT Number of examples to use for few-shot learning
|
48 |
--use_similarity Use similarity for fetching dataset examples
|
|
|
49 |
```
|
50 |
|
51 |
We need to use the logged in version of Semgrep to get access to more rules for vulnerability detection. So, make sure you login before running the eval script.
|
@@ -57,8 +59,10 @@ API token already exists in /Users/user/.semgrep/settings.yml. To login with a d
|
|
57 |
|
58 |
After the run, the script will also create a log file which captures the stats for the run and the files that were fixed.
|
59 |
You can see an example [here](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-mini_semgrep_1.85.0_20240818_215254.log).
|
|
|
|
|
60 |
|
61 |
-
We did some detailed
|
62 |
|
63 |
| Model | Score | Logs |
|
64 |
|:-----:|:-----:|:----:|
|
@@ -67,6 +71,14 @@ We did some detailed evaluation with gpt-4o-mini recently:
|
|
67 |
| gpt-4o-mini + rag (embedding & reranking) | 72.37 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-mini-1-shot-sim_semgrep_1.85.0_20240819_013810.log) |
|
68 |
| gpt-4o-mini + fine-tuned with [synth-vuln-fixes](https://huggingface.co/datasets/patched-codes/synth-vuln-fixes) | 77.63 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/ft_gpt-4o-mini-2024-07-18_patched_patched_9uUpKXcm_semgrep_1.85.0_20240818_220158.log) |
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
# Leaderboard
|
71 |
|
72 |
The top models on the leaderboard are all fine-tuned using the same dataset that we released called [synth vuln fixes](https://huggingface.co/datasets/patched-codes/synth-vuln-fixes).
|
|
|
18 |
num_examples: 76
|
19 |
download_size: 53832
|
20 |
dataset_size: 87854
|
21 |
+
license: apache-2.0
|
22 |
---
|
23 |
# Static Analysis Eval Benchmark
|
24 |
|
25 |
A dataset of 76 Python programs taken from real Python open source projects (top 1000 on GitHub),
|
26 |
where each program is a file that has exactly 1 vulnerability as detected by a particular static analyzer (Semgrep).
|
27 |
|
28 |
+
You can run the `_script_for_eval.py` script to check the results.
|
29 |
|
30 |
```
|
31 |
python3 -m venv .venv
|
|
|
37 |
For all supported options, run with `--help`:
|
38 |
|
39 |
```
|
40 |
+
usage: _script_for_eval.py [-h] [--model MODEL] [--cache] [--n_shot N_SHOT] [--use_similarity] [--oracle]
|
41 |
|
42 |
Run Static Analysis Evaluation
|
43 |
|
|
|
47 |
--cache Enable caching of results
|
48 |
--n_shot N_SHOT Number of examples to use for few-shot learning
|
49 |
--use_similarity Use similarity for fetching dataset examples
|
50 |
+
--oracle Run in oracle mode (assume all vulnerabilities are fixed)
|
51 |
```
|
52 |
|
53 |
We need to use the logged in version of Semgrep to get access to more rules for vulnerability detection. So, make sure you login before running the eval script.
|
|
|
59 |
|
60 |
After the run, the script will also create a log file which captures the stats for the run and the files that were fixed.
|
61 |
You can see an example [here](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-mini_semgrep_1.85.0_20240818_215254.log).
|
62 |
+
Due to the recent versions of Semgrep not detecting a few of the samples in the dataset as vulnerable anymore, the maximum score
|
63 |
+
possible on the benchmark is 77.63%. You can see the oracle run log [here](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/oracle-0-shot_semgrep_1.85.0_20240819_022711.log).
|
64 |
|
65 |
+
We did some detailed evaluations recently (19/08/2024):
|
66 |
|
67 |
| Model | Score | Logs |
|
68 |
|:-----:|:-----:|:----:|
|
|
|
71 |
| gpt-4o-mini + rag (embedding & reranking) | 72.37 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-mini-1-shot-sim_semgrep_1.85.0_20240819_013810.log) |
|
72 |
| gpt-4o-mini + fine-tuned with [synth-vuln-fixes](https://huggingface.co/datasets/patched-codes/synth-vuln-fixes) | 77.63 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/ft_gpt-4o-mini-2024-07-18_patched_patched_9uUpKXcm_semgrep_1.85.0_20240818_220158.log) |
|
73 |
|
74 |
+
|
75 |
+
| Model | Score | Logs |
|
76 |
+
|:-----:|:-----:|:----:|
|
77 |
+
| gpt-4o | 68.42 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-0-shot_semgrep_1.85.0_20240819_015355.log)|
|
78 |
+
| gpt-4o + 3-shot prompt | 77.63 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-3-shot_semgrep_1.85.0_20240819_020525.log)|
|
79 |
+
| gpt-4o + rag (embedding & reranking) | 77.63 | [link](https://huggingface.co/datasets/patched-codes/static-analysis-eval/blob/main/gpt-4o-1-shot-sim_semgrep_1.85.0_20240819_023323.log) |
|
80 |
+
<!-- | gpt-4o + fine-tuned with [synth-vuln-fixes](https://huggingface.co/datasets/patched-codes/synth-vuln-fixes) | 77.63 | [link]() |
|
81 |
+
-->
|
82 |
# Leaderboard
|
83 |
|
84 |
The top models on the leaderboard are all fine-tuned using the same dataset that we released called [synth vuln fixes](https://huggingface.co/datasets/patched-codes/synth-vuln-fixes).
|