DeepStyle: User Style Embedding for Authorship Attribution of Short Texts

Zhiqiang Hu, Roy Ka-Wei Lee, Lei Wang, Ee-Peng Lim, Bo Dai

TL;DR

DeepStyle is a novel embedding-based framework designed to identify the authors of short social media posts by learning their unique "writing style fingerprints." By combining multi-view text features with a triplet loss objective, the model maps users into a latent space where similar writing styles cluster together, significantly outperforming traditional deep learning classifiers on large-scale Twitter and Weibo datasets.

What Problem Does This Paper Address?

Authorship Attribution (AA)—the task of determining who wrote a specific text—is a cornerstone of digital forensics and social media analysis. However, short texts (like tweets or Weibo posts) present a "data sparsity" problem: there simply isn't enough text in a single post for traditional linguistic models to grab onto.

Previous solutions tried to fix this by aggregating all of a user's posts into one giant document, but this fails when you need to identify the author of a single query post. Furthermore, most existing deep learning models for AA are "black boxes" that rely on a single feature type (like word sequences), making them less robust and harder to interpret. DeepStyle aims to solve the short-text challenge while providing a more explainable, multi-dimensional representation of style.

Methods

The DeepStyle framework is divided into two primary modules:

  1. Post Embedding Module: Instead of looking at just words, the model uses a Multi-Style Post Representation. It extracts four types of features: words, characters, bigrams, and Part-of-Speech (POS) tags. Each feature set is processed through its own Convolutional Neural Network (CNN) to create latent representations. These are then fused into a single vector using a fusion function (the authors found that Capsule Networks worked best for this).
  2. Triplet Loss Training: This is the core innovation. Unlike standard models that use Cross-Entropy loss to "classify" a post, DeepStyle uses Triplet Loss. It takes an "anchor" post, a "positive" post (same author), and a "negative" post (different author). The model is trained to minimize the distance between the anchor and the positive post while maximizing the distance from the negative one in the embedding space.
  3. User Style Aggregation: To represent a user's overall style, the model aggregates the embeddings of their individual posts into a single User Style Embedding using functions like Mean, Max, or Capsule aggregation.

Datasets

The authors evaluated DeepStyle on two massive, real-world datasets to prove its versatility across languages:

  • Twitter: 7,026 users, with approximately 1,000 tweets per user.
  • Weibo: 9,819 users, consisting of short Chinese texts.

These datasets are particularly challenging because of the high number of candidate authors (thousands of "distractors") and the informal nature of social media language.

Key Insights and Ideas

  • Style as a Distance Metric: The move from "classification" to "embedding" is a major shift. By treating style as a position in a high-dimensional space, the model can perform AA in both supervised and unsupervised settings (e.g., finding the "nearest neighbor" to a mystery post).
  • Multi-View Robustness: The paper demonstrates that relying on just one feature (like word n-grams) is insufficient for short texts. Combining syntactic (POS tags) and structural (character/bigram) features provides a much more stable "fingerprint."
  • Language Agnosticism: DeepStyle performed consistently well on both English (Twitter) and Chinese (Weibo). Interestingly, the authors noted that character-level features were more potent for Chinese text, likely because Chinese characters encode more semantic meaning than English characters.
  • Explainability through Visualization: Because the model produces embeddings, researchers can visualize the "style space" to see which authors write similarly and which features (like specific POS tag patterns) drive those similarities.

Key Results

DeepStyle consistently outperformed state-of-the-art baselines (including standard CNNs and LSTMs):

  • Precision at 1 (P@1): On the full Twitter dataset (7k+ users), DeepStyle achieved a P@1 of 21.4%, compared to 18.7% for the best CNN baseline. On Weibo, it hit 23.9%. While these numbers might seem low, they are impressive given the massive pool of thousands of potential authors.
  • Scalability: As the number of candidate users increased from 50 to 5,000+, DeepStyle’s performance decayed much more slowly than the baselines, showing it is more robust for large-scale applications.
  • Data Efficiency: Even when the training data was cut down to only 50 posts per user, DeepStyle maintained its lead, proving it can learn a style representation with relatively little input.

Limitations and Future Work

The authors identify two main areas for improvement:

  • Temporal Evolution: Writing style isn't static; people change how they write over months or years. The current model treats all of a user's posts as a single "snapshot" and does not yet account for the evolution of style over time.
  • Advanced Visualizations: While embeddings are inherently more interpretable than black-box classifiers, the authors want to develop better tools to specifically visualize which linguistic features are most responsible for a specific user's style embedding.

Summary updated

BibTeX
@inproceedings{hu2020deepstyle,
  author = {Zhiqiang Hu and Roy Ka-Wei Lee and Lei Wang and Ee-Peng Lim and Bo Dai},
  title = {{DeepStyle: User Style Embedding for Authorship Attribution of Short Texts}},
  booktitle = {APWeb/WAIM},
  year = {2020},
  doi = {10.1007/978-3-030-60290-1\_17},
}
Figure