LM$^2$otifs: An Explainable Framework for Machine-Generated Texts Detection

Xu Zheng, Zhuomin Chen, Esteban Schafir, Sipeng Chen, Hojat Allah Salehi, Haifeng Chen, Farhad Shirani, Wei Cheng, Dongsheng Luo · Submission to ICLR 2026 · Rejected

TL;DR

LM$^2$OTIFS transforms machine-generated text (MGT) detection from a black-box binary classifier into an interpretable graph-based system. By modeling text as token-document co-occurrence graphs and applying Graph Neural Networks (GNNs) with post-hoc subgraph explainers, it simultaneously achieves state-of-the-art detection accuracy, lightning-fast inference, and human-interpretable linguistic "motifs" that expose the stylistic fingerprints of LLMs.

What Problem Does This Paper Address?

While modern LLMs generate increasingly human-like text, current detectors (both white-box probability estimators and black-box classifiers) act mostly as opaque decision-makers. They assign a label or score without actionable supporting evidence, which limits their utility in plagiarism audits, legal contexts, and content moderation.

Furthermore, existing explainability tools are poorly matched for this domain: gradient-based methods (like Integrated Gradients) are computationally expensive on large models, while standard attention visualizations emphasize localized token interactions rather than the higher-level stylistic and global co-occurrence patterns that distinguish machine text from human writing.

Methods

LM$^2$OTIFS approaches detection through the lens of Probabilistic Graphical Models (PGMs) and operates across three stages:

  1. Graph Construction: The framework builds a heterogeneous text graph (adapted from TextGCN) consisting of token nodes and document nodes. Token–token edges are weighted via Pointwise Mutual Information (PMI) over a fixed-length sliding window (default size 20), while token–document edges link words directly to their host documents.
  2. GNN Classification: Authorship authentication is formulated as a node classification task. A multi-layer Graph Convolutional Network (GCN) propagates messages across token and document nodes, outputting class probabilities trained with cross-entropy loss.
  3. Explainable Motif Extraction: To generate explanations, the authors integrate a post-hoc subgraph explainer (GNNExplainer). It optimizes an objective that balances prediction fidelity against subgraph size: $$\Psi^*(G) = \arg\min_{G_{\text{exp}}} \text{CE}(Y; f(G_{\text{exp}})) + \lambda |G_{\text{exp}}|$$ The resulting connected subgraphs reveal "motifs"—ranging from individual word choices to multi-word phrases and sentence-level structures—that drove the detector's prediction.

Theoretical analysis proves that graph-based detectors strictly subsume empirical sequence-based (ESB) detectors, which are fundamentally bounded by finite context windows.

Datasets

The authors evaluated the framework across benchmark corpora covering diverse domains and LLM generators:

  • HC3: ChatGPT vs. human answers in open QA, computer science, medicine, and finance.
  • M4: Texts generated by DaVinci, Cohere, Dolly, and BloomZ across Reddit, PeerRead, arXiv, and WikiHow.
  • RAID: Content generated by Llama 2, GPT-4, MPT, and Mistral covering recipes, poetry, reviews, and books.
  • Yelp, Creative, and Essay: Texts generated by Claude-3-Sonnet, Claude-3-Opus, and Gemini-1.0-Pro.
  • PubMedQA: Used specifically for qualitative motif visualization.

Note: No new datasets were introduced; the study repurposes standard benchmark datasets.

Key Insights and Ideas

  • Graphs Beat Fixed Context Windows: Autoregressive language models predict sequentially, but detection does not require sequential generation. Graph representations model global token dependencies across an entire corpus, theoretically and empirically outperforming sequence-length-bounded baselines.
  • Explanations as Subgraphs, Not Saliency Scores: Single-token importance scores rarely capture why a sentence feels artificial. Subgraph motifs preserve phrase structures and semantic relationships (e.g., linking "obstructive" and "sleep" vs. "sleep-related breathing disorder"), revealing characteristic model phrasing.
  • Distinct Linguistic Fingerprints: Motif statistics reveal that human-generated text exhibits a significantly higher node-to-edge ratio in explanatory motifs than machine-generated text. MGT relies heavily on denser word-to-word relational patterns, exposing how models utilize distinct collocation habits.

Key Results

  • Detection Performance: LM$^2$OTIFS achieves an average accuracy of 0.95–0.98 and AUCs up to 1.00 across HC3, RAID, and M4, matching or exceeding top baselines like Binoculars, Fast-DetectGPT, and DeTeCtive.
  • Faithful Explanations: Under the Most Relevant First (MoRF) deletion protocol on HC3, removing the top 20% most important motif edges causes an accuracy plunge of over 15%, compared to $<10\%$ for baselines like LIME, SHAP, and GLTR. Under Least Relevant First (LeRF), performance remains steady, validating that the extracted motifs truly drive the decisions.
  • Inference Efficiency: At test time on HC3, LM$^2$OTIFS executes in 0.005–0.009 seconds, orders of magnitude faster than RoBERTa-QA (~2.5s), DeTeCtive (~13–18s), and Fast-DetectGPT (~24–28s).

Limitations and Future Work

  • Cross-Domain Generalization: Because the graph relies on empirical token co-occurrence in training sets, performance drops when tested out-of-domain (e.g., scoring 0.59 ACC on Reddit when trained on WikiHow), lagging behind zero-shot detectors leveraging pre-trained LLM priors.
  • Dependence on Graph Scale: Effective graph construction requires sufficient training samples to form discriminative token connections; performance under extreme low-resource regimes remains unverified.
  • Architectural Scope: The study primarily uses standard GCNs; future work could evaluate inductive GNNs, graph transformers, and richer semantic edge initializations.

Summary updated

BibTeX
@misc{zheng2025lm,
  author = {Xu Zheng and Zhuomin Chen and Esteban Schafir and Sipeng Chen and Hojat Allah Salehi and Haifeng Chen and Farhad Shirani and Wei Cheng and Dongsheng Luo},
  title = {{LM$^2$otifs: An Explainable Framework for Machine-Generated Texts Detection}},
  year = {2025},
  eprint = {2505.12507},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.12507},
}
Figure