Introduction
As Large Language Models (LLMs) evolve, they have become increasingly adept at mimicking human writing styles, making the detection of machine-generated text (MGT) a critical challenge. Traditional detectors often struggle with two primary issues: structural blindness, where text is treated as a flat sequence of tokens ignoring logical flow, and data scarcity, where massive labeled datasets are required to train robust models for every new LLM iteration.
This paper introduces CoCo (Coherence-Enhanced Contrastive Learning), a novel framework designed to distinguish MGT from human-written text (HWT) by focusing on the structural "glue" of a document—its coherence. By utilizing an improved contrastive learning objective, CoCo achieves state-of-the-art detection performance even when labeled training data is extremely scarce.
The Coherence Gap: Human vs. Machine Text
A core insight of the CoCo framework is that while AI can generate fluent individual sentences, it often fails to maintain the deep, structural entity-linking that humans naturally employ over long passages. This "entity consistency" defines human-like coherence.
As illustrated above, human-written text typically exhibits dense interactions between sentences through shared entities (e.g., "Airbnb"). In contrast, machine-generated text often lacks these logical threads, resulting in isolated sentences that may be grammatically correct but structurally disjointed. CoCo turns this structural weakness into a detectable fingerprint.
The CoCo Framework Architecture
The CoCo framework addresses the limitations of sequence-based detection through three primary innovations:
- Coherence Graph Construction: Drawing on Centering Theory, documents are represented as graphs where nodes are entities and edges represent relations within and across sentences.
- Coherence Encoder Module (CEM): This module employs a Relation-Aware Graph Convolutional Network (GCN) to process the coherence graph and an attention-based LSTM to aggregate sentence-level information, which is then fused with standard RoBERTa embeddings.
- Improved Contrastive Loss: The model uses a supervised contrastive learning framework (MoCo-based) with a specialized loss function that assigns higher weights to "hard negatives"—AI samples that statistically resemble human writing.
Experimental Evaluation and Key Insights
The authors evaluated CoCo across several benchmarks, including GROVER, GPT-2, and a newly introduced GPT-3.5 dataset.
Superiority in Low-Resource Settings
CoCo's most significant advantage appears when training data is limited. When trained on only 500 examples, CoCo outperformed standard RoBERTa and XLNet models by significant margins. For instance, on the GROVER dataset, CoCo achieved 69.93% accuracy, compared to RoBERTa’s 66.21%. On the GPT-3.5 benchmarks, the model consistently surpassed 99% accuracy.
The GPT-3.5 Paradox
Interestingly, the study found that text from the more advanced GPT-3.5 was actually easier to detect than text from older models. The researchers hypothesize that because advanced LLMs are trained to fit the general human corpus so precisely, they tend to produce "general expressions" that act as a statistical giveaway to fine-tuned detectors.
Robustness to Perturbation
In tests involving random word deletion, insertion, or replacement, CoCo maintained a 4.53% performance lead over baseline models. This suggests that its reliance on high-level graph structure makes it significantly harder to "fool" with simple word-level adversarial changes.
Conclusion and Future Work
CoCo demonstrates that modeling document coherence is a powerful tool for MGT detection, particularly in low-resource environments. While the computational overhead of graph construction is higher than standard sequence processing, the gains in accuracy and robustness are substantial. Future work may focus on extending this entity-linking approach to shorter texts or specialized domains like computer code where traditional entity extraction is more challenging.
Summary updated