Paper Reading AI Learner

Test-Time Detoxification without Training or Learning Anything

2026-01-14 11:54:23
Baturay Saglam, Dionysis Kalogerias

Abstract

Large language models can produce toxic or inappropriate text even for benign inputs, creating risks when deployed at scale. Detoxification is therefore important for safety and user trust, particularly when we want to reduce harmful content without sacrificing the model's generation quality. Many existing approaches rely on model retraining, gradients, or learned auxiliary components, which can be costly and may not transfer across model families or to truly black-box settings. We introduce a test-time procedure that approximates the gradient of completion toxicity with respect to the input embeddings and uses a small number of descent steps to steer generation toward less toxic continuations. This is achieved with zeroth-order optimization that requires only access to input embeddings, a toxicity scoring function, and forward evaluations of the model. Empirically, the approach delivers robust toxicity reductions across models and prompts and, in most settings, achieves the best overall toxicity-quality trade-off. More broadly, our work positions word embeddings as effective control variables and encourages wider use of black-box optimization to guide autoregressive language models toward scalable, safer text generation, without requiring any training or access to intermediate computations.

Abstract (translated)

大型语言模型即使在接收良性输入时,也可能生成有毒或不适当的内容,在大规模部署时会带来风险。因此,为了确保安全性和用户信任,去毒化工作尤为重要,尤其是在减少有害内容的同时又不牺牲模型的生成质量的情况下。现有的许多方法依赖于重新训练、梯度计算或学习辅助组件,这些方法成本较高,并且可能无法跨不同模型家族迁移或应用于真正意义上的黑盒设置中。 我们介绍了一种在测试时进行的过程,该过程通过输入嵌入(input embeddings)来近似完成任务的毒性相对于输入变化的梯度,并使用少量下降步骤将生成引导到更少毒害性的延续。这一方法是基于零阶优化实现的,仅需访问输入嵌入、一个有毒性评分函数和模型的前向评估即可。 从经验来看,在大多数情况下,这种方法能够有效地减少各种模型和提示中的毒性内容,并且在大多数设置下实现了最佳的整体毒性与质量权衡。更为广泛而言,我们的工作将词嵌入作为有效的控制变量进行了定位,并鼓励更广泛应用黑盒优化来引导自回归语言模型实现可扩展、安全的文本生成,而无需任何训练或对中间计算的访问需求。

URL

https://arxiv.org/abs/2602.02498

PDF

https://arxiv.org/pdf/2602.02498.pdf


Tags
3D Action Action_Localization Action_Recognition Activity Adversarial Agent Attention Autonomous Bert Boundary_Detection Caption Chat Classification CNN Compressive_Sensing Contour Contrastive_Learning Deep_Learning Denoising Detection Dialog Diffusion Drone Dynamic_Memory_Network Edge_Detection Embedding Embodied Emotion Enhancement Face Face_Detection Face_Recognition Facial_Landmark Few-Shot Gait_Recognition GAN Gaze_Estimation Gesture Gradient_Descent Handwriting Human_Parsing Image_Caption Image_Classification Image_Compression Image_Enhancement Image_Generation Image_Matting Image_Retrieval Inference Inpainting Intelligent_Chip Knowledge Knowledge_Graph Language_Model LLM Matching Medical Memory_Networks Multi_Modal Multi_Task NAS NMT Object_Detection Object_Tracking OCR Ontology Optical_Character Optical_Flow Optimization Person_Re-identification Point_Cloud Portrait_Generation Pose Pose_Estimation Prediction QA Quantitative Quantitative_Finance Quantization Re-identification Recognition Recommendation Reconstruction Regularization Reinforcement_Learning Relation Relation_Extraction Represenation Represenation_Learning Restoration Review RNN Robot Salient Scene_Classification Scene_Generation Scene_Parsing Scene_Text Segmentation Self-Supervised Semantic_Instance_Segmentation Semantic_Segmentation Semi_Global Semi_Supervised Sence_graph Sentiment Sentiment_Classification Sketch SLAM Sparse Speech Speech_Recognition Style_Transfer Summarization Super_Resolution Surveillance Survey Text_Classification Text_Generation Time_Series Tracking Transfer_Learning Transformer Unsupervised Video_Caption Video_Classification Video_Indexing Video_Prediction Video_Retrieval Visual_Relation VQA Weakly_Supervised Zero-Shot