All models

LineVul

LineVul, a Transformer that predicts vulnerable C/C++ functions and the vulnerable lines inside them.

Language · 377 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (23 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
249.3M
Operations
377
Framework
PyTorch
Recurrent
No
Published
MSR 2022
Cited by
698 (as of 18 November 2026)
Authors
Michael Fu, Chakkrit Tantithamthavorn
License
MIT
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m17948
Graph hash
3620b2c60832415b7e0e9df27769719044d823d456446d05dc2eb531e084ba01
Skeleton hash
b1fda15638e1ffecc11371af2b77318afb09edc6cc435945735d301984c28cd8
Architecture hash
af62e54eb5b9747ca67f02347079f3fd606b29b3bc6cb413c592da50c8b6876b
Diagram SHA-256
75b6c56d6afa96fa9a8e87934065697fc844577252a4c625dec8563a470f81cf
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

LineVul is a Transformer-based model that predicts software vulnerabilities in C/C++ code, both for whole functions and for the individual lines inside them. It was proposed in response to IVDetect, a graph-based neural network that predicts vulnerabilities at the function level and that the paper calls inaccurate and coarse-grained.

The authors' replication package describes the LineVul model as a BPE tokenizer, pre-training on CodeSearchNet and a BERT architecture. Its commands load the microsoft/codebert-base tokenizer and weights with the RoBERTa model type. The dataset columns the experiments use are the original C/C++ function, a function-level label saying whether it is vulnerable, and the fixed function with added and deleted lines labeled.

On a dataset of more than 188k C/C++ functions, the paper reports 160%-379% higher F1-measure for function-level predictions and 12%-25% higher Top-10 Accuracy for line-level predictions than the baseline approaches. It also reports that LineVul is 75%-100% accurate at predicting vulnerable functions affected by the Top-25 most dangerous CWEs.

Key idea. LineVul uses a Transformer to predict vulnerable C/C++ functions and the vulnerable lines within them, addressing limitations of the graph-based IVDetect approach.

  • linevul
  • line-level vulnerability prediction
  • vulnerability prediction
  • vulnerability detection
  • software vulnerabilities
  • c/c++ functions
  • transformer
  • source code
  • cwe

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@article{linevul2022,
  title = {LineVul: A Transformer-based Line-Level Vulnerability Prediction},
  author = {Michael Fu and Chakkrit Tantithamthavorn},
  year = {2022},
  journal = {MSR 2022},
  doi = {10.1145/3524842.3528452}
}