Contributions
- Hybrid TDA-Transformer architecture: Demonstrates that Topological Data Analysis, applied to reshaped RoBERTa pooled outputs, captures linguistic structure orthogonal to Transformer representations, improving robustness to dataset heterogeneity.
- Multi-class authorship attribution: Extends the detection problem beyond binary (human vs. deepfake) to multi-class (which LLM authored the text), enabling fine-grained defense and investigation of specific model vulnerabilities.
- Evaluation on realistic, imbalanced datasets: Tests on three datasets with imbalanced class distributions and diverse writing styles (generation, paraphrasing, translation), simulating real-world LLM usage rather than homogeneous controlled settings.
- Style detection analysis: Shows TopFormer also improves detection of how text was generated (paraphrasing vs. generation vs. translation), adding value for intent inference.
Method
TopFormer operates in four layers:
- RoBERTa backbone: Fine-tuned RoBERTa-base extracts contextual (semantic/syntactic) representations from text, producing a 1 × 768 pooled output vector.
- Dropout regularization: A 30% dropout layer is applied to prevent overfitting on imbalanced data.
- Topological layer: The regularized 1 × 768 vector is reshaped to 24 × 32 (the closest square matrix to 768 without row > column, which the authors find destabilizes TDA features). This 2D matrix is input to a persistent homology computation, which extracts topological features: birth times, death times, and persistence values of connected components (0-dimension Betti numbers, $\beta_0$). This yields a 23 × 3 feature matrix (23 components × [birth, death, persistence]), flattened to 1 × 69.
- Linear classifier: The 1 × 768 RoBERTa features are concatenated with 1 × 69 TDA features (yielding 1 × 837), passed through a linear layer, then softmax for multi-class classification.
Key insight: Persistent homology captures the "true shape" of data even amidst noise, encoding linguistic structure as topological patterns. The authors interpret birth/death/persistence features as capturing syntactic structure (word-order and function-word patterns that persist across perturbations), complementing RoBERTa's semantic features.
Results
Authorship attribution (multi-class): TopFormer outperforms all baselines on all three datasets (Table 2–4):
- OpenLLMText (5 classes: human, LLaMA, ChatGPT, PALM, GPT-2): Macro F1 0.7522 (TopFormer) vs. 0.7288 (RoBERTa), +2.4% (also tested with BERT backbone for smaller datasets).
- SynSciPass (12 classes: human + 11 LLM generators/paraphrasers/translators): Macro F1 0.9058 (TopFormer) vs. 0.8719 (RoBERTa), +3.9%.
- Mixset (8 classes: human, GPT-4, ChatGPT, ChatGLM, Dolly, StableLM, LLaMA, ChatGPT-turbo): Macro F1 0.8294 (TopFormer) vs. 0.7705 (RoBERTa), +6.9%.
Baselines tested: GPT-who (statistical; performs poorly), Contra-BERT (contrastive learning; competitive but underperforms TopFormer on most datasets), vanilla BERT and RoBERTa (strong baselines), Gaussian-RoBERTa (control showing gains are not due to noise injection).
Style detection (paraphrase vs. generation vs. translation): TopFormer particularly excels on SynSciPass (+7% Macro F1) with four style labels, confirming TDA captures style-related structural variation.
Homogeneous datasets (TuringBench, M4): TopFormer performs comparably to RoBERTa (within 1%), suggesting TDA does not hurt performance even when dataset heterogeneity is low.
Notes
Strength: Thorough evaluation on realistic datasets reflecting how people actually use LLMs (paraphrasing, generation, translation, summarization). Ablation study (Table 8) systematically compares different TDA inputs (pooled output, attention weights, last hidden state, correlation matrix), demonstrating that reshaped pooled_output is most stable and efficient. The control experiment with Gaussian-RoBERTa rules out noise injection as the source of gains.
Limitation: Training time increases 0.5–2 hours depending on dataset size, though inference remains fast. TDA extraction requires careful tuning of reshaping dimensions (finding 24 × 32 as the optimal near-square matrix for 768-dimensional vectors); generalization to different backbone models or dimensionalities is unclear. Performance on homogeneous datasets is marginal, suggesting the main value is in heterogeneous, imbalanced settings typical of early-stage LLM detection.
Gap for future work: No adversarial robustness evaluation (e.g., does TopFormer withstand authorship obfuscation attacks?). The paper mentions this as future work. Cross-LLM generalization (train on GPT-3 / ChatGPT, test on unknown newer models) is not addressed.