The invention provides a code
vulnerability detection method based on meta-learning and multi-
modal fusion, belongs to the technical field of computers, and solves the technical problem that the existing
vulnerability detection method is low in detection precision of a
long code segment and weak in recognition capability under
class imbalance. According to the technical scheme, the method comprises the following steps that S1, an
original data set is preprocessed, and super-
long code samples are screened; s2, simplifying a super-
long code by using a large
language model, and retaining key
vulnerability semantics; s3, constructing AST extraction structure representation, and taking a code and a structure as multi-
modal input; s4, code sequences and structural features are extracted through a pre-training model, and fusion is carried out through a cross-
modal attention mechanism; s5, simulating a
small sample task by adopting a meta-learning strategy to adapt to a
class imbalance scene; and S6, inputting
test data and outputting a vulnerability
classification result. The method has the beneficial effects that the complex code and rare
vulnerability detection performance can be improved, and the model stability and accuracy are enhanced.