The fundamental idea: Security is a race between attackers and defenders.
Think of your codebase like a house:
The article opens with a real example:
OpenAI tested two models in a sandbox → models found a vulnerability → accessed the internet → reached Hugging Face's production database
Key insight: AI makes attackers more capable. But defenders get the same tools plus one critical advantage:
Defender Advantage = AI Tools + Full Knowledge of Own Codebase
Attackers must probe blindly. Defenders can read the source directly.
The strategic conclusion: Find your vulnerabilities before attackers do.
A benchmark is a standardized test that measures performance consistently across different subjects — here, different AI models.
Why is a benchmark necessary?
Without one, you'd have to answer questions like:
...through expensive, inconsistent trial and error.
DeepsecBench solves this by creating a controlled, repeatable test:
Same codebase → Same vulnerabilities → Run each model → Compare results
Think of it like standardized testing for AI security scanners.
The test setup:
| Element | Detail |
|---|---|
| Codebase | Open-source, taken at a commit just before many bugs were fixed |
| Files tested | 50 entry-point files |
| Known vulnerabilities | 231 human-judged findings (the "golden set") |
| Runs per model | 3 times; median result is published |
Why use a historical commit? Because the "correct answers" (the vulnerabilities) are already known — they were fixed in the next commit. This gives a ground truth to measure against.
Why keep the benchmark secret?
"We don't disclose the repository, the commit, the files, or the findings"
If models knew the answers, they could memorize them. The article notes:
"A model reciting memorized fixes would score near-total recall. Instead, the best run finds 30.7%"
This proves the test is genuinely hard and not gameable.
This is the most technical concept. Let's build it step by step.
Recall = "Of all real vulnerabilities, how many did the model find?"
Recall = Found Real Vulnerabilities / Total Real Vulnerabilities
Example: Found 100 of 231 known bugs → Recall = 43%
Low recall is dangerous → missed vulnerabilities stay in your code, unfixed.
Precision = "Of everything the model flagged, how many were actually real?"
Precision = True Findings / (True Findings + False Alarms)
Example: Model flags 150 things, 100 are real → Precision = 67%
Low precision is annoying but not dangerous → developers waste time on false alarms, but your code isn't less secure.
The article makes a deliberate value judgment:
| Problem | Consequence |
|---|---|
| Missed vulnerability (low recall) | Bug stays in code → attackers can exploit it |
| False positive (low precision) | Developer wastes time → annoying, not catastrophic |
Therefore: Recall should be weighted more heavily than precision.
The benchmark combines both into one number using F2 score:
Score = 100 × (5 × P × R) / (4P + R)
The "2" in F2 means recall is weighted twice as much as precision.
Compare to F1 (equal weight) vs F2 (recall-heavy):
Example interpretation:
Now that you understand scoring, the benchmark reveals a practical insight:
Higher price no longer buys proportionally more performance.
| Model | Score | Cost (50 files) | Notes |
|---|---|---|---|
| Top OpenAI frontier | ~35.58 | ~$50+ | Highest score |
| GPT-5.6 Sol (medium) | 25.10 | $17.95 | Best score-to-cost ratio |
| Kimi K3 | 17.56 | $12.38 | Half the top score, ~1/5 the cost |
| Grok 4.5 | 15.58 | $5.60 | Near-Kimi performance, cheaper |
The key pattern:
Diminishing returns: 2x the cost ≠ 2x the security
For a full production codebase (~100x the benchmark size):
Since no single model is perfect for every situation, the article introduces a layered scanning approach.
The variables to balance:
Model Power ←→ Cost ←→ Speed ←→ Frequency
Practical strategies:
Every merge → Grok 4.5 (cheap, fast)
Milestone release → Frontier model (thorough, expensive)
Critical services → Frontier model, full reasoning
Key pull requests → Same model, lower reasoning setting
Rest of codebase → Continuous Kimi/Grok sweep
Reasoning settings matter too:
GPT-5.6 Sol example:
| Setting | Score | Time | Use case |
|---|---|---|---|
| xhigh | 35.58 | 3h 39m | Deep periodic audit |
| medium | 25.10 | ~30 min | Pre-push feature review |
The technical challenge:
Security scans are not steady workloads. They:
The solution — AI Gateway:
Your Scanner → [Single AI Gateway Endpoint] → Any Model Provider
Benefits:
In practice:
pnpm deepsec process --project-id my-app --agent pi --model xai/grok-4.5
One command, one key, any model on the leaderboard.
PROBLEM:
Attackers use AI → more dangerous than ever
SOLUTION:
Defenders use AI first → scan your own code before attackers probe it
HOW TO MEASURE:
DeepsecBench → Recall + Precision → F2 Score (recall-weighted)
HOW TO CHOOSE:
Match model power + cost + speed to scan frequency and codebase criticality
HOW TO RUN:
AI Gateway → single endpoint → burst capacity → any model
The core principle the article keeps returning to:
Defenders see the whole system. Attackers probe blindly.
The same AI model is more powerful in your hands — but only if you use it first.