BiScope: AI-generated Text Detection by Checking Memorization of Preceding Tokens

Hanxi Guo, Siyuan Cheng, Xiaolong Jin, Zhuo Zhang, Kaiyuan Zhang, Guanhong Tao, Guangyu Shen, Xiangyu Zhang

TL;DR

BiScope is a high-performance AI-text detector that moves beyond simply asking "how likely is the next word?" Instead, it introduces a bi-directional approach that measures both the model's ability to predict the future (forward) and its "memorization" of the immediate past (backward). This simple but profound shift allows BiScope to achieve an average F1 score of over 0.95, significantly outperforming top commercial tools like GPTZero.

The Problem with Current Detectors

As Large Language Models (LLMs) become more sophisticated, distinguishing between human-written and AI-generated text is becoming a high-stakes game of cat and mouse. Current detection methods generally fall into three camps: prompting another LLM to "guess," analyzing linguistic patterns, or using a "surrogate" model to see how well the text aligns with that model's predictions.

The authors identify two major flaws in existing surrogate-based methods:

  1. Feature Insufficiency: Most tools only look at "forward" information—the probability of the next token. As AI gets better at mimicking human writing, this single metric becomes less reliable.
  2. Contextual Heterogeneity: LLMs behave differently depending on the topic or style. A detector trained on Yelp reviews might fail miserably when looking at Python code or academic essays.
Comparison of forward (next token) and backward (preceding token) metrics between human and AI text, alongside the BiScope conceptual model.

The BiScope Methodology

The core innovation of BiScope is the bi-directional cross-entropy loss calculation.

When a causal language model (like GPT) processes text, its internal states don't just predict what's coming next; they also "memorize" what was just processed. The authors discovered a fascinating divergence:

  • Human Text: A surrogate LLM typically has a hard time predicting the next word (high forward loss) but shows a strong "memory" of the token it just saw (low backward loss).
  • AI Text: The surrogate model predicts the next word easily (low forward loss) but, surprisingly, shows a weaker memory of the immediate preceding token in its output logits (higher backward loss).
The four-step BiScope pipeline: Prompt Generation, Loss Computation, Feature Extraction, and Classification.

The BiScope Pipeline: 1. Summarization (Optional): The system first generates a summary of the input text to "prime" the surrogate model, helping it understand the context. 2. Multi-Point Splitting: The text is divided into segments (e.g., at 10% intervals) to capture how the model's behavior changes throughout a document. 3. Loss Computation: For each segment, BiScope calculates the Forward Cross-Entropy (FCE) and the Backward Cross-Entropy (BCE) using an open-source surrogate model. 4. Classification: These statistical features (mean, max, min, std) are fed into a simple Random Forest classifier to make the final "Human vs. AI" call.

Experimental Setup and Datasets

The researchers curated a massive, diverse dataset to put BiScope to the test, consisting of over 22,000 samples across 25 distinct groups.

  • Domains: Arxiv papers, Yelp reviews, Creative writing, Student essays, and Python code.
  • Generators: Text was generated by five of the latest commercial heavyweights: GPT-3.5-Turbo, GPT-4-Turbo, Claude-3-Sonnet, Claude-3-Opus, and Gemini-1.0-Pro.
  • Paraphrasing: They also created a paraphrased version of the dataset to test if "polishing" AI text could trick the detector.

Key Insights

  • The "Backward" Look is the Secret Sauce: By checking how well the model "remembers" the previous token, BiScope captures a unique signature of AI generation that forward-only models miss.
  • Internal States Matter: The paper proves that output logits contain much richer information than just the probability of the next word; they reflect the model's internal "planning" and "memorization" processes.
  • Summaries as Anchors: Using a summary to guide the detection process helps the surrogate model stay "on track," making the features more robust across different writing styles and domains.
  • AI is Predictable, Humans are Not: The results reinforce the idea that AI text follows the "path of least resistance" for the model, while human text is characterized by local consistency paired with global unpredictability.

Key Results

  • Superior Accuracy: BiScope achieved an average F1 score of over 0.95, beating non-commercial state-of-the-art methods by a staggering 0.30 F1.
  • Beating the Pros: It outperformed GPTZero (a leading commercial tool) in 72% of cases, particularly excelling in the difficult task of detecting AI-generated code.
  • Speed: Without the optional summarization step, BiScope processes a sample in less than 200 milliseconds, making it viable for real-time applications.
  • Robustness: While most detectors lose accuracy when text is paraphrased, BiScope actually saw a slight increase in performance, proving its features are deeply rooted in the structure of the text rather than just specific word choices.

Limitations and Future Work

The authors acknowledge that Out-of-Distribution (OOD) scenarios remain a challenge. When the system is trained on one type of data (like Yelp reviews) and tested on another (like Code), the F1 score drops by about 0.10.

Future research directions include exploring even deeper internal model states beyond the output logits, improving robustness in "few-shot" settings where very little training data is available for a specific new domain, and combining the memorization signal with other emerging detection techniques for a truly "un-gameable" detector.

Summary updated

BibTeX
@inproceedings{guo2024biscope,
  author = {Hanxi Guo and Siyuan Cheng and Xiaolong Jin and ZHUO ZHANG and Kaiyuan Zhang and Guanhong Tao and Guangyu Shen and Xiangyu Zhang},
  title = {{BiScope: AI-generated Text Detection by Checking Memorization of Preceding Tokens}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Hew2JSDycr},
}
Figure