AI
Detecting AI-Written Code Isn't One-Size-Fits-All: Study Reveals Model-Specific Fingerprints
Researchers find that code generated by different large language models displays distinct structural patterns, making universal detection algorithms difficult and questioning the reliability of past studies.
As software development increasingly incorporates code written by large language models, the ability to identify and flag machine-generated code has become a pressing concern. A new study from arXiv challenges the assumption that a single detection approach works equally well across different AI models, revealing fundamental structural differences in how various LLMs generate code.
The Research Challenge#
The team examined Python code from four major LLM systems: GPT-3.5, Claude 3 Haiku, Claude Haiku 4.5, and GPT-OSS. They applied each model to generate 14,485 functions and 11,913 classes from the CodeSearchNet dataset, then built machine learning classifiers using interpretable software metrics to distinguish human-written from AI-generated code.
The core finding contradicts prior work: LLM-generated code detection is not a universal problem with a universal solution.
Granularity Dominates Model Type#
The analysis uncovered a surprising structural insight—whether detection focuses on individual functions or entire classes matters far more than which LLM created the code. The team found granularity effects outweigh differences between models by a factor of 8.6:1, with almost no overlapping features between function-level and class-level detection patterns.
This means detectors trained for one code scope won't translate reliably to another. Function-level and class-level code rely on fundamentally disjoint structural signatures, forcing researchers to build separate systems for each scope rather than a one-size-fits-all tool.
Surprising Model-Specific Anomalies#
The study also revealed model-dependent detection anomalies:
- GPT-3.5 stands out as exceptionally detectable (AUC-ROC 0.96) but is oddly easier to identify at the function level
- Modern models (Claude and GPT-OSS) show opposite behavior—they're more detectable at the class level, with performance dropping to 0.68–0.80 AUC-ROC
- Comment-to-Code Ratio emerged as the only universal indicator across all models, though its predictive power varies dramatically

