DIESEL -- Dynamic Inference-Guidance via Evasion of Semantic Embeddings in LLMs
Ben Ganon, Alon Zolfi, Omer Hofman, Inderjeet Singh, Hisashi Kojima, Yuval Elovici, Asaf Shabtai
TL;DR
DIESEL addresses the challenge of safely deploying autoregressive LLMs without expensive retraining by introducing a lightweight, inference-time mechanism that filters undesired outputs through latent-space semantic similarity to user-defined negative concepts. The method uses a three-step decoding pipeline—candidate selection, latent-space safety scoring, and token reranking—to steer generation while preserving fluency and substantially reducing unsafe responses. Evaluations across multiple state-of-the-art models, jailbreaking attacks, and multilingual settings demonstrate strong safety improvements with minimal utility loss and modest runtime overhead, outperforming several existing defenses. The approach is generalizable beyond safety to other content-m filtering tasks, and its reliance on textual descriptions of negative concepts enables flexible, user-friendly safety control in dynamic settings.
Abstract
In recent years, large language models (LLMs) have had great success in tasks such as casual conversation, contributing to significant advancements in domains like virtual assistance. However, they often generate responses that are not aligned with human values (e.g., ethical standards, safety), leading to potentially unsafe or inappropriate outputs. While several techniques have been proposed to address this problem, they come with a cost, requiring computationally expensive training or dramatically increasing the inference time. In this paper, we present DIESEL, a lightweight inference-guidance technique that can be seamlessly integrated into any autoregressive LLM to semantically filter undesired concepts from the response. DIESEL can function either as a standalone safeguard or as an additional layer of defense, enhancing response safety by reranking the LLM's proposed tokens based on their similarity to predefined negative concepts in the latent space. Our evaluation demonstrates DIESEL's effectiveness on state-of-the-art conversational models, even in adversarial jailbreaking scenarios that challenge response safety. We also highlight DIESEL's generalization capabilities, showing that it can be used in use cases other than safety, providing general-purpose response filtering.
