Backtracking for Safety

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sel, Bilgehan, Li, Dingcheng, Wallis, Phillip, Keshava, Vaishakh, Jin, Ming, Jonnalagadda, Siddhartha Reddy
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866915192735006720
author Sel, Bilgehan
Li, Dingcheng
Wallis, Phillip
Keshava, Vaishakh
Jin, Ming
Jonnalagadda, Siddhartha Reddy
author_facet Sel, Bilgehan
Li, Dingcheng
Wallis, Phillip
Keshava, Vaishakh
Jin, Ming
Jonnalagadda, Siddhartha Reddy
contents Large language models (LLMs) have demonstrated remarkable capabilities across various tasks, but ensuring their safety and alignment with human values remains crucial. Current safety alignment methods, such as supervised fine-tuning and reinforcement learning-based approaches, can exhibit vulnerabilities to adversarial attacks and often result in shallow safety alignment, primarily focusing on preventing harmful content in the initial tokens of the generated output. While methods like resetting can help recover from unsafe generations by discarding previous tokens and restarting the generation process, they are not well-suited for addressing nuanced safety violations like toxicity that may arise within otherwise benign and lengthy generations. In this paper, we propose a novel backtracking method designed to address these limitations. Our method allows the model to revert to a safer generation state, not necessarily at the beginning, when safety violations occur during generation. This approach enables targeted correction of problematic segments without discarding the entire generated text, thereby preserving efficiency. We demonstrate that our method dramatically reduces toxicity appearing through the generation process with minimal impact to efficiency.
format Preprint
id arxiv_https___arxiv_org_abs_2503_08919
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Backtracking for Safety
Sel, Bilgehan
Li, Dingcheng
Wallis, Phillip
Keshava, Vaishakh
Jin, Ming
Jonnalagadda, Siddhartha Reddy
Computation and Language
Artificial Intelligence
Large language models (LLMs) have demonstrated remarkable capabilities across various tasks, but ensuring their safety and alignment with human values remains crucial. Current safety alignment methods, such as supervised fine-tuning and reinforcement learning-based approaches, can exhibit vulnerabilities to adversarial attacks and often result in shallow safety alignment, primarily focusing on preventing harmful content in the initial tokens of the generated output. While methods like resetting can help recover from unsafe generations by discarding previous tokens and restarting the generation process, they are not well-suited for addressing nuanced safety violations like toxicity that may arise within otherwise benign and lengthy generations. In this paper, we propose a novel backtracking method designed to address these limitations. Our method allows the model to revert to a safer generation state, not necessarily at the beginning, when safety violations occur during generation. This approach enables targeted correction of problematic segments without discarding the entire generated text, thereby preserving efficiency. We demonstrate that our method dramatically reduces toxicity appearing through the generation process with minimal impact to efficiency.
title Backtracking for Safety
topic Computation and Language
Artificial Intelligence
url https://arxiv.org/abs/2503.08919