4.0 KiB
DeepSeek comparison: original vs obfuscated v2
Historical pilot. This report uses the nine-category
sast_v1.txtprompt and the 157 in-scope samples. It is superseded by the all-200, fourteen-CWEsast_v2runs inresults/deepseek-v2-*.csvandvalidation/spss_all/.
Model: opencode-go/deepseek-v4.1-flash
Prompt: prompts/sast_v1.txt
Labels: data/expectedresults-0.1.csv
In-scope samples: 157 (43 out-of-scope samples excluded from flag metrics)
| Metric | Original (Samples) |
Obfuscated v2 |
|---|---|---|
| TP | 46 | 46 |
| FP | 13 | 18 |
| TN | 98 | 93 |
| FN | 0 | 0 |
| Flag accuracy | 91.7% | 88.5% |
| Precision | 78.0% | 71.9% |
| Recall | 100% | 100% |
| Category accuracy (TP) | 100% (46/46) | 100% (46/46) |
| CWE accuracy (TP) | 100% (46/46) | 100% (46/46) |
| Calls | 201 | 202 |
| Prompt tokens | 166,504 | 145,474 |
| Completion tokens | 214,906 | 327,516 |
| Total tokens | 381,410 | 472,990 |
| Workers | 4 | 1 |
| Wall time | ~11 min | ~56 min |
Wall time is not comparable because the original run used four workers and the obfuscated run used one.
Paired prediction analysis
Restricting to the 157 in-scope samples:
| Outcome | Count |
|---|---|
| Both correct | 138 |
| Original correct, obfuscated wrong | 6 |
| Original wrong, obfuscated correct | 1 |
| Both wrong | 12 |
Net change: +5 false positives in the obfuscated condition.
Exact McNemar test: p = 0.125 (not statistically significant at α = 0.05).
Per-category results (obfuscated v2)
| Category | TP | FP | TN | FN |
|---|---|---|---|---|
| weakrand | 14 | 1 | 43 | 0 |
| pathtraver | 13 | 5 | 8 | 0 |
| xss | 8 | 2 | 8 | 0 |
| deserialization | 4 | 2 | 5 | 0 |
| xpathi | 4 | 4 | 20 | 0 |
| sqli | 1 | 0 | 2 | 0 |
| trustbound | 1 | 2 | 3 | 0 |
| xxe | 1 | 2 | 3 | 0 |
| cmdi | 0 | 0 | 1 | 0 |
New in-scope false positives in the obfuscated run
These six samples changed from correct No to Yes:
BenchmarkTest00024(xpathi)BenchmarkTest00293(xxe)BenchmarkTest00477(weakrand)BenchmarkTest00539(xxe)BenchmarkTest00677(xpathi)BenchmarkTest01023(xpathi)
One original false positive became correct:
BenchmarkTest00498(trustbound)
Qualitative review suggests the difference is mixed:
00024: the model confused two obfuscated ConfigParser keys (m009-57764vsm00a-57764) and lost the constant-propagation fact that the XPath value comes from the hardcoded key, not the cookie.01023: the original safe reasoning relied on the fixed first path segment of/benchmark/xpathi-01/...; the generic/route_153route removed that cue.00293,00539,00477,00677: the model changed its judgment on essentially the same code structure (e.g. ExpatParser defaults,secrets.randbits(32),replace("'", "'")). These look like run-to-run reasoning variance rather than a direct obfuscation effect.
Interpretation
- Obfuscation did not reduce detection: TP, FN, category accuracy, and CWE accuracy are identical.
- The obfuscated condition produced five additional false positives, reducing flag accuracy by 3.2 percentage points and precision by 6.1 points.
- The paired difference is not statistically significant in this single run (McNemar p = 0.125).
- Completion-token use was substantially higher in the obfuscated run, but this may reflect both harder-to-read identifiers and run variance.
- The two runs also differed in worker count, so a replication with identical settings is needed before attributing the difference to obfuscation.
Recommended next step
Run at least one replicate of each condition with identical settings, for example:
python3 run_sast_eval.py --input Samples \
--model opencode-go/deepseek-v4.1-flash \
--run-id deepseek-original-rep2 --workers 4
python3 run_sast_eval.py --input Samples_Obfuscated_v2 \
--model opencode-go/deepseek-v4.1-flash \
--run-id deepseek-v2-rep2 --workers 4
Then compare the replicate spread before making a claim about obfuscation degrading performance.