DEMASQ: Unmasking the ChatGPT Wordsmith

Kavita Kumari

Network and Distributed System Security (NDSS) Symposium 2024 · Day 3 · LLM Security

Overview

The proliferation of Large Language Models (LLMs) like ChatGPT has ushered in a new era of content generation, but with it, a critical challenge: the inability to reliably distinguish between human-generated and AI-generated text. This talk introduces DEMASQ, a novel ChatGPT detector designed to address this pressing issue. Given by Kavita Kumari, this research tackles the alarming rise in misinformation, plagiarism, academic dishonesty, and various fraudulent activities facilitated by AI-generated content. Existing detection methods often fall short, lacking precision, being domain-specific, and proving inadequate against sophisticated models like ChatGPT.

Slides

Visual summary for DEMASQ: Unmasking the ChatGPT Wordsmith by Kavita Kumari
Visual summary for DEMASQ: Unmasking the ChatGPT Wordsmith by Kavita Kumari

Key moments

  1. 0:00 Introduction, problem of AI text detection, and DEMASQ overview
  2. 0:40 DEMASQ's novel approach: biases, Doppler effect, XAI
  3. 2:00 Foundational concepts: LLMs, Doppler Effect, EBMs, XAI
  4. 2:25 Doppler Effect analogy for human vs. AI text
  5. 4:00 Doppler effect's drumhead inspiration and Threat Model
  6. 4:50 DEMASQ's system architecture: embeddings, perturbation, EBM
  7. 6:00 EBM architecture, loss function, and Adapted Doppler Effect

DEMASQ: Unmasking the ChatGPT Wordsmith

Speakers: Kavita Kumari

Conference: NDSS Symposium

YouTube: (no public video)

Overview

The proliferation of Large Language Models (LLMs) like ChatGPT has ushered in a new era of content generation, but with it, a critical challenge: the inability to reliably distinguish between human-generated and AI-generated text. This talk introduces DEMASQ, a novel ChatGPT detector designed to address this pressing issue. Given by Kavita Kumari, this research tackles the alarming rise in misinformation, plagiarism, academic dishonesty, and various fraudulent activities facilitated by AI-generated content. Existing detection methods often fall short, lacking precision, being domain-specific, and proving inadequate against sophisticated models like ChatGPT.

DEMASQ offers a robust solution by focusing on two critical factors that undermine current detectors: the distinct biases inherent in human versus machine text composition, and the deliberate alterations humans make to AI-generated content to evade detection. The model is an energy-based detection model that incorporates an innovative optimization inspired by the Doppler effect to capture the interdependence between text embeddings and output labels. Furthermore, it leverages Explainable AI (XAI) techniques to generate diverse perturbations, significantly enhancing its robustness against adversarial rephrasing.

The significance of DEMASQ lies in its ability to achieve remarkably high accuracy in identifying ChatGPT-generated content across a wide array of domains, as demonstrated through rigorous evaluation on a comprehensive benchmark dataset. This work not only provides a powerful tool for content verification but also establishes a new research direction in the crucial field of AI text detection, offering a more comprehensive and effective solution for source identification in an increasingly AI-driven digital landscape.

Background

[▶ Watch: Introduction, problem of AI text detection, and DEMASQ overview (0:00)]()

The rapid advancement and widespread adoption of Large Language Models (LLMs), such as OpenAI's GPT-3.5 and GPT-4 series, have revolutionized text generation. These sophisticated AI systems, trained on vast datasets using supervised and reinforcement learning, are capable of producing highly coherent and contextually relevant human-like text. However, this very sophistication makes their output incredibly difficult to discern from human writing, creating significant challenges for academic integrity, journalistic authenticity, and online trust. The core problem DEMASQ aims to solve is the urgent need for accurate and reliable AI-generated text detection.

Existing text detection methods often struggle due to several limitations. Many are restricted to specific tasks or domains, perform poorly when faced with diverse content, or lack the necessary precision to differentiate between nuanced human and machine stylistic patterns. Crucially, they are frequently inadequate for reliably identifying content produced by advanced LLMs like ChatGPT, especially when users attempt to modify AI output to bypass detection. This gap highlights the need for more sophisticated approaches that can delve deeper into the intrinsic characteristics of text composition.

DEMASQ draws upon several foundational concepts to overcome these limitations. The Doppler effect, a principle from physics describing the change in observed frequency due to relative motion between a source and an observer, is ingeniously adapted. In DEMASQ's analogy, humans and ChatGPT are conceptualized as "sources" of text, and another human as the "observer." The "medium" represents the space where the human factor in text embeddings "vibrates" or where ChatGPT "imitates" human-generated content. This allows the model to capture the dynamic biases inherent in human versus machine generation.

Energy-Based Models (EBMs) form the statistical core of DEMASQ. EBMs assign scalar energy values to configurations of variables, with the goal of finding configurations that minimize this energy, indicating the most optimal relationship. In this context, EBMs quantify the compatibility between input text embeddings and their output labels (human or ChatGPT), where lower energy signifies a better match. The energy function, F(x,y), quantifies the dependency between the input text embedding (V(x)) and its output label (y).

Finally, Explainable AI (XAI), specifically the Integrated Gradients (IG) attribution method, is utilized to make the AI system's reasoning transparent and to enhance its robustness. IG helps identify how individual features of an input contribute to a model's prediction by accumulating gradients along a linear path from a baseline. This technique is crucial for generating targeted perturbations, which are essential for understanding and counteracting the impact of specific text features that might be altered by humans attempting to evade detection. The understanding of the Doppler effect is further informed by the physics of drumhead vibrations, where specific resonant frequencies and patterns of standing waves, described by the zeroth Bessel function, are leveraged to compute source frequencies for both human and ChatGPT-generated content.

Key Findings

[▶ Watch: Foundational concepts: LLMs, Doppler Effect, EBMs, XAI (2:00)]()

DEMASQ represents a significant leap forward in AI text detection, delivering a novel and highly effective solution to distinguish between human and ChatGPT-generated content. The core findings highlight its unprecedented accuracy and robustness compared to existing methods.

First and foremost, DEMASQ achieved an impressive overall accuracy ranging from 74.5% to 96% on a diverse and comprehensive benchmark dataset comprising 134,178 unique samples. This performance significantly outperforms all existing detectors, which, as demonstrated in baseline evaluations, achieved a maximum accuracy of only 47% in the best-case scenario, with most online tools falling below 50%. For instance, CheckGPT, a specialized detector, plummeted from 98-99% accuracy in its specific domain to a mere 2.1-13.3% when tested against the broader dataset.

A crucial contribution is the development of a comprehensive benchmark dataset of over 100,000 samples, spanning diverse domains like Medical, Open Q&A, Finance, Wiki, Reddit, ArXiv, and Political. This dataset includes both human-generated (59,214 samples) and ChatGPT-generated (74,964 samples) responses, explicitly incorporating rephrased content to challenge detector robustness.

DEMASQ demonstrated remarkable performance across these diverse domains. For example, it achieved a True Positive Rate (TPR) of 96.6% and a True Negative Rate (TNR) of 96.4% on the Medical dataset, and perfect scores (100% TPR and 100% TNR) on the Reddit dataset. On the combined dataset, DEMASQ reached a TPR of 97.0% and a TNR of 96.5%, showcasing its consistent reliability.

Furthermore, DEMASQ proved significantly more robust against rephrasing techniques employed by attackers. When tested on rephrased academic abstract datasets, where CheckGPT's accuracy declined drastically from 82.72% to 3.76% across tasks, DEMASQ maintained accuracies of 76.9%, 68.7%, and 58.3% respectively when trained on the combined benchmark. Even more impressively, when trained on individual original tasks and tested on their rephrased versions, DEMASQ achieved TPRs of 93.0%, 83.4%, and 74.9%, clearly outperforming CheckGPT and demonstrating its superior ability to handle modified AI content.

The research also establishes a novel approach by integrating concepts from physics (Doppler effect, drumhead vibrations) and Explainable AI into an energy-based detection framework. This unique combination allows DEMASQ to quantify the "energy" of text, revealing clear disparities: ChatGPT-generated content consistently exhibits lower, highly negative energy values, while human-generated content shows larger, positive energy values. This distinct separation facilitates accurate differentiation.

In summary, DEMASQ's key findings are its exceptional accuracy, its robust performance across diverse domains, its superior resilience to rephrasing, and its innovative interdisciplinary approach, setting a new standard for AI text detection.

Technical Deep Dive

[▶ Watch: Doppler Effect analogy for human vs. AI text (2:25)]()

DEMASQ's technical architecture is a sophisticated integration of text embeddings, explainable AI, adapted physics principles, and energy-based modeling. The system is designed to identify inherent biases in text composition and counteract deliberate evasion attempts.

The threat model for DEMASQ assumes a black-box detector scenario. The detector or human observer has no privileged access to the underlying LLM (e.g., weights, structures, gradients) – a realistic assumption given that models like OpenAI's GPT-3.5 family are not publicly accessible. Conversely, the attacker is a human actively trying to evade detection. This attacker is aware of the detector's deployment but lacks information about its specific internal design (e.g., use of EBM, Doppler effect, XAI). The attacker is also presumed to potentially rephrase input strings multiple times using ChatGPT or other techniques to bypass detection. These assumptions directly informed DEMASQ's design choices to build a resilient detector.

DEMASQ's system design and architecture begins with an input text string. This string is first converted into high-dimensional text embeddings. These embeddings then undergo perturbation using Integrated Gradients (IG), a technique from Explainable AI. The perturbed embeddings are subsequently fed into the Doppler Effect component for energy computation. This computed energy is then utilized within an Energy-Based Model (EBM) for either learning (during training) or inference (for making predictions).

For text embedding extraction, the system utilizes the Sentence Transformers library with the msmarco-distilbert-base-tas-b model. This model is chosen for its effectiveness in generating semantically meaningful sentence embeddings.

The Energy-Based Model (EBM) itself is a binary classification neural network comprising six fully connected layers. These layers are progressively sized: 512, 256, 128, 64, 32, and finally 1, with ReLU activations applied after each hidden layer. The output layer provides the energy value. The loss function for the EBM is a combination of Binary Cross-Entropy (BCE) loss and a novel regularization energy term derived from the Doppler effect. Specifically, the loss is defined as: loss = BCE + Ef(y) * min(Ef(0), Ef(1)). This formulation is designed to incentivize the model to assign high energy to human-generated instances (label 1) and low energy to ChatGPT-generated instances (label 0).

The Adapted Doppler Effect is central to DEMASQ's energy computation. Specific assumptions are made:

  • The text source is either human or ChatGPT.
  • If human, the source is considered "in motion" with a velocity equal to the variance observed in human responses.
  • If ChatGPT, the source is considered "stationary."
  • The observer is always human, moving at a constant velocity, which is set to 0.8.
  • The speed of the medium, cv, is calculated as var(V(x)) / FJ(0,1), where var(V(x)) is the variance of the input text embedding and FJ(0,1) is the fundamental frequency derived from drumhead vibrations.
  • The source's velocity, vs, is y * abs(var(V(x))), where y is the label (1 for human, 0 for ChatGPT).

To compute the source frequency (Efo), DEMASQ leverages the physics of drumhead vibrations, specifically focusing on the circular mode (n). The unique values in the text embedding V(x) are treated as radii of concentric circles. Algorithm 1, Source Frequency Computation, first adjusts embedding values to be non-negative, identifies unique values, and then calls Algorithm 2, Compute Drumhead Frequency. Algorithm 2 sets the number of diametric nodes m to 0 and the number of circular nodes n to the count of unique values in V(x). It then computes the fundamental frequency FJ(0,1) and the specific mode frequency FJ(m,n), with Efo derived from their ratio. This intricate process quantifies the "vibrational energy" associated with the text, which is key to the detection mechanism.

To address ChatGPT's rephrasing techniques and enhance robustness, the Explainable AI Integrated Gradients (IG) method is incorporated. The baseline for IG is set to V(x') = 0. The system identifies the top 20 most relevant features in the input text embedding that contribute most to its output label. It then systematically sets each of these relevant features to zero, one at a time, to generate perturbed input text embeddings. The energies (or frequencies) for each perturbed sample are calculated using Algorithms 1 and 2, averaged, and this aggregated energy is integrated into the loss function. This process significantly enhances DEMASQ's ability to differentiate between human and ChatGPT-generated responses, even when confronted with rephrased content.

The overall detection process, outlined in Algorithm 3, iteratively trains the EBM model. For each epoch, it computes the medium speed, source speed, receiver speed, source frequency, and observer frequency using the Doppler effect principles. The combined loss function (BCE + energy term) is optimized using the Adam optimizer with a learning rate of 0.0001 over 12 epochs. During inference, the model assigns negative energies for ChatGPT-generated content and positive energies for human-generated content, with the energy of the test query serving as its prediction.

Demo / Proof of Concept

[▶ Watch: DEMASQ's system architecture: embeddings, perturbation, EBM (4:50)]()

While the talk did not feature a live, interactive demonstration, the rigorous experimental setup and comprehensive evaluation detailed in the presentation serve as a robust proof of concept for DEMASQ's capabilities. The evaluation highlights its superior performance against existing detectors and its resilience to adversarial rephrasing.

The experimental setup utilized a powerful server environment equipped with PyTorch, 4 NVIDIA RTX 8000 GPUs, an AMD EPYC 7742 CPU, and 1024 GB of RAM, ensuring sufficient computational resources for extensive evaluations.

A crucial component of the evaluation was the benchmark dataset, curated to be highly diverse and representative of real-world text. It consisted of 134,178 unique samples, with 59,214 human-generated and 74,964 ChatGPT-generated responses. These samples covered 25,290 distinct questions across a wide range of domains, including Medical, Open Q&A, Finance, Wiki, Reddit, ArXiv, and Political. To ensure diversity and account for hybrid texts, the dataset also included rephrased ArXiv abstracts and responses from social networking platforms. The msmarco-distilbert-base-tas-b model was used for similarity checks, and all-MiniLM-L6-v2 for artifact removal during dataset preparation. Evaluation metrics included True Positive Rate (TPR), measuring sensitivity in detecting AI-generated text, and True Negative Rate (TNR), measuring specificity in detecting human-generated text.

In baseline evaluations, various existing tools and algorithms were assessed. As summarized in Table I (from the paper), these methods achieved a maximum accuracy rate of only 47% in the best-case scenario, with most online tools demonstrating success rates below 50%. For instance, CheckGPT, a detector specifically tailored for academic abstracts, achieved 98-99% accuracy within its narrow domain but plummeted to a dismal 2.1-13.3% when tested against DEMASQ's broader, more challenging benchmark dataset. In stark contrast, DEMASQ achieved an accuracy ranging from 74.5% to 96% on the combined benchmark dataset, significantly outperforming all existing detectors.

Discipline-specific evaluations, detailed in Table II, further underscored DEMASQ's robust performance. For the Medical dataset (4,992 records), DEMASQ achieved a TPR of 96.6% and a TNR of 96.4%. In Finance (15,732 records), it showed a TPR of 94.6% and a TNR of 92.7%. Notably, for the Reddit dataset (99,054 records), DEMASQ achieved perfect scores: 100% TPR and 100% TNR. On the overall combined dataset of 134,178 records, DEMASQ achieved an impressive TPR of 97.0% and a TNR of 96.5%.

To evaluate DEMASQ's crucial robustness against rephrasing, it was tested on academic abstract datasets (Task1, Task2, Task3) provided by Liu et al. (reference 34 in the paper). CheckGPT showed a progressive decline in accuracy on these rephrased datasets (Table IV): 82.72% for rephrased Task1, 56.35% for Task2, and a mere 3.76% for Task3, highlighting its limited effectiveness outside its original, biased context. In contrast, when DEMASQ was trained on the combined benchmark dataset and tested on these rephrased tasks (Table V), it achieved 76.9% accuracy for Task1, 68.7% for Task2, and 58.3% for Task3. Even more impressively, when separate EBMs were trained for each original task and tested on their respective rephrased versions (Table VI), DEMASQ achieved TPRs of 93.0% for Task1, 83.4% for Task2, and 74.9% for Task3, with comparable TNRs. These results unequivocally demonstrate DEMASQ's significant superiority over CheckGPT in detecting rephrased content.

The analysis of energy distribution, visualized in Figure 5 (from the paper), provided clear evidence of the model's differentiation capability. ChatGPT-generated content consistently exhibited lower, highly negative energy values (label 0), while human-generated content showed larger, positive energy values (label 1). This distinct separation in energy levels makes it relatively easy to differentiate between the two sources, further supported by the confusion matrices, which confirmed high accuracy across datasets, including the perfect 100% accuracy for the Reddit dataset.

Defensive Implications

[▶ Watch: EBM architecture, loss function, and Adapted Doppler Effect (6:00)]()

The development of DEMASQ carries significant implications for various sectors striving to maintain the integrity of digital content in an era increasingly dominated by AI-generated text. Defenders, ranging from academic institutions to online platforms and cybersecurity professionals, can leverage the principles and capabilities demonstrated by DEMASQ to bolster their defenses against misuse of LLMs.

For Academic Institutions: DEMASQ offers a powerful tool to combat academic dishonesty and plagiarism. Educators can integrate such detectors into their assessment processes to verify the originality of student submissions. This can help identify instances where students use ChatGPT to generate essays, reports, or code without proper attribution or understanding. The robustness against rephrasing is particularly critical here, as students might attempt to subtly alter AI-generated content to bypass simpler detectors. The insights from DEMASQ can also inform policy development regarding the ethical use of AI tools in education.

For Content Platforms and Social Media: The fight against misinformation, fake news, and fraudulent activities is paramount. Platforms can deploy DEMASQ-like systems to identify and flag AI-generated content that attempts to manipulate public opinion, spread propaganda, or engage in scams. By accurately unmasking the source, platforms can take appropriate action, such as labeling content as AI-generated, reducing its reach, or removing it entirely. This is crucial for maintaining trust and fostering healthy online discourse.

For Journalism and Media Organizations: Verifying the authenticity of sources and content is a core tenet of journalism. DEMASQ can aid journalists in discerning whether news articles, reports, or testimonials submitted by external parties are genuinely human-authored or AI-fabricated. This helps prevent the spread of synthetic media and ensures the credibility of journalistic output.

For Cybersecurity and Fraud Detection: AI-generated text can be used in sophisticated phishing attacks, social engineering campaigns, or to generate convincing fake reviews and spam. DEMASQ's ability to detect subtle machine biases and counter rephrasing makes it a valuable asset in identifying these malicious AI-driven activities, helping to protect users and systems from advanced threats.

Developing More Robust Detection Strategies: Beyond direct deployment, the underlying principles of DEMASQ – the use of energy-based models, the adapted Doppler effect, and Explainable AI for perturbation – provide a blueprint for future research and development in AI content detection. Defenders can explore these interdisciplinary approaches to build even more sophisticated and adaptive detectors that can keep pace with rapidly evolving generative AI models. Understanding why AI-generated text has different "energy" profiles or "vibrations" offers deeper insights into the fundamental differences between human and machine communication, which can inform the design of proactive defensive measures.

Enhancing Transparency and Trust: Ultimately, robust detection tools like DEMASQ contribute to greater transparency in the digital realm. By providing a mechanism to identify AI-generated content, it empowers users to make more informed decisions about the information they consume and trust, fostering a healthier digital ecosystem.

Key Takeaways

  • DEMASQ is a novel, highly accurate ChatGPT detector that significantly outperforms existing methods, achieving up to 96.5% accuracy on a diverse benchmark dataset.
  • The model addresses critical limitations of current detectors by accounting for inherent biases in human vs. machine text composition and human rephrasing techniques.
  • DEMASQ innovatively integrates the Doppler effect (conceptualizing text as waves with distinct "frequencies" for human vs. AI sources) and Energy-Based Models (EBMs) to quantify the compatibility of text with its source.
  • Explainable AI (Integrated Gradients) is leveraged to generate perturbations, significantly enhancing DEMASQ's robustness against adversarial attempts to evade detection through rephrasing.
  • The research provides a comprehensive benchmark dataset of over 100,000 samples across various domains, setting a new standard for evaluating AI text detectors.
  • DEMASQ's distinct energy distribution for human (positive energy) versus ChatGPT (negative energy) content offers a clear, quantifiable mechanism for differentiation, making it a powerful tool for content verification and combating misuse of LLMs.

About the Speaker(s)

Kavita Kumari is a researcher who presented the work titled "DEMASQ: Unmasking the ChatGPT Wordsmith" at the NDSS Symposium. Her research focuses on addressing critical concerns in the digital landscape, particularly the misuse of Large Language Models and the need for accurate AI-generated text detection. Her work demonstrates expertise in areas such as Large Language Models, Energy-Based Models, Explainable AI, and the application of interdisciplinary concepts to cybersecurity challenges.

All talks from Network and Distributed System Security (NDSS) Symposium 2024