mStyleDistance: Multilingual Style Embeddings and their Evaluation

Justin Qiu, Jiacheng Zhu, Ajay Patel, Marianna Apidianaki, Chris Callison-Burch

Introduction

In the field of Natural Language Processing (NLP), semantic embeddings have revolutionized our ability to represent the meaning of text. However, capturing the "style" of a sentence—the specific linguistic choices that dictate how something is said rather than what is said—remains a significant challenge. Researchers from the University of Pennsylvania have introduced mStyleDistance, a robust multilingual style embedding model designed to isolate stylistic features from content and language.

The Challenge of Multilingual Style Representation

Style encompasses a wide range of linguistic attributes, including formality, the use of metaphors, sentence structure, and toxicity. While high-quality style embeddings exist for English, extending these capabilities to other languages has been hindered by a lack of large-scale, human-labeled datasets. Traditional methods often conflate style with semantic content or language-specific markers. A truly effective style model must be able to recognize that a formal sentence in Spanish shares stylistic properties with a formal sentence in French, despite differences in vocabulary and grammar.

Methodology: Synthetic Data and Contrastive Learning

To overcome the data scarcity problem, the authors utilized a combination of synthetic data generation and contrastive learning.

Synthetic Data Generation

The researchers developed MSynthSTEL, a dataset covering 40 distinct style features across nine major languages (Arabic, German, Spanish, French, Hindi, Japanese, Korean, Russian, and Chinese). Using GPT-4, they generated triplets consisting of an "anchor" sentence, a "positive" example (same style, different content), and a "negative" example (different style, same content).

Contrastive Learning Framework

The model uses xlm-roberta-base as its foundation, fine-tuned using a triplet loss function. A key innovation is the use of cross-lingual triplets. By forcing the model to compare an anchor in one language with examples in others, the training process encourages the development of a language-agnostic style space.

mStyleDistance uses contrastive learning to map similar styles across different languages into a shared embedding space.

As illustrated in the figure above, the model learns to pull the embeddings of stylistically similar sentences closer together (e.g., Active Voice in Spanish and French) while pushing stylistically different sentences further apart, even if they share the same semantic content.

Experimental Results

The performance of mStyleDistance was evaluated across several benchmarks, including the Multilingual Style-of-Content (SoC) benchmark and authorship verification tasks (PAN 2013-2015).

Performance Across Style Features

mStyleDistance demonstrated superior performance compared to existing models like LISA and the base XLM-RoBERTa. It achieved significant gains in identifying simplicity, formality, toxicity, and positivity. Notably, in the formality task, mStyleDistance reached a score of 0.71, a substantial improvement over the base model's 0.16.

Performance comparison of mStyleDistance against baseline models across various style features and cross-lingual formality.

Cross-Lingual and Zero-Shot Generalization

One of the model's most impressive feats is its ability to maintain performance in cross-lingual settings. In the cross-lingual formality task, it achieved a score of 0.53, proving that stylistic representations are preserved across translations. Furthermore, the model showed strong zero-shot generalization to languages not included in the training set, such as Dutch, where it outperformed English-centric models on authorship verification tasks.

Discussion and Future Work

The success of mStyleDistance highlights that synthetic data generated by large language models (LLMs) is a viable resource for training specialized encoders. However, the authors note that the model may inherit certain biases or stylistic "flavors" inherent to GPT-4.

Future research will focus on expanding the range of stylistic features and improving performance for low-resource languages where synthetic data generation is less reliable. Additionally, these embeddings hold promise for improving automated metrics in machine translation, ensuring that not only the meaning but also the "vibe" and tone of the original text are preserved.

Paper Link: arXiv:2502.15168
Code & Model: Hugging Face

Summary updated

BibTeX
@inproceedings{qiu2025mstyledistance,
  author = {Justin Qiu and Jiacheng Zhu and Ajay Patel and Marianna Apidianaki and Chris Callison-Burch},
  title = {{mStyleDistance: Multilingual Style Embeddings and their Evaluation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure