Style-Specific Neurons for Steering LLMs in Text Style Transfer

Wen Lai, Viktor Hangya, Alexander Fraser
10/1/2024
cs.CL

No official code found. Best implementation: wenlai-lavine/sNeuron-TST (13 stars, last commit 2025-03-23).

Abstract

Text style transfer (TST) aims to modify the style of a text without altering its original meaning. Large language models (LLMs) demonstrate superior performance across multiple tasks, including TST. However, in zero-shot setups, they tend to directly copy a significant portion of the input text to the output without effectively changing its style. To enhance the stylistic variety and fluency of the text, we present sNeuron-TST, a novel approach for steering LLMs using style-specific neurons in TST. Specifically, we identify neurons associated with the source and target styles and deactivate source-style-only neurons to give target-style words a higher probability, aiming to enhance the stylistic diversity of the generated text. However, we find that this deactivation negatively impacts the fluency of the generated text, which we address by proposing an improved contrastive decoding method that accounts for rapid token probability shifts across layers caused by deactivated source-style neurons. Empirical experiments demonstrate the effectiveness of the proposed method on six benchmarks, encompassing formality, toxicity, politics, politeness, authorship, and sentiment.

View on arXivView PDF

Code Implementations(1)

EMNLP 2024 | Style-Specific Neurons for Steering LLMs in Text Style Transfer

132PythonOct 10, 20241 years ago

Similar Papers

Cite this paper

@article{lai2024stylespecific,
  title  = {Style-Specific Neurons for Steering LLMs in Text Style Transfer},
  author = {Wen Lai and Viktor Hangya and Alexander Fraser},
  year   = {2024},
  eprint = {2410.00593},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2410.00593v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.00593.svg)](https://codeofpaper.com/paper/2410.00593)

Discussion