Zero-Shot Detection of Machine-Generated Codes
- URL: http://arxiv.org/abs/2310.05103v1
- Date: Sun, 8 Oct 2023 10:08:21 GMT
- Title: Zero-Shot Detection of Machine-Generated Codes
- Authors: Xianjun Yang, Kexun Zhang, Haifeng Chen, Linda Petzold, William Yang
Wang, Wei Cheng
- Abstract summary: This work proposes a training-free approach for the detection of LLMs-generated codes.
We find that existing training-based or zero-shot text detectors are ineffective in detecting code.
Our method exhibits robustness against revision attacks and generalizes well to Java codes.
- Score: 83.0342513054389
- License: http://creativecommons.org/licenses/by-nc-sa/4.0/
- Abstract: This work proposes a training-free approach for the detection of
LLMs-generated codes, mitigating the risks associated with their indiscriminate
usage. To the best of our knowledge, our research is the first to investigate
zero-shot detection techniques applied to code generated by advanced black-box
LLMs like ChatGPT. Firstly, we find that existing training-based or zero-shot
text detectors are ineffective in detecting code, likely due to the unique
statistical properties found in code structures. We then modify the previous
zero-shot text detection method, DetectGPT (Mitchell et al., 2023) by utilizing
a surrogate white-box model to estimate the probability of the rightmost
tokens, allowing us to identify code snippets generated by language models.
Through extensive experiments conducted on the python codes of the CodeContest
and APPS dataset, our approach demonstrates its effectiveness by achieving
state-of-the-art detection results on text-davinci-003, GPT-3.5, and GPT-4
models. Moreover, our method exhibits robustness against revision attacks and
generalizes well to Java codes. We also find that the smaller code language
model like PolyCoder-160M performs as a universal code detector, outperforming
the billion-scale counterpart. The codes will be available at
https://github.com/ Xianjun-Yang/Code_detection.git
Related papers
- Uncovering LLM-Generated Code: A Zero-Shot Synthetic Code Detector via Code Rewriting [78.48355455324688]
We propose a novel zero-shot synthetic code detector based on the similarity between the code and its rewritten variants.
Our results demonstrate a notable enhancement over existing synthetic content detectors designed for general texts.
arXiv Detail & Related papers (2024-05-25T08:57:28Z) - Between Lines of Code: Unraveling the Distinct Patterns of Machine and Human Programmers [14.018844722021896]
We study the specific patterns that characterize machine- and human-authored code.
We propose DetectCodeGPT, a novel method for detecting machine-generated code.
arXiv Detail & Related papers (2024-01-12T09:15:20Z) - Fast-DetectGPT: Efficient Zero-Shot Detection of Machine-Generated Text
via Conditional Probability Curvature [36.31281981509264]
Large language models (LLMs) have shown the ability to produce fluent and cogent content.
To build trustworthy AI systems, it is imperative to distinguish between machine-generated and human-authored content.
Fast-DetectGPT is an optimized zero-shot detector that substitutes DetectGPT's perturbation step with a more efficient sampling step.
arXiv Detail & Related papers (2023-10-08T11:41:28Z) - Code Detection for Hardware Acceleration Using Large Language Models [0.0]
This work presents the first analysis of code detection using large language models (LLMs)
We propose both a preliminary, naive prompt and a novel prompting strategy for code detection.
Results reveal that conventional prompting achieves great precision but poor accuracy (68.8%, 22.3%, and 79.2% for GEMM, convolution, and FFT, respectively) due to a high number of false positives.
Our novel prompting strategy substantially reduces false positives, resulting in excellent overall accuracy (91.1%, 97.9%, and 99.7%, respectively)
arXiv Detail & Related papers (2023-07-19T17:21:58Z) - Paraphrasing evades detectors of AI-generated text, but retrieval is an
effective defense [56.077252790310176]
We present a paraphrase generation model (DIPPER) that can paraphrase paragraphs, condition on surrounding context, and control lexical diversity and content reordering.
Using DIPPER to paraphrase text generated by three large language models (including GPT3.5-davinci-003) successfully evades several detectors, including watermarking.
We introduce a simple defense that relies on retrieving semantically-similar generations and must be maintained by a language model API provider.
arXiv Detail & Related papers (2023-03-23T16:29:27Z) - Can AI-Generated Text be Reliably Detected? [54.670136179857344]
Unregulated use of LLMs can potentially lead to malicious consequences such as plagiarism, generating fake news, spamming, etc.
Recent works attempt to tackle this problem either using certain model signatures present in the generated text outputs or by applying watermarking techniques.
In this paper, we show that these detectors are not reliable in practical scenarios.
arXiv Detail & Related papers (2023-03-17T17:53:19Z) - DetectGPT: Zero-Shot Machine-Generated Text Detection using Probability
Curvature [143.5381108333212]
We show that text sampled from an large language model tends to occupy negative curvature regions of the model's log probability function.
We then define a new curvature-based criterion for judging if a passage is generated from a given LLM.
We find DetectGPT is more discriminative than existing zero-shot methods for model sample detection.
arXiv Detail & Related papers (2023-01-26T18:44:06Z) - Interactive Code Generation via Test-Driven User-Intent Formalization [60.90035204567797]
Large language models (LLMs) produce code from informal natural language (NL) intent.
It is hard to define a notion of correctness since natural language can be ambiguous and lacks a formal semantics.
We describe a language-agnostic abstract algorithm and a concrete implementation TiCoder.
arXiv Detail & Related papers (2022-08-11T17:41:08Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.