Stylometric Detection of AI-Generated Text in Twitter Timelines

Tharindu Kumarage, Joshua Garland, Amrita Bhattacharjee, Kirill Trapeznikov, Scott W. Ruston, Huan LiuarXiv 2023 · DOI · arXiv

Introduction

As Large Language Models (LLMs) like GPT-4 become increasingly sophisticated, the ability to distinguish between human-authored and machine-generated text has become a critical frontier in digital safety. Social media platforms, particularly Twitter, are highly susceptible to AI-driven misinformation campaigns. A significant threat involves the hijacking of credible human accounts, where an adversary transitions from human-written content to AI-generated propaganda. This paper explores a novel detection method that leverages "stylometry"—the unique linguistic fingerprints of an author—to identify these transitions.

The Challenge of Short-Form Text

Detecting AI-generated text is inherently difficult in short-form environments. Traditional state-of-the-art detectors rely on Pre-trained Language Models (PLMs) like RoBERTa to identify semantic "tells." However, a single tweet often lacks sufficient semantic depth for these models to perform reliably. This creates a vulnerability where semantic signals are too weak to flag a sophisticated bot. To address this, the researchers propose a hybrid approach that combines semantic analysis with stylistic features that remain consistent even in brief snippets of text.

Methodology: Fusing Semantics and Stylometry

The proposed framework addresses two primary tasks: Detection (identifying if a tweet is AI-generated) and Localization (pinpointing the exact moment an account's authorship changes).

The core innovation lies in the use of stylometric features, categorized into three distinct domains: phraseology, punctuation, and linguistic diversity. Unlike semantic embeddings, which focus on what is being said, stylometry focuses on how it is written.

Categorization of stylometric features used in the hybrid detection model.

For the detection task, a fusion network was developed to concatenate embeddings from a RoBERTa model with these stylometric features. This allows the model to utilize both high-level meaning and low-level stylistic habits (such as specific hashtag usage or sentence length variance) to make a classification.

Detecting the "Change Point"

To solve the problem of account takeovers, the researchers introduced StyloCPA (Stylometric Change Point Agreement). This method treats a Twitter timeline as a time series of stylistic features. By applying the Pruned Exact Linear Time (PELT) algorithm, the system identifies abrupt statistical variations across multiple features simultaneously.

Illustration of a Twitter timeline transition from human-authored to machine-generated content at a specific change point.

If a significant number of features signal a shift at the same timestamp (the "agreement threshold"), the system flags an author change. This approach is particularly effective because stylistic shifts are often more immediate and measurable than semantic shifts when an AI takes over a human's timeline.

Experimental Results

The model was evaluated using both a publicly available benchmark (TweepFake) and a custom In-House Dataset featuring synthetic timelines stitched together from human tweets and AI generations (GPT-2 and GPT-Neo).

  • Superior Accuracy: On the TweepFake dataset, the stylometric fusion model achieved an accuracy of 0.911, outperforming the standalone RoBERTa baseline of 0.896.
  • Robustness in Short Timelines: In scenarios where only a single tweet was available ($N=1$), the fusion model significantly boosted accuracy from 0.807 to 0.875, demonstrating that stylometry compensates for weak semantic signals.
  • Localization Precision: For the change-point detection task, StyloCPA achieved a localization accuracy of 0.822, compared to just 0.745 for PLM-only approaches.

Conclusion

This research demonstrates that stylometry serves as a vital safety net for AI detection in short-form text. While linguistic diversity metrics proved less effective due to tweet brevity, punctuation and phraseology patterns emerged as powerful "tells" for machine-generated content. Future work will focus on model attribution—identifying which specific AI generated a text—and testing the system's robustness against adversarial AI models trained specifically to mimic human style.

Summary updated

Abstract

Recent advancements in pre-trained language models have enabled convenient methods for generating human-like text at a large scale. Though these generation capabilities hold great potential for breakthrough applications, it can also be a tool for an adversary to generate misinformation. In particular, social media platforms like Twitter are highly susceptible to AI-generated misinformation. A potential threat scenario is when an adversary hijacks a credible user account and incorporates a natural language generator to generate misinformation. Such threats necessitate automated detectors for AI-generated tweets in a given user's Twitter timeline. However, tweets are inherently short, thus making it difficult for current state-of-the-art pre-trained language model-based detectors to accurately detect at what point the AI starts to generate tweets in a given Twitter timeline. In this paper, we present a novel algorithm using stylometric signals to aid detecting AI-generated tweets. We propose models corresponding to quantifying stylistic changes in human and AI tweets in two related tasks: Task 1 - discriminate between human and AI-generated tweets, and Task 2 - detect if and when an AI starts to generate tweets in a given Twitter timeline. Our extensive experiments demonstrate that the stylometric features are effective in augmenting the state-of-the-art AI-generated text detectors.
BibTeX
@misc{kumarage2023stylometric,
  author = {Tharindu Kumarage and Joshua Garland and Amrita Bhattacharjee and Kirill Trapeznikov and Scott W. Ruston and Huan Liu},
  title = {{Stylometric Detection of AI-Generated Text in Twitter Timelines}},
  year = {2023},
  eprint = {2303.03697},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.03697},
}
Figure