---
title: "Text Detoxification as Style Transfer in English and Hindi (2023)"
description: "How the authors rewrote toxic comments in English and Hindi, and what their tests found about civility, meaning preservation, and fluency."
canonical: "https://research.elamur.ai/free/en/papers/mukherjee-2023-text-detoxification-as-style-transfer/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/mukherjee-2023-text-detoxification-as-style-transfer/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / Text Detoxification as Style Transfer in English and Hindi

# Text Detoxification as Style Transfer in English and Hindi

Paper · 2023 · Sourabrata Mukherjee, Akanksha Bansal, Atul Kr. Ojha et al.

**Authors:** [Sourabrata Mukherjee](https://md.research.elamur.ai/free/en/authors/sourabrata-mukherjee/), [Akanksha Bansal](https://md.research.elamur.ai/free/en/authors/akanksha-bansal/), [Atul Kr. Ojha](https://md.research.elamur.ai/free/en/authors/atul-kr-ojha/), [John P. McCrae](https://md.research.elamur.ai/free/en/authors/john-p-mccrae/) and [Ondřej Dušek](https://md.research.elamur.ai/free/en/authors/ondrej-dusek/) · **Year:** 2023 · **Venue:** Proceedings of the 20th International Conference on Natural Language Processing (ICON) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[**0** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W4391801093) · [Proceedings of the 20th International Conference on Natural Language Processing (ICON)](https://aclanthology.org/volumes/2023.icon-1/) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2023.icon-1.13/)
- [PDF](https://aclanthology.org/2023.icon-1.13.pdf)
- [OpenAlex](https://openalex.org/W4391801093)

Citations: OpenAlex, 2026-10-14.

## Summary

An online comment can contain a recognizable argument, complaint, or reaction alongside language that makes it hostile. Text detoxification asks whether a system can rewrite such a comment in a more civil way while retaining what the writer was trying to say. Sourabrata Mukherjee and colleagues study this as a form of text style transfer in [English](https://md.research.elamur.ai/free/en/topics/english/) and Hindi. The challenge goes beyond finding objectionable words. Removing an insult can leave an incomplete sentence, while replacing it with a milder expression can change the criticism or miss hostility conveyed by the sentence as a whole.

The authors curate existing English data by choosing a single civil rewrite for each toxic source. They also commission manual Hindi translations of 500 pairs for evaluation. The Hindi training and development material comes from machine translation. Against a baseline that learns directly from toxic and civil pairs, the paper tests three approaches. One starts by learning to change negative Yelp sentiment into positive sentiment. Another adds toxicity classification during rewrite training and varies where and how that classification is applied. The third uses a classifier to identify words for removal, then generates a rewrite from what remains.

Different methods lead on different measures. In the English test, adapting from Yelp sentiment transfer raises classifier-measured detoxification accuracy from the direct baseline’s 67.4 to 71.0 and raises the [BLEU score](https://md.research.elamur.ai/free/en/concepts/bleu/) for overlap with the input from 43.1 to 45.6. Gradient reversal, which changes how the input classifier’s feedback reaches the encoder, yields 95.6 for English detoxification accuracy alongside much lower input overlap and meaning similarity. In the English expert evaluation, deletion followed by reconstruction receives the highest detoxification rating among the approaches judged, at 3.3, while its fluency rating of 3.9 trails the 4.9 for sentiment-based transfer and the 4.8 for training with an output classifier.

The Hindi results are harder to interpret. The toxicity classifier correctly labels 59.8% of Hindi evaluation items, compared with 91.7% in English, and experts give the Hindi rewrites lower detoxification ratings than the English ones across the systems they assess. The authors observe that machine translation sometimes softens toxic English training inputs, weakening the distinction the Hindi systems are meant to learn. The study shows how extra supervision and targeted editing can improve parts of the rewriting task, and how a favorable toxicity score can obscure loss of meaning, grammatical damage, or disagreements with expert judgment.

## Deep dive: Text Detoxification as Style Transfer in English and Hindi

How the authors rewrote toxic comments in English and Hindi, and what their tests found about civility, meaning preservation, and fluency. · about 31 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What should survive a rewrite?

A detoxification system receives text to edit. Its output must still communicate something the original writer was saying. If the source is a complaint, a civil version should carry the complaint forward. If the source expresses enthusiasm with a profane interjection, the rewrite should give the reader some sense of that enthusiasm. A procedure that always returns a bland, polite sentence could avoid offensive wording without accomplishing either task.

This is why the authors place detoxification within text style transfer. The original and the rewrite belong to different styles, and the pair is useful because some identifiable content passes from one to the other. The paper treats toxic wording as the source style and civil wording as the destination. The distinction is easiest to use when the offending expression can be removed or softened locally. An exclamation may have an ordinary equivalent. A profane aside may be grammatically independent of the rest of the sentence. In those cases, an editor can make a small change and retain most of the writer’s phrasing.

Other comments put more pressure on the distinction. The paper’s Hindi translation discussion points to a wish that another person become gravely ill and die. The sentence can express a hostile wish without relying on a recognizable swear word. Its toxicity lies in the action and outcome it describes. A system that preserves the wish has preserved a central part of the sentence’s meaning. A system that turns it into an ordinary disagreement has changed that meaning. Toxicity and content are therefore partly separable for some inputs, and so closely connected for others that the target requires a substantive editorial choice.

The source comments also lack much of the context that would ordinarily inform such a choice. The authors describe material ranging from politics and religion to personal exchanges, with some items too underspecified to assign to a clear topic. The comments include fragments, misspellings, and grammatical irregularities. An editor can correct a typo and still leave a speech-like fragment intact. Completing the fragment by adding a subject, event, or motive would require information the comment itself may never supply. In this setting, fluency means more than turning every input into a complete formal sentence.

#### How earlier work approached style

The authors situate the problem alongside other kinds of style transfer. One earlier study they cite changes contemporary English into a Shakespearean register. Another line of research uses restaurant reviews to study changes in sentiment. In each case, aligned examples help show which parts of an input can be carried into a new register or stance. In the cases the paper examines, it characterizes the resources as small, containing at most a few thousand examples. A parallel corpus is a collection of corresponding texts. For detoxification, the correspondence is between a toxic original and a civil rewrite of that specific original.

The survey distinguishes two broad ways of coping with limited parallel data. Explicit word or phrase replacement tries to find the expressions that carry the original style and substitute ones that fit the desired style. The authors associate this strategy with [Delete, Retrieve, Generate](https://md.research.elamur.ai/free/en/papers/li-2018-delete-retrieve-generate-simple-approach/), which also supplies the Yelp data used later in their experiments. A different family of methods tries to separate style from content in the internal representations used to produce text. The authors discuss autoencoding, in which a system learns to reconstruct text, and back-translation, in which translation provides an indirect route for learning which aspects of the input can survive a change in form. They cite [Style Transfer from Non-Parallel Text by Cross-Alignment](https://md.research.elamur.ai/free/en/papers/shen-2017-style-transfer-non-parallel-text/) and [Style Transfer Through Back-Translation](https://md.research.elamur.ai/free/en/papers/prabhumoye-2018-style-transfer-through-back-translation/) among this earlier work.

The distinction matters because paired supervision answers a question neither an isolated word list nor a collection of unrelated civil sentences can answer directly. It shows what an editor kept from a particular source. A word list can tell the rewriting procedure where an obvious problem might be. A corpus of civil text can show how civil language generally sounds. A pair gives evidence about whether a specific complaint, point of view, or degree of emphasis survived the edit. The present paper uses such pairs as its main training material while looking to other tasks for additional evidence.

#### Why detection data only go part of the way

By the authors’ account, earlier research had assembled many collections for identifying harmful language. The paper discusses data from social platforms and Wikipedia discussion pages, with some collections covering several forms of offensive or hateful language and others concentrating on categories such as sexism. For instance, the paper cites work on the distinction between [hate speech and offensive language](https://md.research.elamur.ai/free/en/papers/davidson-2017-automated-hate-speech-detection-problem/) and a shared task on [explainable detection of online sexism](https://md.research.elamur.ai/free/en/papers/kirk-2023-semeval-2023-task-10-explainable/). In a detection dataset, the main supervision is a judgment about an existing item. It can indicate that a sentence contains aggression or abuse without offering a civil way to state its point.

The authors identify small English and Russian parallel datasets as exceptions to that pattern. They also describe several baselines from Russian detoxification research. One simply returns the input, which gives a trivial point of comparison. Another removes words and phrases on a toxicity list. A supervised approach adapts a text-to-text system to paired detoxification data, and a separate approach adjusts continuous prompts. These precedents give the authors both a lexical method to compare with and a supervised rewriting approach to adapt. The Hindi evaluation addresses a different part of the resource problem by supplying pairs in a language for which the authors see fewer resources for this kind of rewriting and assessment.

What makes the task difficult, then, is the combination of limited examples and a demanding definition of success. Detection can supply evidence about objectionable language. A rewriting system also needs to decide how much of the input to retain, what to put in place of removed material, and whether the result reads naturally for the intended language. The paper makes those decisions visible through the construction of its data and the different kinds of instruction used during training.

### The method, step by step

#### From several rewrites to a single training target

The English material starts with toxic user comments and several civil paraphrases for many of them. The authors report 2,778 sentence entries in the original data and 1,108 distinct toxic sources, with 1-5 paraphrases available for each source. Experts select the most suitable alternative when several are available. That changes how the data are used. Each toxic source now has a definite target for training, even where the original collection illustrates more than one acceptable edit. The authors use the resulting pairs for their English experiments and as the basis for the Hindi material.

The paper describes two recurring editing operations. The first is substitution. An editor looks for an expression that conveys the function of the original wording, such as surprise, disbelief, or strong approval, in a more civil form. This sometimes calls for changing a phrase as a unit. Replacing an isolated word with a dictionary synonym can miss the way it functions in context. The other operation is to cut a dispensable part. An opening expletive that precedes a tentative claim can frequently be removed while the claim and its uncertainty survive. Whether that edit works depends on the removed phrase’s role in the sentence.

The authors also address irregularities in the inherited data. Actual quantities had already been replaced with placeholders such as `DIGIT` or `number`. They retain the placeholders because the values behind them are unavailable. In an item about whether a quantity of bricks would fit in a car, for example, the rewrite can preserve the reference to an unspecified quantity, but the editors have no basis for restoring an exact value. The authors encounter some civil targets in languages other than English and supply suitable English replacements. Their description also distinguishes straightforward spelling cleanup from changing the fragmented, speech-like character of the original comments.

For Hindi, the authors randomly select 500 pairs and have them translated manually. The translators aim to retain content while using natural Hindi. They translate both the toxic and civil sides, allowing corresponding examples to be examined in each language. What counts as an effective change depends on how the contrast can be expressed in Hindi. Where appropriate, the authors use the informal or potentially disrespectful pronoun तू, transliterated as *tu*, in the toxic version and the respectful आप, *aap*, in the civil version. Here the social relationship conveyed by a pronoun helps mark a stylistic shift even if much of the rest of the comment stays similar.

Sometimes translation removes a contrast. The authors describe an English distinction between an ordinary negative adjective and a profanely intensified form that can be rendered with the same Hindi adjective. Once the versions converge in translation, an editor working from the Hindi source has little of that particular contrast to change. Conversely, translation can give the civil version access to a politeness distinction that the English pair leaves to tone or vocabulary. Parallel examples make it possible to inspect cases like these side by side. They need not present the same editing problem in each language.

The manually translated Hindi pairs serve as the test material. The authors construct separate Hindi training and development material by translating the corresponding English splits with NLLB-200-3.3B. This use of [machine translation](https://md.research.elamur.ai/free/en/topics/machine-translation/) makes the training setup feasible without requiring manual translation across all splits. It also introduces an important distinction between the kinds of Hindi the systems learn from and the kinds they encounter at test time. The authors release their experimental code and the multilingual detoxification datasets in the repositories named in the paper.

#### Learn the direct rewrite first

The shared starting point is mBART-large-50, which the authors use for English and Hindi. Its pretraining belongs to the line of [multilingual denoising research](https://md.research.elamur.ai/free/en/papers/liu-2020-multilingual-denoising-pre-training-neural/) the paper cites. In the direct sequence-to-sequence baseline, abbreviated `seq2seq`, the input sequence is a toxic comment and the target sequence is its curated civil rewrite. An encoder reads the input and represents it internally. A decoder uses that representation to produce the output. During [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/), the paired data provide examples of the specific changes the pretrained system is being asked to learn.

The paper calls the following expression the sequence-to-sequence cross-entropy loss.

```
L_seq2seq = −∑_{t=1}^{T} ∑_{k=1}^{K} log(P(y_{t,k} | X))
```

Here `L_seq2seq` is the loss for the rewriting task, and `X` is the input text. The outer `∑` adds terms across output positions, indexed by `t`, with `T` the sequence length. The inner `∑` runs over the vocabulary, with `k` indexing a token and `K` giving the vocabulary size. The lower bounds `t=1` and `k=1` mark the starting indices. The notation `y_{t,k}` identifies the token indexed by `k` at position `t`, and `P(y_{t,k} | X)` denotes the predicted probability for that token given `X`. The vertical bar indicates conditioning, `log` takes the logarithm, and the leading minus sign negates the sum.

There is a distinction between the intended training objective and the literal expression. The authors describe supervised cross-entropy against the civil sequence, which would give the reference token at each position the relevant weight. The displayed sum runs over the vocabulary without showing a target indicator or target distribution. As written, it therefore does not specify how the correct token is selected in the loss. The prose gives the role of the paired target in training, while the formula leaves that part of the computation implicit.

The baseline gives the subsequent experiments a common comparison. The authors can add a stage before detoxification training, add an auxiliary task while training, or change the text supplied to the encoder. In each case, the baseline represents what a system trained directly on the available pairs can do.

#### Start from sentiment transfer

The knowledge-transfer variant, `kt`, changes the order of training. Before training on detoxification, the authors use the Yelp data to adapt the system to changing negative sentiment into positive sentiment. They then use the resulting weights as the starting point for further training on toxic-to-civil pairs. The second stage follows the direct rewriting setup. The transfer comes through the parameters learned during the earlier task.

The rationale is that sentiment editing and detoxification both involve changing some expressions while retaining surrounding information. A system trained on reviews has already encountered a task in which preserving material from the input can matter even as some of the wording must change. The paper tests whether that experience helps when the desired change is civility. The detoxification pairs teach the new target style. A civil complaint can remain negative, so the first task supplies a potentially useful editing capability while the second determines what that capability is used for.

#### Add a classifier during training

The multitask variants train the rewriting system alongside a binary [text classification](https://md.research.elamur.ai/free/en/concepts/text-classification/) task. A classifier produces an estimate for a label, here concerning whether text is toxic or civil. The authors place this extra task in different positions. The rewrite still has a paired civil target in each setting. The extra supervision changes what the system is also asked to learn from the data.

In the input-classification variant, `cls_ip`, a classification head attached to the encoder predicts the input’s label. A head is the part of the system that turns an internal representation into a prediction for a particular task. Since the encoder serves the rewrite and the classification head, the auxiliary loss encourages the encoder’s representation to contain features that help distinguish toxic text from civil text. The paper writes the loss as follows.

```
L_cls_ip = −∑_{i=1}^{N} [t_i log(P_cls_ip(x_i)) + (1 − t_i) log(1 − P_cls_ip(x_i))]
```

`L_cls_ip` is the input-classification loss. The `∑` sums over `N` training items, with `i` starting at `1`. The input for item `i` is `x_i`, and `t_i` is its binary label, which the authors give as `0` for toxic and `1` for civil. `P_cls_ip(x_i)` is the head’s probability for the positive class in the displayed expression, and `1 − P_cls_ip(x_i)` is the probability of the other class. The factors `t_i` and `1 − t_i` select the relevant probability, `log` takes its logarithm, and the minus sign makes the selected log probability a loss. The accompanying prose calls the predicted value a probability of toxicity, although the equation and the stated label encoding put the direct probability term on the civil class. That leaves the name of the probability inconsistent with its mathematical role.

The gradient-reversal variant, `cls_gr_ip`, inserts a layer before the input classifier. A gradient is the signal used to determine how changing parameters affects an objective. With an ordinary input classifier, the classification signal reaching the encoder encourages representations that make the label easier to predict. Here the authors reverse and scale that signal on its path to the encoder. The classifier still has a labeling objective, while the encoder is pushed away from representations that help the classifier identify the original style. The authors expect this to help the encoder retain information shared by toxic and civil sentences with similar meaning.

```
Grad_rev = −λ · ∇J
```

`Grad_rev` is the gradient sent back through the reversal layer. The expression `∇J` denotes the incoming gradient of the objective `J` along this branch, and `∇` is the gradient operator. The factor `λ` controls the scale of the signal, the minus sign reverses its direction, and `·` denotes multiplication. The operation concerns learning in the encoder. It does not itself delete toxic words from the input or instruct the decoder to replace particular phrases.

The classification objective still has the same binary form.

```
L_cls_gr_ip = −∑_{i=1}^{N} [t_i log(P_cls_gr_ip(x_i)) + (1 − t_i) log(1 − P_cls_gr_ip(x_i))]
```

`L_cls_gr_ip` is the loss for input classification with gradient reversal. The `∑` adds terms for the `N` training items, indexed by `i` from the lower bound `1`. The symbols `x_i` and `t_i` again denote the input and its binary label. `P_cls_gr_ip(x_i)` is the classifier’s probability on the branch that includes reversal. In the equation it is weighted by `t_i`, while its complement `1 − P_cls_gr_ip(x_i)` is weighted by `1 − t_i`. The logarithm is `log`, and the minus sign converts the log likelihood into a loss. The change relative to ordinary input classification lies in the feedback reaching the encoder, even though the equation for scoring the classifier keeps the same form.

The output-classification variant, `cls_op`, moves the auxiliary task to the decoder side. It asks for a toxicity judgment concerning the generated text. For the rewriting task, this gives training a signal about the status of the output in addition to the signal from matching the reference. The input may retain clues about what needs to be changed, and the output is where the extra classification objective checks the result. The paper defines the following loss.

```
L_cls_op = −∑_{i=1}^{N} [d_i log(P_cls_op(y_i)) + (1 − d_i) log(1 − P_cls_op(y_i))]
```

`L_cls_op` is the output-classification loss. The `∑` runs over `N` items, with `i` beginning at `1`. Here `y_i` denotes the generated text for item `i`, while `d_i` gives its target binary label. The stated coding is `0` for toxic and `1` for civil. `P_cls_op(y_i)` is the predicted probability that the output is civil, and `1 − P_cls_op(y_i)` is the probability assigned to the other class. The weights `d_i` and `1 − d_i` determine which probability is scored, `log` denotes the logarithm, and the leading minus sign gives the loss. The paper presents the auxiliary losses alongside the sequence loss without specifying the weights used to combine them.

#### Remove likely sources of toxicity and rebuild the sentence

Delete and reconstruct, `del_recon`, uses a classifier to decide what reaches the generator. The authors train the classifier to distinguish toxic sentences, labeled `1` in this part of the paper, from civil sentences, labeled `0`. They use it to assign attributions to words. An attribution is a score for a word’s contribution to the classification, so the procedure can identify material associated with the classifier’s toxicity decision in a particular input. The paper describes scoring toxic and civil examples and removing words with attributions above `0.5`.

Delete and reconstruct for text detoxification The steps in order.

The shortened text is the source for mBART during reconstruction training. The corresponding civil sentence from the dataset supplies the target. The remaining text can contain grammatical gaps, and the generator has an opportunity to repair them or choose a replacement. Compared with a dictionary, the classifier makes the deletion decision using the sentence it sees. Compared with plain deletion, the method adds a learned rewriting stage. The generator still depends on what the deletion step leaves available. If a word expresses both hostility and an important part of the complaint, removing it can make faithful reconstruction harder.

The paper gives a separate expression for reconstruction.

```
L_reconstruction = ∑_{i=1}^{N} [y_i log(P_reconstruction(x_i)) + (1 − y_i) log(1 − P_reconstruction(x_i))]
```

`L_reconstruction` is the quantity called reconstruction loss. The `∑` runs over the `N` training items, indexed by `i` from `1`. Here `x_i` is the input after deletion and `y_i` is the original civil target for that item. `P_reconstruction(x_i)` is described as the predicted probability of the reconstructed sentence, and `log` is the logarithm. The displayed `1 − P_reconstruction(x_i)` is the complement of that probability. The expression also uses `1 − y_i`, although the paper defines `y_i` here as a sentence rather than a binary value. There is no leading minus sign. The formula resembles a binary log-likelihood expression and leaves the token-level reconstruction objective underspecified. The method description is clear about the training pairs themselves: a shortened input is paired with the full civil text.

The setup uses the same stated optimization settings for the English and Hindi experiments. The selected learning rate is `1e-5`, which controls the size of parameter updates, and the batch size is `3`, the number of examples grouped for an update. The authors report dropout of `0.1` across the network and L2 regularization of `0.01`. Dropout temporarily suppresses parts of the network during training, while L2 regularization penalizes large parameter values. Training runs for `5` epochs, meaning passes through the training data.

### Experiments and results

#### The test design and the comparison systems

The curated English data are divided into 508 training examples, 100 development examples, and 500 test examples. Hindi follows the same split sizes. The authors translate the 508 training and 100 development examples by machine and evaluate on 500 manually translated pairs. Using the same sizes makes the amount of paired supervision comparable. The production of the text differs by language and split, which matters when interpreting a difference in scores.

The direct mBART rewrite is the internal baseline. The authors also adapt two systems from earlier Russian detoxification work. For the supervised baseline called `T5`, they use `t5-base` for English and `mt5-small` for Hindi, drawing on [T5](https://md.research.elamur.ai/free/en/papers/raffel-2019-exploring-limits-transfer-learning-unified/) and [mT5](https://md.research.elamur.ai/free/en/papers/xue-2021-mt5-massively-multilingual-pre-trained/), respectively. This comparison uses an alternative text-to-text architecture applied to each language. The baseline called `Delete` takes a dictionary of toxic words and phrases. The authors translate it from Russian to English and then from English to Hindi before using it to remove matches. This compares learned reconstruction with a simple lexical intervention, though the two approaches also differ in how they choose words for removal.

#### What the measurements capture

Automatic detoxification accuracy, abbreviated ACC, comes from a fine-tuned mBERT toxicity classifier. For a rewrite, the desired classifier decision is civil. The classifier itself is evaluated on its ability to distinguish toxic from civil text, where it scores 91.7% in English and 59.8% in Hindi. Those percentages describe how well the evaluator classifies labeled text. In the results for rewriting, the ACC values describe judgments the evaluator makes about generated outputs. The distinction matters because the credibility of the second measurement depends in part on the first.

The paper measures content against the input sentence. BLEU counts overlapping word sequences, so it rewards some kinds of preservation in wording. Content similarity, abbreviated CS, compares sentence representations with cosine similarity, which measures how closely two vectors point in the same direction. The sentence representations come from LaBSE, the system described in [Language-agnostic BERT Sentence Embedding](https://md.research.elamur.ai/free/en/papers/feng-2020-language-agnostic-bert-sentence-embedding/). These are complementary ways to estimate [semantic similarity](https://md.research.elamur.ai/free/en/concepts/semantic-similarity/) and its lexical counterpart. A good paraphrase may lose word overlap while keeping the main idea. A lightly edited sentence may retain nearly every word while leaving an insult intact or altering the effect of a crucial phrase.

For fluency, the authors use perplexity, abbreviated PPL, measured with [mGPT](https://md.research.elamur.ai/free/en/papers/shliazhko-2022-mgpt-few-shot-learners-go/). Lower perplexity means that the text is more predictable to this evaluator. Predictability is an imperfect indicator of natural writing, since common words and familiar constructions can score well even in an awkward output. The paper also conducts a separate human assessment. Language experts rate detoxification, preserved content, and fluency on a 5-point Likert scale, an ordered scale of judgments, for a random sample of 50 test sentences per language.

#### Automatic results in English

Classifier-measured detoxification accuracy on the English test set Gradient reversal leads on classifier judgments of civility, with delete and reconstruct also ahead of the direct baseline.

**The numbers**

| System or setting | ACC |
| --- | --- |
| Direct sequence-to-sequence | 67.4 |
| Knowledge transfer | 71.0 |
| Input classification | 64.0 |
| Input classification with gradient reversal (this paper) | 95.6 |
| Output classification | 75.8 |
| Delete and reconstruct | 80.6 |
| Delete | 68.6 |
| T5 | 59.2 |

Knowledge transfer improves on the direct English baseline in classifier-measured civility and on both measures of retained content. English test BLEU rises from 43.1 to 45.6, and CS rises from 76.8 to 77.5. The perplexity scores are 221.4 for the baseline and 237.9 for knowledge transfer. The evidence for transfer is therefore strongest on civility and content. Its English perplexity score offers no corresponding gain over direct training.

Output classification produces an English test BLEU of 44.2 and CS of 76.6, with perplexity of 348.3. It obtains a higher ACC than knowledge transfer while the automatic measures of preserved content favor knowledge transfer. Ordinary input classification, in turn, gives 43.7 BLEU, 75.6 CS, and 202.4 perplexity. Its ACC of 64.0 leaves it below the direct baseline on automatic civility in spite of a more favorable perplexity score. Adding classification to training has different consequences depending on the kind of feedback it gives the rewriting system.

Gradient reversal produces an especially sharp divide. Its English test BLEU is 0.2 and CS is 16.3, far below the other English results on those measures, even though it leads on ACC. The English perplexity score is 20.4. That is favorable if interpreted strictly as predictability, but the accompanying content scores give little support to the idea that the output remains a faithful rewrite. The paper describes a cost to fluency and content for this configuration. The automated row establishes a clear content cost, while the fluency interpretation is less direct because the perplexity proxy points in a favorable direction and experts did not rate this variant.

Delete and reconstruct obtains 44.5 BLEU and 76.9 CS in English. Its classifier-measured detoxification accuracy improves on that of direct rewriting, and its two content measures stay close to or above the direct baseline’s. Its perplexity of 304.6 is higher than the direct baseline’s 221.4. The dictionary `Delete` baseline, for comparison, obtains 41.0 BLEU, 74.4 CS, and 599.7 perplexity. The English `T5` baseline produces 44.7 BLEU, 77.1 CS, and 221.6 perplexity, alongside its lower ACC. The comparison with `T5` is a useful reminder that a baseline can preserve surface text and sentence similarity without consistently making the stylistic change the task calls for.

#### Automatic results in Hindi

Content similarity to the input on the Hindi test set Delete and reconstruct leads on content similarity, while the highest classifier accuracy comes from a baseline with much lower similarity.

**The numbers**

| System or setting | CS |
| --- | --- |
| Direct sequence-to-sequence | 77.2 |
| Knowledge transfer | 78.6 |
| Input classification | 76.8 |
| Input classification with gradient reversal | 72.6 |
| Output classification | 78.2 |
| Delete and reconstruct (this paper) | 78.9 |
| Delete | 76.8 |
| T5 | 38.7 |

Knowledge transfer raises Hindi classifier ACC from 68.4 for direct rewriting to 92.0, with BLEU moving from 39.6 to 42.0. Its Hindi test perplexity is 9.3, compared with 8.5 for the direct baseline. Delete and reconstruct returns 94.0 ACC, 41.2 BLEU, and 8.2 perplexity. These two variants each improve on the baseline’s automatic content scores. Which one looks stronger depends on whether the comparison emphasizes word overlap, sentence similarity, classifier judgments, or predictability.

The Hindi multitask results follow a different ordering from the most striking English result. Output classification has an ACC of 79.8, above ordinary input classification at 77.2 and gradient reversal at 75.2. It also has the strongest BLEU among the Hindi multitask variants, at 39.8, compared with 38.5 for input classification and 36.2 for gradient reversal. The two weaker multitask results on BLEU also have weaker content similarity. Hindi test perplexity is 8.3 for input classification and 8.2 for both gradient reversal and output classification. On the Hindi test metrics shown, output classification gives the strongest overall case among these multitask choices.

The external `T5` baseline receives the highest Hindi classifier ACC, 99.6, with Hindi BLEU of 1.2, CS of 38.7, and perplexity of 64.7. At that level of mismatch, the ACC result by itself establishes very little about successful rewriting. The Hindi dictionary baseline shows a less extreme pattern, with ACC of 92.8, BLEU of 40.4, CS of 76.8, and perplexity of 11.4. It retains appreciable overlap and receives favorable classifier judgments, which makes the subsequent expert assessment particularly relevant. Given the evaluator’s Hindi classification accuracy, the high ACC values for either baseline warrant a narrower reading than their size alone would suggest.

#### What the experts rated

The human evaluation covers knowledge transfer, output classification, delete and reconstruct, and the dictionary `Delete` baseline. The authors choose these systems using their automatic results, selecting output classification as the multitask representative. The expert comparison therefore speaks directly to these configurations. The direct sequence-to-sequence baseline, input classification, gradient reversal, and `T5` are outside that comparison.

Expert-rated fluency in the English test sample Knowledge transfer receives the strongest fluency rating, with output classification close behind.

**The numbers**

| System or setting | Likert rating |
| --- | --- |
| Knowledge transfer (this paper) | 4.9 |
| Output classification | 4.8 |
| Delete and reconstruct | 3.9 |
| Delete | 3.0 |

In English, expert ratings for detoxification are 3.0 for knowledge transfer, 3.2 for output classification, 3.3 for delete and reconstruct, and 2.6 for dictionary deletion. English content ratings are 4.9 for knowledge transfer, 4.9 for output classification, 4.7 for delete and reconstruct, and 4.9 for dictionary deletion. An evaluator can recognize much of the original content after a dictionary simply removes several words, even if the remaining sentence reads poorly. That is consistent with `Delete` receiving the weakest English fluency rating in the expert comparison.

In Hindi, expert detoxification ratings are 1.9 for knowledge transfer, 2.0 for output classification, 2.0 for delete and reconstruct, and 1.9 for dictionary deletion. Content scores are 4.8 for knowledge transfer and 4.9 for each of the other three systems. Fluency ratings are 4.8 for knowledge transfer, 4.5 for output classification, 4.7 for delete and reconstruct, and 3.9 for dictionary deletion. The low detoxification judgments coexist with favorable content ratings. On this sample, producing something that resembles the source and reads naturally in Hindi leaves substantial room to improve the civil rewrite itself.

The authors describe the human and automatic evaluations as mostly aligned. The broad English pattern supports that reading in several places. Delete and reconstruct leads among the judged systems on expert detoxification and also has the strongest English classifier result of that group. Its English fluency judgment is weaker than those for knowledge transfer and output classification. Exact rankings are less stable. English perplexity favors reconstruction over output classification, while experts prefer the fluency of output classification. In Hindi, the automatic classifier assigns higher ACC to dictionary deletion than to output classification, while experts give output classification the higher detoxification rating. The two kinds of evidence tell a more informative story when their agreements and disagreements are both visible.

### What the ablations show

The paper reports controlled comparisons among the training variants and gives examples of their outputs. It does not report a component-by-component ablation of every proposed approach. The best-supported contrasts concern changes to the paired training recipe, the position and direction of auxiliary classification feedback, and the behavior of the completed deletion pipelines. Those contrasts can show that a particular configuration succeeds under some measurements and fails under others. Their ability to establish an internal mechanism varies with how much else changes in the comparison.

#### Extra sentiment training helps on the measures it is closest to

The direct baseline and the knowledge-transfer variant share the final task and use the same kind of toxic-to-civil supervision. The difference the experiment introduces is an earlier stage of adapting to sentiment transfer. Both languages show gains in classifier-measured civility and in the measures of content relative to direct rewriting. This is consistent with the authors’ rationale that prior experience changing a style while retaining parts of the input can be reused when detoxification data are limited.

There is still a choice about how far to carry that explanation. The study compares the full preceding Yelp stage with direct training. It does not test an equally long preceding stage on unrelated data. The result shows that this kind of additional training helped under the paper’s conditions. It does not separately estimate the value of the task’s similarity, the extra data, or the extra optimization. The English expert ratings add evidence about how the resulting rewrites read, but the direct baseline was not rated by those experts. The human comparison therefore cannot isolate the gain from starting with sentiment transfer.

The sample outputs illustrate why transferred editing behavior could matter. In a comment saying that the writer’s own example is also in bad shape, the knowledge-transfer system preserves the idea of a shared problem and attempts to substitute a milder expression for the profanity. The particular choice leaves the English result somewhat awkward. The output-classification variant makes that same complaint with a straightforward descriptor, while deletion can strand a particle from the original expression. The examples show several plausible ways of editing the same source and why a method that learns replacements still sometimes needs to choose better ones.

#### The direction of classification feedback changes the result

Input classification and input classification with gradient reversal form the most direct contrast among the multitask variants. Both ask an auxiliary head to classify what the encoder has read. In one, the encoder is helped to represent information that makes classification easier. In the other, the style classification feedback reaches the encoder with its direction reversed. The authors give this reversal a content-preservation motivation. If the encoder becomes less sensitive to differences in toxicity, they expect it to represent the shared material in toxic and civil versions more similarly.

The English result separates this motivation from what the test actually confirms. Gradient reversal yields the strongest automatic civility score and drastically weaker content similarity and word overlap. It is possible for a rewrite to stop resembling the input and nevertheless be judged civil. The experiment shows that the reversed-feedback configuration reaches such a tradeoff on the reported English metrics. It supplies no direct test that the encoder’s representations retained the underlying content or that toxic and civil paraphrases became aligned as intended.

The Hindi comparison also tempers a general claim about reversal. Hindi gradient reversal has lower classifier ACC and lower content scores than ordinary input classification. The striking English ACC behavior therefore does not reproduce as a corresponding advantage on the Hindi test. Output classification is more consistent across the paper’s measured dimensions. It raises automatic civility over direct rewriting in both languages while keeping the automatic content scores closer to the baseline. The experiment supports this particular placement of additional supervision as a more balanced choice in the study. It leaves open whether the same ordering would hold with different data or evaluators.

The output samples show what balance can cost on an individual edit. In an English example where the writer calls another person an autocratic bully, the output-classification variant turns the description into vague disapproval. It reads like ordinary language and avoids the original personal characterization, but a reader learns very little about the kind of behavior the writer objected to. Other variants retain some part of the characterization while changing another part. Automatic civility, sentence similarity, and expert content judgments can each respond differently to this kind of edit, especially when what counts as content is itself open to disagreement.

#### A generator can repair deletion, but it can inherit the gap

The comparison of `Delete` with delete and reconstruct addresses a central practical weakness of lexical removal. Deleting the head of a phrase can leave its modifier in place. Deleting one word in an idiomatic expression can strand a remaining word whose purpose depended on the original combination. Reconstruction adds a chance to restore the missing syntactic role or to express the idea differently using what survives. The English human fluency scores favor reconstruction over dictionary deletion, and the Hindi ratings give the same ordering.

This comparison changes both the way words are selected and what happens after selection. The external baseline uses a translated dictionary, while the paper’s reconstruction method uses classifier attribution. A cleaner output could come from removing a better-chosen word, from the generator’s repair, or from both. A trial that held the deletion operation fixed and switched reconstruction on and off would be needed to separate those effects. The reported results compare complete alternatives.

Some examples show where the repair does not happen. One English item uses a coarse expression telling NATO to go away. The dictionary output leaves a fragment ending in the second part of that expression, and delete and reconstruct leaves a similarly incomplete phrase. Knowledge transfer and output classification replace the construction, though their choice conveys stopping rather than departure. This illustrates two distinct failure modes. A sentence can break because it lost part of a construction, or it can become grammatical while altering the action described.

The English example involving an exclamation of surprise shows a more favorable case for removing material. The expletive is relatively separable from the observation that follows. Reconstruction can drop it and preserve the reaction and event conveyed by the remaining words. Knowledge transfer leaves the offensive exclamation in the paper’s example. Output classification chooses a conventional exclamation that keeps a reaction in the sentence, though its wording can suggest a different emotional shade. The examples explain how each method might succeed or fail at the level of a phrase. They do not give the frequency of those failures across the test set.

#### Translation can change the edit a system needs to make

The paired examples also show why the Hindi results are more than another column for the same task. In examples where a Hindi input already uses an idiom with few obvious signals for a word-based system to act on, outputs can stay close to the source while missing the intended change in tone. The sample translations also include personal address, where a change to a respectful pronoun can help mark the civil register. A pronoun substitution by itself can leave the rest of an insult intact. Conversely, removing a profane phrase while retaining a markedly disrespectful form of address may only partially carry out the chosen rewrite.

The study does not experimentally remove politeness distinctions or test alternative translation policies. These examples are a qualitative analysis of what the data ask of the system. They help explain how excellent overlap with a Hindi source can coexist with weak detoxification ratings. They also show why measuring the success of translation and measuring the success of the subsequent edit address different questions.

### Limitations

#### Limits acknowledged by the authors

The authors emphasize that detoxification can work differently across languages, kinds of toxicity, and cultural contexts. Their examples give this point substance. Some hostility is closely tied to an explicit word, some to the action described, and some to a choice of address or register. The experiments cover English social comments and Hindi translations of aligned examples. The authors present broader linguistic and cultural coverage as a subject for future research.

They also identify a measurement problem for Hindi. The toxicity evaluator is trained and developed on machine-translated text, then tested on manually translated text. The authors suggest this mismatch as a reason for its 59.8% classification accuracy. They also observe that machine translation softens some source comments enough to reduce or erase their toxicity. If such an input keeps the label inherited from English, the feature the label is meant to identify may have changed during translation. This affects how clearly the training material separates toxic and civil Hindi and makes the source of Hindi classifier errors difficult to pin down.

Fluency assessment is another stated limitation. The authors describe a shortage of suitable assessment tools for Indic languages and explicitly recognize that perplexity can favor frequent, predictable language even when a sentence reads unnaturally. The expert exercise addresses part of this problem by having readers judge the output directly. It remains a small evaluation of selected configurations. The strongest evidence for fluency comes from considering the expert scores and sample rewrites alongside the automatic measure.

#### Limits of the evidence

The paired collection selects one civil rewrite for each toxic comment. That gives the training procedure a concrete target, while leaving the range of defensible rewrites unexplored. One editor might keep a specific criticism and remove an accompanying insult. Another might express the criticism as a personal opinion or turn hostility into disagreement. When a single chosen target shifts the speech act, a generated sentence can preserve the source’s content in a different way and still look unlike that target. The automatic content measures used here compare against the source, which helps track retention, but neither word overlap nor sentence similarity can establish which original claim or implication a rewrite preserved.

The source data also include isolated utterances and fragments. A system can change an apparent insult without knowing what it refers to or why the writer chose it. Conversely, an apparently civil sentence can read differently in a thread where it is directed at a particular person. The study evaluates rewrites of individual examples. It does not measure how they would be understood in a conversation, whether writers would accept them as faithful to their intent, or whether publishing a rewrite would improve an actual exchange. These are beyond the evidence supplied by held-out sentences and language-expert ratings.

The Hindi design leaves several influences intertwined. The systems train on translated data whose toxicity contrast can weaken and are tested on separately translated data whose style can be marked in specifically Hindi ways. The aligned content helps make the language comparison intelligible, but the paper does not give a controlled Hindi comparison between manually created and machine-translated training pairs. It also does not evaluate on an independent set of comments originally authored in Hindi. The gap in the reported expert detoxification ratings therefore cannot be assigned wholly to properties of the language, the quality of the training translation, the strength of the rewriting procedure, or the quality of the evaluator.

The expert ratings provide a check on the automatic metrics for the tested subset. The reported means do not establish how large the variation was across individual examples or how consistently experts agreed, and the study does not report uncertainty estimates for those comparisons. Small differences between averaged ratings should be read as the ordering observed on the sample. The missing expert assessments for gradient reversal and for Hindi `T5` also matter. Both show large discrepancies between classifier ACC and content scores. Human review of those outputs could establish more about the character of those failures than a low similarity or overlap score can do on its own.

Finally, the architecture descriptions are more precise about the intended flows of data than about every aspect of implementation. The sequence loss omits an explicit target weight, the input loss has a mismatch between label coding and its description of the predicted probability, and the reconstruction expression treats a sentence target like a binary variable. The paper also describes a fixed attribution threshold without comparing alternative thresholds. These issues limit what can be inferred about exact objective implementation or about which deletion choices are responsible for the observed gains. The empirical comparison remains a comparison among the reported configurations on these datasets.

### What came after

Agbeyangi and colleagues cite the study in their 2026 work on [text detoxification in isiXhosa and Yorùbá](https://md.research.elamur.ai/free/en/papers/agbeyangi-2026-text-detoxification-isixhosa-yor-ub/). Their work takes a cross-lingual machine learning approach to detoxification in low-resource African languages. It extends the research question to another pair of languages, where the task likewise calls for a civil rewrite and where language-specific resources are central to how that rewrite can be learned and evaluated. The citation establishes a connection to this line of cross-lingual detoxification research. The later work’s stated scope does not establish whether it reused the English–Hindi pairs, the sentiment-transfer stage, or any of the particular classification and reconstruction configurations.

## Cite

Cite as Sourabrata Mukherjee, Akanksha Bansal, Atul Kr. Ojha, John P. McCrae and Ondřej Dušek. 2023. Text Detoxification as Style Transfer in English and Hindi. Proceedings of the 20th International Conference on Natural Language Processing (ICON).

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{mukherjee2023text,
  title = {{Text Detoxification as Style Transfer in English and Hindi}},
  author = {Sourabrata Mukherjee, Akanksha Bansal, Atul Kr. Ojha, John P. McCrae and Ondřej Dušek},
  booktitle = {Proceedings of the 20th International Conference on Natural Language Processing (ICON)},
  year = {2023},
  url = {https://aclanthology.org/2023.icon-1.13/}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
