Accuracy Metrics Framework

Overview

This document defines the accuracy metrics framework used to measure and track StellaOps scanner performance. All metrics are computed against ground truth datasets and published quarterly.

Metric Definitions

Confusion Matrix

For binary classification tasks (e.g., reachable vs unreachable):

Predicted PositivePredicted Negative
Actual PositiveTrue Positive (TP)False Negative (FN)
Actual NegativeFalse Positive (FP)True Negative (TN)

Core Metrics

MetricFormulaDescriptionTarget
PrecisionTP / (TP + FP)Of items flagged, how many were correct>= 90%
RecallTP / (TP + FN)Of actual positives, how many were found>= 85%
F1 Score2 * (P * R) / (P + R)Harmonic mean of precision and recall>= 87%
False Positive RateFP / (FP + TN)Rate of incorrect positive flags<= 10%
Accuracy(TP + TN) / TotalOverall correctness>= 90%

Reachability Analysis Accuracy

Definitions

Target Metrics

MetricTargetStretch Goal
Precision>= 90%>= 95%
Recall>= 85%>= 90%
F1 Score>= 87%>= 92%
False Positive Rate<= 10%<= 5%

Per-Language Targets

LanguagePrecisionRecallF1Notes
Java>= 92%>= 88%>= 90%Strong static analysis support
C#>= 90%>= 85%>= 87%Roslyn-based analysis
Go>= 88%>= 82%>= 85%Good call graph support
JavaScript>= 85%>= 78%>= 81%Dynamic typing challenges
Python>= 83%>= 75%>= 79%Dynamic typing challenges
TypeScript>= 88%>= 82%>= 85%Better than JS due to types

Lattice State Accuracy

VEX lattice states have different confidence requirements:

StateDefinitionTarget AccuracyValidation
CR (Confirmed Reachable)Runtime evidence + static path>= 95%Runtime trace verification
SR (Static Reachable)Static path only>= 90%Static analysis coverage
SU (Static Unreachable)No static path found>= 85%Negative proof verification
DT (Denied by Tool)Tool analysis confirms not affected>= 90%Tool output validation
DV (Denied by Vendor)Vendor VEX statement>= 95%VEX signature verification
U (Unknown)Insufficient evidenceTrack %Minimize unknowns

Lattice Transition Accuracy

Measure accuracy of automatic state transitions:

TransitionTriggerTarget Accuracy
U -> SRStatic analysis finds path>= 90%
SR -> CRRuntime evidence added>= 95%
U -> SUStatic analysis proves unreachable>= 85%
SR -> DTTool-specific analysis>= 90%

SBOM Completeness Metrics

Component Detection

MetricFormulaTargetNotes
Component RecallFound / Total Actual>= 98%Find all real components
Component PrecisionReal / Reported>= 99%Minimize phantom components
Version AccuracyCorrect Versions / Total>= 95%Version string correctness
License AccuracyCorrect Licenses / Total>= 90%License detection accuracy

Per-Ecosystem Targets

EcosystemComp. RecallComp. PrecisionVersion Acc.
Alpine APK>= 99%>= 99%>= 98%
Debian DEB>= 99%>= 99%>= 98%
npm>= 97%>= 98%>= 95%
Maven>= 98%>= 99%>= 96%
NuGet>= 98%>= 99%>= 96%
PyPI>= 96%>= 98%>= 94%
Go Modules>= 97%>= 98%>= 95%
Cargo (Rust)>= 98%>= 99%>= 96%

Vulnerability Detection Accuracy

CVE Matching

MetricFormulaTarget
CVE RecallFound CVEs / Actual CVEs>= 95%
CVE PrecisionCorrect CVEs / Reported CVEs>= 98%
Version Range AccuracyCorrect Affected / Total>= 93%

False Positive Categories

Track and minimize specific FP types:

FP TypeDescriptionTarget Rate
Phantom ComponentCVE for component not present<= 1%
Version MismatchCVE for wrong version<= 3%
Ecosystem ConfusionWrong package with same name<= 1%
Stale AdvisoryAlready fixed but flagged<= 2%

Measurement Methodology

Ground Truth Establishment

  1. Manual Curation

    • Expert review of sample applications
    • Documented decision rationale
    • Multiple reviewer consensus
  2. Automated Verification

    • Cross-reference with authoritative sources
    • NVD, OSV, GitHub Advisory Database
    • Vendor security bulletins
  3. Runtime Validation

    • Dynamic analysis confirmation
    • Exploit proof-of-concept testing
    • Production monitoring correlation

Test Corpus Requirements

CategoryMinimum SamplesDiversity Requirements
Reachability50 per languageMix of libraries, frameworks
SBOM100 imagesAll major ecosystems
CVE Detection500 CVEsMix of severities, ages
Performance10 reference imagesVarious sizes

Measurement Process

1. Select ground truth corpus
   └── Minimum samples per category
   └── Representative of production workloads

2. Run scanner with deterministic manifest
   └── Fixed advisory database version
   └── Reproducible configuration

3. Compare results to ground truth
   └── Automated diff tooling
   └── Manual review of discrepancies

4. Compute metrics per category
   └── Generate confusion matrices
   └── Calculate precision/recall/F1

5. Aggregate and publish
   └── Per-ecosystem breakdown
   └── Overall summary metrics
   └── Trend analysis

Reporting Format

Quarterly Benchmark Report

{
  "report_version": "1.0",
  "scanner_version": "1.3.0",
  "report_date": "2025-12-14",
  "ground_truth_version": "2025-Q4",

  "reachability": {
    "overall": {
      "precision": 0.91,
      "recall": 0.86,
      "f1": 0.88,
      "samples": 450
    },
    "by_language": {
      "java": {"precision": 0.93, "recall": 0.88, "f1": 0.90, "samples": 100},
      "csharp": {"precision": 0.90, "recall": 0.85, "f1": 0.87, "samples": 80},
      "go": {"precision": 0.89, "recall": 0.83, "f1": 0.86, "samples": 70}
    }
  },

  "sbom": {
    "component_recall": 0.98,
    "component_precision": 0.99,
    "version_accuracy": 0.96
  },

  "vulnerability": {
    "cve_recall": 0.96,
    "cve_precision": 0.98,
    "false_positive_rate": 0.02
  },

  "lattice_states": {
    "cr_accuracy": 0.96,
    "sr_accuracy": 0.91,
    "su_accuracy": 0.87
  }
}

Regression Detection

Thresholds

A regression is flagged when:

MetricRegression ThresholdAction
Precision> 3% decreaseBlock release
Recall> 5% decreaseBlock release
F1> 4% decreaseBlock release
FPR> 2% increaseBlock release
Any metric> 1% changeInvestigate

CI Integration

# .gitea/workflows/accuracy-check.yml
accuracy-benchmark:
  runs-on: ubuntu-latest
  steps:
    - name: Run accuracy benchmark
      run: make benchmark-accuracy

    - name: Check for regressions
      run: |
        stellaops benchmark compare \
          --baseline results/baseline.json \
          --current results/current.json \
          --threshold-precision 0.03 \
          --threshold-recall 0.05 \
          --fail-on-regression

Ground Truth Sources

Internal

External


Improvement Tracking

Gap Analysis

Identify and prioritize accuracy improvements:

GapCurrentTargetPriorityImprovement Plan
Python recall73%78%HighImprove type inference
npm precision96%98%MediumFix aliasing issues
Version accuracy94%96%MediumBetter version parsing

Quarterly Goals

Track progress against improvement targets:

QuarterFocus AreaMetricTargetActual
Q4 2025Java reachabilityRecall88%TBD
Q1 2026Python supportF180%TBD
Q1 2026SBOM completenessRecall99%TBD

References