NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Enhancing the Resilience of LLMs Against Grey-box Extractions

Hanbo Huang, Yihan Li, Bowen Jiang, Lin Liu, Zhuotao Liu, Ruoyu Sun, Shiyu LiangNextGenAISafety @ ICML 2024

TL;DR

This paper introduces EX-Priv, a novel method for enhancing the resilience of large language models (LLMs) against grey-box extraction attacks by strategically privatizing only a few early layers. Surprisingly, privatizing just the first decoder layer can offer comparable protection to privatizing the entire model, significantly reducing the computational cost and complexity of defense.

What Problem Does This Paper Address?

Large language models (LLMs) are typically deployed in two ways: closed-source, offering high performance but limited customization, or open-source, providing transparency at the cost of proprietary asset loss. Grey-box approaches aim for a balance by privatizing only certain model components. However, these models are vulnerable to "grey-box extraction attacks," where adversaries try to replicate the model's functionality by querying it and using the outputs to train a substitute model. Existing defenses often involve extensive privatization, which can hinder customization and performance. This paper addresses the challenge of finding an efficient and effective way to protect LLMs in a grey-box setting without sacrificing too much performance or customization.

Methods

The core of this paper is the EX-Priv algorithm. It's based on a theoretical finding that in decoder-only LLMs, earlier layers contribute more significantly to resilience against extraction attacks than later layers. The authors theoretically prove the existence of a "transition layer" after which layers offer diminishing returns in terms of resilience.

EX-Priv works by:

  1. Theoretical Analysis: Proving that earlier layers are more critical for resilience.
  2. Resilience Score (RS): Introducing a computationally efficient metric to estimate the performance of a recovered model without requiring full fine-tuning. This score is based on the initial expected loss of the model with randomly initialized private layers.
  3. Iterative Privatization: Starting with the first layer, EX-Priv sequentially identifies the minimal set of consecutive early layers to privatize to achieve a desired level of resilience (e.g., recovery ratio within 1+ε of full privatization).

Datasets

The paper uses a combination of existing datasets for training and evaluation:

  • Attack Dataset: A merged dataset from the MMLU benchmark and the Alpaca 52k dataset, used for training the extracted models.
  • Evaluation Datasets: The paper utilizes a comprehensive suite of 16 benchmarks categorized into six groups: Commonsense Reasoning (Rsn.), Reading Comprehension (Read.), World Knowledge (Knl.), Code, Math, and General Ability (Gen.). These are standard benchmarks used in LLM evaluation.

Key Insights and Ideas

  • Early Layers are Key: The most surprising finding is that privatizing just the first decoder layer can provide resilience comparable to privatizing the entire model (all 32 layers in Llama2-7B). This dramatically reduces the attack surface and the cost of defense.
  • Transition Layer: The theoretical proof of a "transition layer" is crucial. It suggests that beyond a certain point in the model's architecture, further privatization yields diminishing returns in resilience. This justifies focusing on early layers.
  • Resilience Score (RS): The introduction of a computationally efficient RS metric is a significant methodological contribution. It allows for estimating privatization effectiveness without the costly process of full model fine-tuning, making the EX-Priv algorithm practical.
  • Correlation is Strong: The paper demonstrates a strong negative correlation between the proposed resilience score and the actual recovery ratio across various models and benchmarks, validating the RS as a reliable predictor.

Key Results

  • EX-Priv Effectiveness: EX-Priv consistently achieved resilience comparable to full privatization across three different LLM architectures (Llama2-7B, Mistral-7B, Falcon-7B) and 16 benchmarks.
  • Minimal Privatization: For Llama2-7B, privatizing only 3.13% of parameters (identified by EX-Priv) yielded an Average Recovery Ratio (ARR) of 24.1%, very close to the 25.6% ARR of a fully privatized model.
  • Transition Layer Identification: The paper successfully identified transition layers in Llama2-7B (around layer 14), Mistral-7B (around layer 2), and Falcon-7B (around layer 24), showing that privatizing layers before these points significantly enhances resilience.
  • Low Sensitivity to ε: The EX-Priv algorithm showed low sensitivity to the tolerance parameter ε, meaning the choice of ε within a reasonable range did not drastically alter the privatization strategy or its effectiveness.

Limitations and Future Work

  • Limitations: The paper acknowledges that while EX-Priv significantly enhances resilience, it doesn't completely eliminate the possibility of model extraction, especially in highly specialized domains like code and math where recovery ratios can drop to 0%. The theoretical analysis relies on assumptions about the LLM architecture (decoder-only) and the nature of the attack.
  • Future Work: The authors suggest extending this approach to smaller models and exploring the limitations of EX-Priv. Further research could investigate more complex LLM architectures and explore hybrid defense strategies that combine EX-Priv with other techniques.

Summary updated

BibTeX
@inproceedings{huang2024enhancing,
  author = {Hanbo Huang and Yihan Li and Bowen Jiang and Bo Jiang and Lin Liu and Zhuotao Liu and Ruoyu Sun and Shiyu Liang},
  title = {{Enhancing the Resilience of LLMs Against Grey-box Extractions}},
  booktitle = {NextGenAISafety @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=hC35JPiczF},
}
Figure