CLAVE: A deep learning model for source code authorship verification with contrastive learning and transformer encoders

Source code authorship verification involves determining whether two code fragments are written by the same programmer. It has many uses, including malware authorship analysis, copyright dispute resolution and plagiarism detection. Source code authorship verification is challenging because it must generalize to code written by programmers not included in its training data. In this paper, we present CLAVE (Contrastive Learning for Authorship Verification with Encoder representations), a novel deep learning model for source code authorship verification that leverages contrastive learning and a Transformer Encoder-based architecture. We initially pre-train CLAVE on a dataset of 270,602 Python source code files extracted from GitHub. Subsequently, we fine-tune CLAVE for authorship verification using contrastive learning on Python submissions from 61,956 distinct programmers in Google Code Jam and Kick Start competitions. This approach allows the model to learn stylometric representations of source code, enabling comparison via vector distance for authorship verification. CLAVE achieves an AUC of 0.9782, reduces the error of the state-of-the-art source code authorship verification systems by at least 23.4% and improves the AUC of cutting-edge source code LLMs by 21.9% to 40%. We also evaluate the main components of CLAVE on its AUC performance improvement: pre-training (1.8%), loss function (0.2%–2.8%), input length (0.1%–0.7%), model size (0.2%), and tokenizer (0.1%–0.7%). • CLAVE is a deep-learning model for source code authorship verification. • A large Python dataset is used to pre-train a Transformer Encoder. • Different customized tokenizers are specifically defined for Python. • Contrastive learning is used to learn stylometric representations. • CLAVE outperforms the state-of-the-art systems with 0.9782 AUC.

Authors

Publication Details

Journal
Information Processing & Management
Published
2024-12-06
DOI
https://doi.org/10.1016/j.ipm.2024.104005
Citations
9
Primary Topic
Authorship Attribution and Profiling
Type
article
Field-Weighted Citation Impact
3.13
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

CLAVE: A deep learning model for source code authorship verification with contrastive learning and transformer encoders

Francisco Ortín, David Álvarez-Fidalgo
9 citations
Information Processing & Management
Authorship Attribution and Profiling
3.13
article

CLAVE: A deep learning model for source code authorship verification with contrastive learning and transformer encoders

Francisco Ortín, David Álvarez-Fidalgo
article en
9 citations

Abstract

Source code authorship verification involves determining whether two code fragments are written by the same programmer. It has many uses, including malware authorship analysis, copyright dispute resolution and plagiarism detection. Source code authorship verification is challenging because it must generalize to code written by programmers not included in its training data. In this paper, we present CLAVE (Contrastive Learning for Authorship Verification with Encoder representations), a novel deep learning model for source code authorship verification that leverages contrastive learning and a Transformer Encoder-based architecture. We initially pre-train CLAVE on a dataset of 270,602 Python source code files extracted from GitHub. Subsequently, we fine-tune CLAVE for authorship verification using contrastive learning on Python submissions from 61,956 distinct programmers in Google Code Jam and Kick Start competitions. This approach allows the model to learn stylometric representations of source code, enabling comparison via vector distance for authorship verification. CLAVE achieves an AUC of 0.9782, reduces the error of the state-of-the-art source code authorship verification systems by at least 23.4% and improves the AUC of cutting-edge source code LLMs by 21.9% to 40%. We also evaluate the main components of CLAVE on its AUC performance improvement: pre-training (1.8%), loss function (0.2%–2.8%), input length (0.1%–0.7%), model size (0.2%), and tokenizer (0.1%–0.7%). • CLAVE is a deep-learning model for source code authorship verification. • A large Python dataset is used to pre-train a Transformer Encoder. • Different customized tokenizers are specifically defined for Python. • Contrastive learning is used to learn stylometric representations. • CLAVE outperforms the state-of-the-art systems with 0.9782 AUC.

Information Processing & ManagementVol. 62(3)
Openalex Percentile: Top 7%
Authorship Attribution and Profiling
3.13
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.