# Poster 28932

- Kind: Poster
- Talk page and recording: https://iclr.cc/virtual/2025/poster/28932

> Transcript of the talk's recording (session_asr), made by speech recognition or taken from the host's captions. It may contain errors. The words are the speakers'; listen to the recording on the talk's page before quoting it.

Hello everyone, my name is Hui Ming Lu and I feel very happy today to share our recent research work titled Unit Talks Universal Detoxification of Large Language Models via Dataset Distillation.
I'd like to begin with a little bit of background. So what is dataset distillation? In simple terms, it's a technique for synthesizing a compact set of data that captures the key representations of a much larger original dataset. It's often used for dataset compression or say dataset condensation. Previous studies typically distill data by aligning the distilled datasets gradients
with those of the original data as closely as possible. So that led us to an interesting question. What if we reverse this idea of dataset distillation? What if we try to generate data that pushes the model's parameters in the opposite direction?
Could this allow us to generate data that makes a model forget key representations from toxic data by reverse distilling toxic data? Can we apply this idea to detoxify large language models? This question led to the central idea behind our work.
However, applying dataset distillation to LLMs poses significant challenges. Previous studies treat the dataset X as a continuous parameter and optimize it using gradient descent.
That being said, the previous approach doesn't work for discrete data like plain textual data. Furthermore, the distilled data cannot transfer across different models with different architectures. Also, gradient descent requires second-order derivatives, which is prohibitively expensive for large-scale models and corpus.
So here comes the main contribution of this work. To tackle the aforementioned issues, we propose a more efficient and scalable approach to dataset distillation and then use it to reverse distill toxic data for LLM detoxification. Specifically, we propose a method called reverse dataset distillation via contrastive decoding.
So step one is to obtain a toxic model by training the base model on toxic datasets. Interpreting this process in parameter space, it can be seen as moving the model in the direction of toxicity, tau toxic.
And in the step two, we calculate the difference in lock probabilities for generations predicted by the base and toxic models via contrastive decoding. This way, we penalize these toxic generations and instead sample from safer tokens. Finally, we use the safe text generated in step two to fine-tune the base model, producing a detoxified model.
So why is this process a reverse of dataset distillation and why can this be used for toxification? Mathematically, if we use the first -order Taylor approximation, we can express contrastive decoding as a dot product between theta base minus theta toxic and the gradient of the base model.
If we take a further look at this, the first item is nothing but the opposite direction of toxicity and the second item is a model parameter updates
So that being said, by applying contrastive decoding, we prioritize sampling text data whose gradients align more with the opposite direction of toxicity. Therefore, fine-tuning with such data that is reverse distilled from toxic data exerts a detoxifying influence on the model.
For the sake of time, let's go directly to the experimental results. This figure shows the results of detoxifying GPT-2 with texts distilled from itself. The three figures from left to right show the model's probability to generate toxic output, the model's fluency measured by perplexity, and its downstream task performance measured by question answering accuracy.
The six pillars show the results of the model before detoxification. The model detoxified by baseline methods and the model detoxified by our methods. As can be seen here, our method significantly lowers toxicity while maintaining low perplexity and high accuracy.
Next, we show the detoxification results of detoxifying OPT with text distilled from GPT-2. We will only present the results of OPT here, but we gain similar results for more models, which can be checked at our paper.
Again, our method still outperforms all baselines, even though the text was distilled from GPT-2. That being said, text distilled from GPT-2 does not overfit to that very model, which demonstrates generalizability of our method for different models. Thank you very much for your attention and time. Please check out our paper at OpenReview, and if you have any questions or comments, feel free to reach out to me on Twitter. Thank you.
