Lightweight Memory Safety Vulnerability Detection via CodeBERT and Focal Loss: A Hybrid Training Approach on Consumer-Grade Hardware
Abstract
This study proposes a lightweight automated detection model for CWE-119 (Buffer Overflow) and CWE-787 (Out-of-Bounds Write) memory safety vulnerabilities, built upon CodeBERT and Focal Loss. Training adopts a hybrid strategy combining Juliet Test Suite and PrimeVul. On CASTLE-C250, the model achieves 76.67% Recall — a 4.4x improvement over the CodeBERT baseline — without graph-based structural augmentation. The complete pipeline runs on a consumer-grade Intel Arc A380 GPU using BF16 mixed precision.
Fields of Study & Subjects
Software Testing and Debugging Techniques
Software Engineering Research
Security and Verification in Computing
Publication details
- Journal / source
- Zenodo (CERN European Organization for Nuclear Research)
- Publication date
- 28 February 2026
- Language
- EN
- Document type
- Preprint