Add comments-only condition and four-detector SPSS exports

This commit is contained in:
Joren committed 2026-11-16 12:11:26 +01:00
1 parent e4827debdc
commit 67f4821caf
238 files changed
+28080 -1753

No files matched your search

+33 -15
View File
@@ -158,24 +158,40 @@ Paired McNemar on the 157 in-scope samples: **p = 0.125**. This pilot is kept fo
comparison but is superseded by the v2 all-category runs.
Raw per-sample outputs are in `results/deepseek-v2-*.csv`; git-tracked copies
are in `spss_all/raw/`. The SPSS exports use the v2 runs by default.
are in `spss_all/raw/`. Comments-removed runs use
`results/*-comments-removed.csv`.
## Comments-only condition
`obfuscator_comments_only.py` creates `Samples_CommentsRemoved` by removing
only comments and docstrings. Identifiers, strings, routes, templates, and
formatting are preserved. Per-file statistics are recorded in
`comments_removed_report.json`.
```bash
python3 obfuscator_comments_only.py -i Samples -o Samples_CommentsRemoved \
--report validation/comments_removed_report.json
```
Bandit and Semgrep outputs are `validation/{bandit,semgrep}/comments_removed.json`;
LLM outputs are in `results/*-comments-removed.csv` and copied to
`spss_all/raw/`.
## SPSS exports
`export_spss_all.py` combines the traditional SAST tools (Bandit and Semgrep)
and the three LLM tiers (Qwen3.6 35B A3B with thinking disabled, DeepSeek V4.1
Flash, Gemini 4 Argon) into one SPSS-ready dataset covering both conditions.
Qwen represents a latency-constrained consumer-hardware deployment; see
`spss_all/codebook.md` for the full model configuration and limitation. The
script reads the tool exports from `sast_tools/tools_long.csv` and the LLM runs
from the SQLite databases in `results/`, then writes to `validation/spss_all/`:
`export_spss_all.py` combines the traditional SAST tools (Bandit and Semgrep),
DeepSeek V4.1 Flash (open-weight, evaluated through a hosted endpoint), and
Gemini 4 Argon (frontier hosted) into one SPSS-ready dataset covering all three
conditions. The script reads the tool exports from
`sast_tools/tools_long.csv` and the LLM runs from the SQLite databases in
`results/`, then writes to `validation/spss_all/`:
- `sast_all_long.csv` / `.sav` — 2,000 rows (5 detectors × 2 conditions × 200 samples)
- `sast_all_long.csv` / `.sav` — 2,400 rows (4 detectors × 3 conditions × 200 samples)
- `sast_all_wide.csv` / `.sav` — 200 paired rows
- `sast_all_summary.csv` / `.sav` — aggregate metrics
- `sast_all_category.csv` / `.sav` — per-category metrics
- `sast_all_paired.csv` — within-detector McNemar tests
- `sast_all_between.csv` — between-detector McNemar tests
- `sast_all_summary.csv` / `.sav` — 12 aggregate rows
- `sast_all_category.csv` / `.sav` — 168 per-category rows
- `sast_all_paired.csv` — 12 within-detector condition-pair McNemar tests
- `sast_all_between.csv` — 18 between-detector McNemar tests
- `codebook.csv` / `codebook.md`
- `.sps` import syntax for the CSV files
@@ -198,10 +214,12 @@ validation/
├── bandit_comparison.txt # human-readable Bandit diff
├── bandit/
│ ├── samples.json # raw Bandit JSON, original
│ └── obfuscated_v2.json # raw Bandit JSON, obfuscated
│ ├── obfuscated_v2.json # raw Bandit JSON, obfuscated
│ └── comments_removed.json # raw Bandit JSON, comments removed
├── semgrep/
│ ├── samples.json # raw Semgrep JSON, original
│ └── obfuscated_v2.json # raw Semgrep JSON, obfuscated
│ ├── obfuscated_v2.json # raw Semgrep JSON, obfuscated
│ └── comments_removed.json # raw Semgrep JSON, comments removed
├── deepseek_comparison.md # v1 pilot analysis (historical)
├── sast_tools/
│ ├── findings.csv