Multi-class BERT yields higher macro-F1 than multi-label for CVE-to-CWE mapping, gap narrows
Multi-class formulation achieves higher macro-F1 than multi-label, with the performance gap decreasing as the label space shrinks
AI/ML arXiv 8 Jul 2026 Measurement Prototype evidence
Published as “Multi-Class vs. Multi-Label BERT for CVE-to-CWE Mapping: How Taxonomy Structure Shapes the Errors”
Why it matters
Hierarchy-aware evaluation and proper threshold selection can make multi-label models as useful as multi-class ones for routing CVEs to the correct weakness family in operational triage.
Summary
Multi-class formulation consistently yields higher macro-F1 than multi-label, but the advantage shrinks from 21 to 2 percentage points as the label space contracts and can be eliminated by tuning the multi-label decision threshold. Errors are dominated by CWE-hierarchy confusions, which are shared across BERT variants, and a hierarchy-relaxed metric raises macro-F1 to about 90%, indicating that strict scores underestimate family-level accuracy. CySecBERT performs best overall, especially in the multi-label setting.
What they found 5
- Multi-class training achieves higher macro-F1 across all settings, with the gap narrowing as the label space shrinks.
“Multi-class training achieves higher macro-F1 across all settings, although the gap to multi-label narrows from 21 to 2 percentage points as the label space shrinks.”
- CySecBERT attains the strongest overall results, especially in the multi-label scenario.
“CySecBERT achieves the strongest results overall, with statistically significant gains concentrated in the multi-label setting.”
- Error structures are highly correlated across models, reflecting the CWE hierarchy.
“All correlations exceed r = 0.92 on every label space: the three encoders make quantitatively different but structurally identical errors.”
- Increasing the sigmoid threshold to 0.9 raises multi-label macro-F1 to match multi-class performance on the 25-class slice.
“macro-F1 increases monotonically with τ, rising from 77.6% at τ=0.3 to 81.2% at τ=0.9, matching the MC result.”
- The observed MC vs. ML gap is not due to undersampling, as training MC without undersampling yields similar advantages.
“Because MC uses undersampled training data whereas ML does not, one possible concern is that the observed gap reflects data composition rather than formulation choice.”
Caveats 3
- The gap between multi-class and multi-label disappears after threshold tuning.
- Under hierarchy-relaxed evaluation, both formulations reach ∼90%, suggesting the practical difference is small.
- Because MC uses undersampled training data whereas ML does not, one possible concern is that the observed gap reflects data composition rather than formulation choice.
What’s new here 4
- Systematic comparison of multi-class vs. multi-label formulations for CVE-to-CWE mapping across three label-space sizes.
- Analysis showing that error patterns are driven by the CWE hierarchy rather than encoder choice.
- Demonstration that post-hoc threshold optimisation can close the performance gap for multi-label models.
- Introduction of a hierarchy-relaxed macro-F1 evaluation that better reflects practical usefulness.