Comparing Machine Learning and Deep Learning Models With Attention Mechanisms for Multiple Source Code Authorship Attribution

Authorship attribution (AA) in source code is crucial for plagiarism detection, forensic analysis, and software maintenance, especially when author information is missing or ambiguous. This field is not as well explored as the written communication AA and there are new models to be tested on different sized dataset. This study compares traditional machine learning models, such as Random Forests trained on TF-IDF tokenized representations, with deep learning models, including BERT and an Attention-based Neural Network (AttentionNN), for the task of multiple authorship attribution. We evaluate different representations of source code, including raw tokenized text and Abstract Syntax Tree (AST) structures, to determine their effectiveness in distinguishing authorship. The models are tested on various sized but relatively small datasets compared to the existing experiments, the largest consisting of <tex xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">$3,756 \mathrm{C}$</tex> language functions from Google Code Jam spanning 2009-2018, assessing their accuracy, precision, recall, and training efficiency across varying author set sizes. Our findings highlight the strengths and limitations of each approach, showing that while deep learning models, particularly BERT trained on raw source code, achieve the highest accuracy, Random Forests offer competitive results with significantly lower computational cost. The study also explores the impact of function complexity on model performance, revealing that AttentionNN benefits from structural complexity while struggling with short functions. The results emphasize the trade-offs between accuracy, computational efficiency, and data representation, providing insights into the optimal model selection for source code authorship attribution.

Authors

Institutions

Publication Details

Published
2025-06-27
DOI
https://doi.org/10.1109/compsystech65493.2025.11136899
Primary Topic
Authorship Attribution and Profiling
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Comparing Machine Learning and Deep Learning Models With Attention Mechanisms for Multiple Source Code Authorship Attribution

Bc. Richard Čerňanský, Ing. Juraj Petrík
Authorship Attribution and Profiling
article

Comparing Machine Learning and Deep Learning Models With Attention Mechanisms for Multiple Source Code Authorship Attribution

Bc. Richard Čerňanský, Ing. Juraj Petrík
article en

Abstract

Authorship attribution (AA) in source code is crucial for plagiarism detection, forensic analysis, and software maintenance, especially when author information is missing or ambiguous. This field is not as well explored as the written communication AA and there are new models to be tested on different sized dataset. This study compares traditional machine learning models, such as Random Forests trained on TF-IDF tokenized representations, with deep learning models, including BERT and an Attention-based Neural Network (AttentionNN), for the task of multiple authorship attribution. We evaluate different representations of source code, including raw tokenized text and Abstract Syntax Tree (AST) structures, to determine their effectiveness in distinguishing authorship. The models are tested on various sized but relatively small datasets compared to the existing experiments, the largest consisting of <tex xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">$3,756 \mathrm{C}$</tex> language functions from Google Code Jam spanning 2009-2018, assessing their accuracy, precision, recall, and training efficiency across varying author set sizes. Our findings highlight the strengths and limitations of each approach, showing that while deep learning models, particularly BERT trained on raw source code, achieve the highest accuracy, Random Forests offer competitive results with significantly lower computational cost. The study also explores the impact of function complexity on model performance, revealing that AttentionNN benefits from structural complexity while struggling with short functions. The results emphasize the trade-offs between accuracy, computational efficiency, and data representation, providing insights into the optimal model selection for source code authorship attribution.

Slovak University of Technology in Bratislava (SK)
Openalex Percentile: Top 88%
Authorship Attribution and Profiling
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.