Transferring BERT-like Transformers' Knowledge for Authorship Verification

Andrei Manolache, Florin Brad, Elena Burceanu, Antonio Barbalau, Radu Tudor Ionescu, Marius Popescu

Introduction

Authorship Verification (AV) is the task of determining whether two texts were written by the same individual. While Transformer-based models like BERT have achieved state-of-the-art results, recent observations suggest these models may rely on "spurious features"—such as specific topics or character names—rather than genuine linguistic style. This paper investigates these biases and proposes a more rigorous experimental framework to evaluate true stylometric generalization.

Experimental Design and Datasets

To isolate the effects of topic vs. style, the researchers introduced five new public splits of the standard PAN fanfiction dataset. These splits progressively remove shared information between training and testing sets, moving from a "Closed" environment to an "Open All" environment where neither authors nor fandoms (topics) are seen during training.

Definition of the five experimental splits based on author and fandom visibility.

Additionally, the authors introduced DarkReddit, a cross-corpus dataset containing 1,026 samples from the /r/darknet subreddit. This dataset features shorter, more colloquial, and topic-specific text compared to the creative writing in PAN, providing a challenging test for models trained on fanfiction.

Methodology

The study evaluated BERT and Character BERT (charBERT) as binary classifiers. Because BERT is limited to 512 tokens, long documents were processed using a chunking strategy (256-token segments), with final probabilities averaged across all pairs. To combat topic bias, the researchers employed Named Entity Masking, replacing specific names (e.g., "Wolverine") with generic placeholders (e.g., [PERSON]) using Named Entity Recognition (NER).

The "Named Entity" Trap

Using Integrated Gradients for explainability, the authors visualized the tokens most influential to the models' decisions. The analysis revealed a significant flaw: in "Closed" settings, models fixate almost exclusively on named entities.

Visualization of token importance using Integrated Gradients, highlighting the model's over-reliance on character names.

If a specific character name appears frequently in an author's training data, the model learns to associate that name with the author. Consequently, the model fails when the same author writes about different characters, or when a different author writes about the same characters (fandom-specific bias). This confirms that models are often heavily biased toward content rather than style.

Key Results and Generalization

The results demonstrate that topic-specific information is often more disruptive to model performance than author-specific information. However, forcing the model to ignore these cues significantly improves generalization:

  • Intra-Corpus (PAN): On the most difficult "Open All" split, removing named entities improved BERT's overall score from 81.7 to 83.1.
  • Cross-Corpus (DarkReddit): The impact was even more pronounced here. A BERT model trained on standard PAN data achieved an overall score of 67.0 on DarkReddit. When trained on PAN without named entities, the score jumped to 72.6.

These findings suggest that entity masking acts as a powerful data-centric regularizer, forcing Transformers to focus on syntax, punctuation, and vocabulary—the core components of stylometry.

Conclusion and Future Work

This research highlights the vulnerability of Transformer models to content-based "cheating" in authorship tasks. By implementing rigorous data splits and entity masking, models can be steered toward learning transferable stylistic features. Future work will focus on handling longer sequences to capture global document structure and refining methods to disentangle content from style in noisy, real-world datasets.

Summary updated

BibTeX
@inproceedings{manolache2022transferring,
  author = {Andrei Manolache and Florin Brad and Elena Burceanu and Antonio Barbalau and Radu Tudor Ionescu and Marius Popescu},
  title = {{Transferring BERT-like Transformers' Knowledge for Authorship Verification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  url = {https://openreview.net/forum?id=-JovWNGvf-E},
}
Figure