[Paper Review] Real or Fake? Learning to Discriminate Machine from Human Generated Text
This paper proposes training energy-based models (EBMs) in the residual space of pre-trained auto-regressive language models to discriminate real human-generated text from machine-generated text. By using generated text as negatives, the EBM learns to assign lower energy to authentic text, achieving strong generalization across diverse generator architectures and datasets, especially with larger models and longer sequences.
Energy-based models (EBMs), a.k.a. un-normalized models, have had recent successes in continuous spaces. However, they have not been successfully applied to model text sequences. While decreasing the energy at training samples is straightforward, mining (negative) samples where the energy should be increased is difficult. In part, this is because standard gradient-based methods are not readily applicable when the input is high-dimensional and discrete. Here, we side-step this issue by generating negatives using pre-trained auto-regressive language models. The EBM then works in the residual of the language model; and is trained to discriminate real text from text generated by the auto-regressive models. We investigate the generalization ability of residual EBMs, a pre-requisite for using them in other applications. We extensively analyze generalization for the task of classifying whether an input is machine or human generated, a natural task given the training loss and how we mine negatives. Overall, we observe that EBMs can generalize remarkably well to changes in the architecture of the generators producing negatives. However, EBMs exhibit more sensitivity to the training set used by such generators.
Motivation & Objective
- To investigate whether energy-based models (EBMs) can generalize well when trained to distinguish real human text from machine-generated text.
- To address the challenge of training EBMs on discrete, high-dimensional text sequences where gradient-based negative mining is infeasible.
- To evaluate the robustness of EBMs when tested on negatives generated by models with different architectures or trained on different corpora.
- To explore the feasibility of using EBMs as a general-purpose text modeling framework beyond simple likelihood scoring.
Proposed method
- Train an energy-based model (EBM) to assign lower energy to real human-generated text and higher energy to text generated by a pre-trained auto-regressive language model.
- Use the pre-trained language model to generate negative samples, sidestepping the need for gradient-based negative mining in discrete sequences.
- Train the EBM using either binary cross-entropy or ranking loss to optimize discrimination between real and generated text.
- Evaluate generalization by testing the EBM on negatives produced by generators with different architectures (e.g., GPT-2 vs. BiLSTM) and different training corpora.
- Analyze sensitivity to input perturbations (e.g., word swaps, entity replacements) to assess robustness and in-distribution vs. out-of-distribution behavior.
- Use residual energy functions to model the discrepancy between real text and the generator’s output, treating the language model as a prior.
Experimental results
Research questions
- RQ1Can energy-based models trained on real text and generated negatives generalize to detect text from unseen generator architectures?
- RQ2How does the generalization performance of EBMs vary when the test-time generator is trained on a different corpus than the training generator?
- RQ3To what extent does the energy function learn patterns in generated text versus real text, and how does this affect robustness to distributional shifts?
- RQ4How do model scale (architecture size) and generation length affect the discrimination accuracy of the EBM?
- RQ5How sensitive is the energy function to structural perturbations in real text, and what does this reveal about its inductive bias?
Key findings
- The EBM achieves high discrimination accuracy—up to 84.6%—when using the worst of three generated negatives, demonstrating strong performance on the real/fake text detection task.
- The EBM generalizes remarkably well across different generator architectures, such as GPT-2 and BiLSTM, indicating robustness to architectural changes.
- Performance degrades significantly when the test-time generator is trained on a different corpus than the training generator, highlighting data distribution sensitivity.
- The energy function is more sensitive to perturbations at the beginning and end of sequences, where generator outputs most differ from real text.
- The EBM assigns lower energy to random or out-of-domain text, indicating it learns to detect non-generated patterns, but this behavior is not always reliable.
- The energy function is more robust to model scale and generation length: larger models and longer sequences improve discrimination performance.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.