MARGIN: Margin-Aware Regularized Geometry for Imbalanced Vulnerability Detection
This work addresses the pervasive issue of frequency and difficulty imbalances in real-world vulnerability detection data, which distort the geometry of embedding spaces. It proposes a unified framework that models both types of imbalance within a hyperspherical embedding geometry, introducing a dynamic geometric regularization mechanism based on the concentration parameter of the von Mises–Fisher distribution. By integrating adaptive margin metric learning with hyperspherical prototype modeling, the method aligns the probability mass of the embedding distribution with its corresponding Voronoi cells, thereby mitigating representation distortion and stabilizing decision boundaries. Experimental results demonstrate that the approach significantly outperforms strong baselines across multiple public vulnerability datasets, particularly excelling under severe imbalance conditions, and yields embeddings with enhanced discriminability, interpretability, and generalization capability.