← 全部文档 docsen/benchmark.md

AIShield — Benchmark Results

External corpus

AIShield is evaluated against an external, independently-sourced corpus:

Metric Value
Positive samples 593
Negative samples 517
Total 1,110
Families 18
Bootstrap 95% CI reported

Sources include GHSA (GitHub Security Advisories) for supply-chain CVEs, InjecAgent for indirect prompt injection, and controlled_matched hard-negatives (500 benign samples matched to positive families).

Primary results

Metric Recall FP rate CI (95%)
Overall 94.27% (559/593) 0.0% (0/517) [91.0%, 96.5%]
Primary scope (GHSA supply-chain) 100% (66/66) 0% [93.3%, 100%]
Secondary scope (NL injection) 91.1% (480/527) 0% [87.7%, 94.0%]

Family-level breakdown

Family Positives Detected Recall
indirect_prompt_injection 176 176 100%
data_exfiltration 176 176 100%
jailbreak_family 175 152 86.9%
path_traversal 7 7 100%
crypto_bypass 7 7 100%
command_injection 7 7 100%
privilege_escalation 6 6 100%
xss 6 6 100%
auth_bypass 5 5 100%
injection_generic 5 5 100%
supply_chain_exec 4 4 100%
ssrf 4 4 100%
memory_safety 4 4 100%
credential_exposure 3 3 100%
resource_exhaustion 3 3 100%
advisory_native 2 2 100%
race_condition 2 2 100%
config_weakness 1 1 100%
Total 593 559 94.27%

Baseline comparison

AIShield is compared against four baselines on the same external corpus:

Baseline Recall FP rate Primary scope Secondary scope
AIShield 94.27% 0.0% 100% 91.1%
Keyword heuristic ~50% ~50% — —
Random guess ~50% ~50% — —
Learned (TF-IDF+Rocchio 5-fold CV) 83.0% [79.9, 86.0] 48.9% 62.1% —
LLM judge (glm-4.5-flash) 55.3% [47.2, 64.2] 0.0% 28.8% 79.7%

Key finding: AIShield achieves the highest recall (94.27%) while maintaining 0% false positives. The learned baseline achieves higher overall recall but at 48.9% FP — making it unusable in production. The LLM judge achieves 0% FP but only 28.8% on the primary scope (GHSA CVEs), demonstrating scope complementarity rather than redundancy.

Statistical significance

All recall figures are computed with 1000-bootstrap resampling. The 95% CI for overall recall is [91.0%, 96.5%], which does not overlap with the keyword/random baselines (~50%). The primary-scope recall (100%) has a CI of [93.3%, 100%], demonstrating statistical significance.

False positive analysis

Zero false positives on 517 negatives across 18 families. The 0% FP rate is not an artifact of a small or easy negative set — the negatives include 500 controlled_matched hard-negatives (benign samples matched to the same families as positives), plus 17 truly benign samples. This is the principled zero-FP guarantee: the neuro-symbolic bridge ensures that no finding is emitted without a symbolic rule match, and the 23 AST rules were individually verified against all 517 negatives before enabling.

NL injection miss taxonomy

Of the 34 missed NL-injection samples (480/527 = 91.1%), the miss pattern is bimodal:

The misses are overwhelmingly lexically opaque: 90.3% of missed samples lack explicit injection markers (e.g. "ignore", "disregard", "override"). 100% of detected samples carry at least one marker. This is a principled ceiling: without semantic understanding, lexically opaque injections cannot be caught by regex rules — and adding semantic rules would break the 0% FP guarantee.

Formal verification

The isolation invariant (INV-1 through INV-6) is verified by BMC exploration of a 64-state mechanism model. The model is complete=true (all 64 states reachable), and four mutation operators (M1–M4) are all caught. This provides machine-checkable evidence that the scanner never spawns commands from the configuration it scans.

Reproducing results

# Run benchmark with bootstrap CI
python scripts/benchmark.py --corpus external --bootstrap 1000 --json \
  --out benchmarks/corpus/external/scope_recall.json

# Run formal verification gate
python scripts/run_fvi_gate.py

# Run full test suite
python tests/run_all.py

Related documents


来源:docs/en/benchmark.md · 由 aishield.tools 直接渲染,零外链依赖