LoFT: Local Proxy Fine-tuning For Improving Transferability Of Adversarial Attacks Against Large Language Model

Muhammad Ahmed Shah, Roshan Sharma, Hira Dhamyal, Raphaël Olivier, Ankit Shah, Joseph Konan, Dareen Alharthi, Hazim T. Bukhari, Massa Baali, Soham Deshmukh, Michael Kuhlmann, Bhiksha Raj, Rita SingharXiv 2023

Abstract

It has been shown that Large Language Model (LLM) alignments can be circumvented by appending specially crafted attack suffixes with harmful queries to elicit harmful responses. To conduct attacks against private target models whose characterization is unknown, public models can be used as proxies to fashion the attack, with successful attacks being transferred from public proxies to private target models. The success rate of attack depends on how closely the proxy model approximates the private model. We hypothesize that for attacks to be transferrable, it is sufficient if the proxy can approximate the target model in the neighborhood of the harmful query. Therefore, in this paper, we propose Local Fine-Tuning (LoFT), i.e., fine-tuning proxy models on similar queries that lie in the lexico-semantic neighborhood of harmful queries to decrease the divergence between the proxy and target models. Experiments show that local fine-tuning of proxy models improves attack transferability and increases attack success rate by 39%, 7%, and 0.5% (absolute) on target models ChatGPT, GPT-4, and Claude respectively.

Introduction

Large Language Models (LLMs) are typically "aligned" to refuse harmful requests. However, researchers have demonstrated that adversarial attacks—such as appending optimized "attack suffixes"—can bypass these safeguards. A significant challenge arises when attacking private, black-box models like GPT-4 or Claude, where internal weights are inaccessible. In these scenarios, attackers often rely on public "proxy" models (e.g., Vicuna) to craft attacks, hoping they "transfer" to the target. Unfortunately, the divergence between proxy and target models often leads to low transfer success rates.

The LoFT Approach

We propose Local Fine-Tuning (LoFT), based on the hypothesis that a proxy model does not need to be a global clone of the target. Instead, it is sufficient if the proxy approximates the target model's behavior in the local lexico-semantic neighborhood of a specific harmful query.

Conceptual overview of LoFT: (a) Moving proxy models closer to the target in model space via fine-tuning. (b) Aligning response surfaces in the neighborhood of harmful queries.

Methodology

The LoFT pipeline consists of three primary stages:

  1. Neighborhood Generation: Given a harmful query, we generate approximately 100 variations. We found the Fill-In-The-Blank (FITB) method—masking non-stop words and asking the target model to fill them—most effective at maintaining semantic similarity while providing diverse training data.
  2. Local Fine-Tuning: The target model's responses to these variations are collected. A public proxy model is then fine-tuned on this local dataset to mimic the target's behavior in that specific region of the input space.
  3. Attack Optimization: We apply the Greedy Coordinate Gradient (GCG) algorithm to the localized proxy to find an attack suffix. Because the proxy now closely mimics the target's local response surface, the resulting attack is significantly more likely to transfer.
The LoFT attack pipeline: An attack algorithm uses the local FT proxy to generate an attack query, which is then evaluated against the target LLM.

Experimental Results

Experiments were conducted using the AdvBench dataset and target models including GPT-3.5, GPT-4, and Claude-2. LoFT demonstrated substantial improvements over standard transfer attacks:

  • GPT-4: The response rate (the frequency with which the model did not refuse the prompt) increased from 36.9% to 89.7%, representing a 143% relative improvement.
  • ChatGPT (GPT-3.5): The human-verified Attack Success Rate (ASR) reached 43.6%, a ten-fold improvement over the baseline.
  • Claude-2: While Claude remained the most resilient, LoFT successfully elicited valid responses where baseline attacks failed entirely.

Key Insights

  • FITB Superiority: Traditional paraphrasing often alters sentence structure too much. FITB preserves the "shape" of the query, leading to better proxy alignment.
  • Metric Discrepancy: The study identifies a gap in current safety metrics. Many models may bypass a refusal (not saying "I'm sorry") but still fail to provide harmful information. LoFT focuses on eliciting truly harmful content through human evaluation.
  • Cross-Model Teaching: Using Claude-2 to generate the local fine-tuning data improved attack success on other models, suggesting that high-quality, diverse neighborhood samples are critical.

Conclusion

LoFT demonstrates that local alignment of proxy models is a highly effective strategy for bypassing LLM safeguards. While this poses a significant security risk, it also highlights the need for more robust, non-local alignment techniques. Future work should address the cost of elicitation and the development of automated metrics that better capture true harmfulness.

Summary updated

BibTeX
@misc{shah2023loft,
  author = {Muhammad Ahmed Shah and Roshan Sharma and Hira Dhamyal and Raphaël Olivier and Ankit Shah and Joseph Konan and Dareen Alharthi and Hazim T. Bukhari and Massa Baali and Soham Deshmukh and Michael Kuhlmann and Bhiksha Raj and Rita Singh},
  title = {{LoFT: Local Proxy Fine-tuning For Improving Transferability Of Adversarial Attacks Against Large Language Model}},
  year = {2023},
  eprint = {2310.04445},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.04445},
}
Figure