AccountabilityTransparencySecuritycs.SE
Whitespaces Don't Lie: Feature-Driven and Embedding-Based Approaches for Detecting Machine-Generated Code
Syed Mehedi Hasan Nirob, Shamim Ehsan, Moqsadur Rahman, Summit Haque
January 27, 2026
arXiv.org
3 citations
Key Takeaways
-
Detection is currently highly effective: Both feature-based and embedding-based approaches achieved over 99% accuracy (ROC-AUC scores of 0.995 and 0.994 respectively) at distinguishing AI-generated code from human-written code, suggesting that reliable detection tools are technically feasible today.
-
Simple patterns reveal AI authorship: Whitespace and indentation patterns are surprisingly strong indicators of machine-generated code, meaning detection doesn't require complex analysis—this makes it practical to implement in real-world settings like academic institutions and software companies.
-
Different detection methods have different strengths: Feature-based detectors are more interpretable and easier to understand (you can see exactly why code was flagged), while embedding-based detectors are slightly more precise but work as "black boxes," presenting a trade-off between transparency and accuracy that organizations must consider.
-
Generalization remains an open question: While the paper demonstrates strong performance on a large benchmark dataset, it doesn't fully address whether these detectors will remain effective as LLMs evolve and potentially adapt to evade detection, suggesting ongoing vigilance will be needed.
-
Multiple safeguards are now possible: The existence of two complementary detection approaches means organizations can implement layered defenses—using both methods together could provide additional confidence in flagging AI-generated code for academic integrity and responsible AI governance purposes.