Nexus Scissor: Enhance Open-Access Language Model Safety by Connection Pruning

Yan Pang, Peihua Mai, Youjia Yang, Yan RanResearch Square 2024

Abstract

Large language models (LLMs) are vulnerable to adversarial attacks that bypass safety measures and induce the model to generate harmful content. Securing open-access LLMs against these adversarial attacks is especially challenging due to their offline, unregulated, and often secretive usage. To defend open-access models against a broad spectrum of attacks, it is critical to mitigate their inherent capacity to retrieve malicious responses. Inspired by Spreading Activation theory, this paper proposes the Nexus Scissor, a framework based on connection pruning, to prevent LLMs from recalling harmful content, thereby bolstering its security against a range of jailbreak attacks. Nexus Scissor servers the link between the malicious target and its immediate harmful knowledge, while maintaining the integrity of the remaining knowledge graph. Our framework can also be generalized to closed-access models, such as ChatGPT and Claude. Empirical analysis demonstrates that our proposed Nexus scissor effectively enhances the safety of open-access LLMs against various adversarial attacks, with minimal impact on performance across on common benchmarks.

Introduction: The Safety-Utility Tradeoff

Open-access models like Llama-3 and Phi-3 are powerful tools, but they present unique security challenges. Unlike closed-access models, their weights can be run offline, making traditional safety guardrails—such as input filters or output detectors—easy to bypass or "unlearn" through adversarial fine-tuning.

A central challenge in securing these models is the Safety-Utility Tradeoff. Traditional unlearning methods often attempt to make a model "forget" harmful information by erasing entire concepts. However, this "scorched earth" approach frequently leads to "collateral damage," where the model loses the ability to answer benign questions related to those concepts. For example, a model might lose its understanding of chemistry entirely while trying to forget how to manufacture dangerous substances.

Figure 1: Comparison between naive unlearning and the original model, highlighting the risk of collateral damage to benign queries.

Methodology: Connection Pruning

Inspired by the psychological Spreading Activation (SA) theory and biological synaptic pruning, the researchers propose Nexus Scissor. This framework performs a "surgical strike" on the model's knowledge graph, disrupting the specific retrieval paths between malicious prompts and harmful procedures rather than erasing the underlying concepts.

Figure 5: The theoretical inspiration for Nexus Scissor: Spreading Activation Theory and Synaptic Pruning.

The Nexus Scissor pipeline consists of four key steps:

  1. Extraction: Using known jailbreak attacks (e.g., AutoDAN) to force the LLM to generate harmful content.
  2. Knowledge Abstraction: Converting this harmful text into a Knowledge Graph (KG) of triplets (Subject, Relation, Object), such as (steal identity, step of, gather personal information).
  3. Clustering: Grouping similar harmful triplets using embedding models and hierarchical clustering to identify representative "pruning targets."
  4. Connection Pruning: Fine-tuning the model using gradient ascent to specifically weaken the probability of generating the "tail" of a harmful triplet when given the "head" and "relation." A KL divergence term is used to ensure the rest of the model’s weights remain stable, preserving general utility.

Evaluation and Datasets

The study utilized several key datasets for training and evaluation:

  • AdvBench & ForbidQ: Datasets of harmful instructions and prohibited scenarios used to test jailbreak resistance.
  • GLUE Benchmark: Used to evaluate general language capabilities across tasks like sentiment analysis and natural language inference.
  • Custom Triplet Dataset: A manually crafted dataset of 300 examples pairing harmful responses with their corresponding knowledge graph triplets.

Key Results and Insights

The empirical analysis reveals several critical advantages of the Nexus Scissor framework:

  • Massive Safety Boost: Across LLaMA-2, LLaMA-3, and Phi-3, the Attack Success Rate (ASR) dropped by an average of 91%. For LLaMA-2-7b, the ASR plummeted from 61.76% to a mere 2.75%.
  • Minimal Utility Loss: Performance on the GLUE benchmark stayed within 2% of the original models, significantly outperforming naive unlearning methods.
  • Surgical Precision: By focusing on connections, the model retains the ability to define dangerous objects (maintaining safety awareness) while losing the ability to provide "how-to" instructions (preventing harm).

Conclusion and Future Work

Nexus Scissor demonstrates that harmful knowledge in LLMs is often clustered and can be disrupted by targeting a few "nexus" points. While currently modifying all parameters, future work could identify specific "knowledge neurons" to make pruning even more efficient. Additionally, refining the objective function during fine-tuning could further optimize the balance between safety and utility.

Summary updated

Abstract

<title>Abstract</title> Large language models (LLMs) are vulnerable to adversarial attacks that bypass safety measures and induce the model to generate harmful content. Securing open-access LLMs against these adversarial attacks is especially challenging due to their offline, unregulated, and often secretive usage. To defend open-access models against a broad spectrum of attacks, it is critical to mitigate their inherent capacity to retrieve malicious responses. Inspired by Spreading Activation theory, this paper proposes the Nexus Scissor, a framework based on connection pruning, to prevent LLMs from recalling harmful content, thereby bolstering its security against a range of jailbreak attacks. Nexus Scissor servers the link between the malicious target and its immediate harmful knowledge, while maintaining the integrity of the remaining knowledge graph. Our framework can also be generalized to closed-access models, such as ChatGPT and Claude. Empirical analysis demonstrates that our proposed Nexus scissor effectively enhances the safety of open-access LLMs against various adversarial attacks, with minimal impact on performance across on common benchmarks.
BibTeX
@inproceedings{pang2024nexus,
  author = {Yan Pang and Peihua Mai and Youjia Yang and Yan Ran},
  title = {{Nexus Scissor: Enhance Open-Access Language Model Safety by Connection Pruning}},
  booktitle = {Research Square},
  year = {2024},
  doi = {10.21203/rs.3.rs-5315067/v1},
}
Figure