CodeRipple: Wavelet-Based Detection of LLM-Generated Code
Xingyu Yao, Zhendong Mao, Quan Wang
Abstract
Detecting LLM-generated code is crucial for ensuring software provenance, security, reliability, and licensing compliance. Existing training-free detectors, mostly adapted from text-based methods, rely on global statistics of the Token Perplexity Sequence (TPS) and struggle with code. We reveal a key insight: despite the convergence of global statistics, LLM-generated and human-written code differ fundamentally in their local TPS dynamics: the former shows narrow transient spikes while the latter exhibits broad sustained fluctuations. To capture this distinction, we introduce CodeRipple, a novel training-free detection framework that employs wavelet analysis to characterize TPS morphology across scales. It jointly leverages the Stationary Wavelet Transform to model fluctuation shape and the Discrete Wavelet Transform to quantify cross-scale energy distribution. Evaluated on three challenging benchmarks spanning diverse programming languages, multiple generating LLMs, and various evasion strategies, CodeRipple consistently outperforms existing training-free methods, demonstrating its superior effectiveness and generalizability without any model training. Code available at: https: //github.com/yaoxingyu77/CodeRipple .
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 55f480bb-7cf1-4698-a3b8-8be11409bbcbBuilds on11
- DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability CurvatureEric Mitchell, Yoonho Lee, Alexander Khazatsky, Christopher D. Manning et al.ICML 2023 · 988 citations
- Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code ContributionsHammond Pearce, Baleegh Ahmad, Benjamin Tan, Brendan Dolan-Gavitt et al.S&P 2022 · 725 citations
- Fast-DetectGPT: Efficient Zero-Shot Detection of Machine-Generated Text via Conditional Probability CurvatureGuangsheng Bao, Yanbin Zhao, Zhiyang Teng, Linyi Yang et al.ICLR 2024 · 311 citations
- Spotting LLMs With Binoculars: Zero-Shot Detection of Machine-Generated TextAbhimanyu Hans, Avi Schwarzschild, Valeriia Cherepanova, Hamid Kazemi et al.ICML 2024 · 262 citations
- Intrinsic Dimension Estimation for Robust Detection of AI-Generated TextsEduard Tulchinskii, Kristian Kuznetsov, Laida Kushnareva, Daniil Cherniavskii et al.NeurIPS 2023 · 163 citations
Related papers
- Training-free LLM-generated Text Detection by Mining Token Probability SequencesYihuai Xu, Yongwei Wang, Yifei Bi, Huangsen Cao et al.ICLR 2025
- Telescope: Improving Zero Shot Detection of LLM Generated Content By Measuring Token Repetition ProbabilityChristopher Nassif, Joshua CooperICML 2026
- SpecDetect: Simple, Fast, and Training-Free Detection of LLM-Generated Text via Spectral AnalysisHaitong Luo, Weiyao Zhang, Suhang Wang, Wenji Zou et al.AAAI 2026
- DualCodeDetect: Zero-Shot LLM-Generated Code Detection via Dual-Channel PerturbationZhengdao Li, Xiuwei Shang, Zhenkan Fu, Shikai Guo et al.FSE 2026
- Waterfall: Scalable Framework for Robust Text Watermarking and Provenance for LLMsGregory Kang Ruey Lau, Xinyuan Niu, Hieu Dao, Jiangwei Chen et al.EMNLP 2024 · 3 citations
