Two developers. One task.
Code has a fingerprint.
AUTHOR ?sum.cpp
// sum every element
int sum_all(vector<int>& nums) {
int total = 0;
for (int i = 0; i < nums.size(); i++) {
total += nums[i];
}
return total;
}
AUTHOR ?sum.cpp
int SumAll(vector<int> &arr)
{
int res=0, k=0;
while (k < arr.size())
res += arr[k++];
return res;
}
commentssnake_case
same-line bracesfor loop
dense spacingPascalCase
own-line braceswhile loop
Who wrote this code?
Bug triagingFault localization
PlagiarismCopyright disputes
Past tools were hand-built.
Hand-crafted features miss the nuances of style, and adversarial edits can fool them.
The first extensive empirical study
Can a language model
name the author?
Code Llama7BDeepSeek-Coder1.3B
UniXcoder223MCodeBERT125M
GraphCodeBERT125MContraBERT_C125M
ContraBERT_G125Mvs. PbNNprior SOTA
LEETCODE · C++AUTHOR ?
// sum every element
int sum_all(vector<int>& nums) {
int total = 0;
for (int i = 0; i < nums.size(); i++) {
total += nums[i];
}
return total;
}
GPT-4 · REMOVE COMMENTS
LEETCODE · ACCEPTED
Pick the author.
Seven code LMs are fine-tuned to pick the author. Long code is split into chunks whose scores are summed.
AUTHOR SCORESCHUNK 1CHUNK 2
See what it saw.
Integrated Gradients scores every token. The top 30% are faithful: necessary and sufficient.
TOP-30% TOKENS · ONE AUTHOR
int//{ }
( )totali++return
NecessityRemove them, and confidence drops.
SufficiencyKeep only them, and it still knows.
Then try to fool it.
GPT-4 applies 28 semantics-preserving rewrites. LeetCode checks that each one still works.
0adversarial samples generated
GitHub · Google Code Jam · LeetCode
over 0%
accuracy gain over the prior state of the art on LeetCode
0.74 vs 0.32LeetCode accuracy · DeepSeek-Coder vs PbNN
96%average accuracy, five balanced datasets
0.666 vs 0.181author separability (JSD), LeetCode
Finding
More code isn’t more signal.
When many developers solve a problem the same way, their styles converge.
C++
0of LeetCode samples
0average LM accuracy
C#
0of LeetCode samples
0average LM accuracy
Finding
Most LMs are harder to fool.
All but Code Llama (only partly fine-tuned, via LoRA) beat PbNN. Smaller, contrastive models resist best.
Reassessing Code Authorship Attribution in the Era of Language Models
Atish Kumar Dipongkor · Ziyu Yao · Kevin Moran
TOSEM 2026 · ACM Transactions on Software Engineering and Methodology