LLMDet: A Third Party Large Language Models Generated Text Detection Tool

Kangxi Wu, Liang Pang, Huawei Shen, Xueqi Cheng, Tat-Seng Chua

Abstract

LLMDet is a novel, third-party detection tool designed to identify not just if a text was AI-generated, but specifically which large language model (LLM) produced it. By utilizing pre-computed dictionaries of $n$-gram probabilities to estimate "proxy perplexity," LLMDet achieves high attribution accuracy and a 5x speedup over traditional methods. Crucially, it operates without requiring direct access to model parameters or expensive API calls during the detection phase, making it a secure and efficient solution for third-party verification.

Introduction

The recent "Cambrian Explosion" of LLMs—ranging from proprietary models like GPT-4 to open-source alternatives like LLaMA and OPT—has blurred the lines between human and machine authorship. This shift introduces significant risks to academic integrity, facilitates the spread of misinformation, and leads to data "contamination" where AI-generated text is inadvertently used to train future models.

Existing detection frameworks suffer from three primary limitations. First, most are binary classifiers (human vs. machine), lacking the specificity to attribute text to a particular model provider. Second, "white-box" methods require access to internal model parameters, posing security risks and high computational costs. Third, "black-box" methods often rely on high-latency API calls or expensive local inference. LLMDet addresses these challenges by providing a model-specific, secure, and efficient detection tool that decouples detection from model inference.

Methodology

The core innovation of LLMDet is the shift from calculating "true perplexity"—which requires running the full LLM—to "proxy perplexity." The system operates in two distinct phases:

  1. Offline Dictionary Construction: To "fingerprint" a model, researchers collect a large corpus of text generated by that specific LLM. They identify salient $n$-grams (sequences of $n$ words) and record the model's predicted probabilities for the subsequent token. These probabilities are stored in a compact, pre-computed dictionary.
  2. Online Text Detection: During detection, LLMDet does not invoke the LLM. Instead, it performs a lookup of the input text's $n$-grams in its pre-built dictionaries. It calculates a proxy perplexity score for each candidate model based on the stored probabilities. These scores are then processed by a classifier (such as LightGBM) to rank the most likely sources.
The LLMDet workflow: from offline dictionary construction to online result ranking.

Experimental Setup

The authors evaluated LLMDet using a diverse dataset comprising 16,000 human-authored samples from the HC3 (Human ChatGPT Comparison Corpus) and machine-generated text from 10 different models, including GPT-2, OPT, UniLM, LLaMA, BART, T5, Bloom, and GPT-Neo. Prompts were sourced from Wikipedia (SQuAD) and news articles (Xsum) to ensure variety in content and style.

Results and Discussion

LLMDet demonstrates strong performance across multiple metrics. It achieved 98.54% precision in identifying human-authored text and an F1-Macro score of 88.14% for multi-class model attribution. Furthermore, the tool's Top-2 accuracy (R@2) reached 98.00%, indicating that the correct source model is almost always among the top two predictions.

Efficiency is a standout feature of LLMDet. By using pre-computed dictionaries, the tool is approximately 5.0x faster than "True-PPL" methods that require actual model inference. This efficiency allows LLMDet to run on standard CPUs, removing the need for high-end GPUs at the point of detection.

Comparison of overall performance and efficiency between different detection methods.

Limitations and Future Work

While effective, LLMDet currently has several limitations. It is presently restricted to English text, and building dictionaries for closed-source models like GPT-4 is challenging due to limited access to token probability distributions. Future work will focus on expanding language support and developing secure interfaces for model owners to contribute dictionaries. Additionally, the tool's resilience against sophisticated adversarial rewriting—where one LLM is used to "polish" the output of another—remains a subject for further investigation.

Conclusion

LLMDet represents a significant step forward in AI-generated text detection. By leveraging $n$-gram fingerprints and proxy perplexity, it offers a scalable, efficient, and model-specific solution that balances the needs of security, cost, and accuracy for third-party users.

Summary updated

BibTeX
@inproceedings{wu2023llmdet,
  author = {Kangxi Wu and Liang Pang and Huawei Shen and Xueqi Cheng and Tat-Seng Chua},
  title = {{LLMDet: A Third Party Large Language Models Generated Text Detection Tool}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.findings-emnlp.139},
}
Figure