TL;DR
This paper introduces ATP, a novel one-stage approach that unifies structural pruning and fine-tuning for domain-specific LLMs. By dynamically adjusting pruning decisions during fine-tuning using a trainable generator and LoRA-aware techniques, ATP significantly outperforms existing two-stage methods, achieving high performance even with substantial parameter reduction.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly being adapted for specialized domains like healthcare and law. However, these domain-specific LLMs are computationally expensive. Existing methods to compress them typically involve a two-stage process: first, pruning a general-purpose LLM, and then fine-tuning the pruned model on domain-specific data. The core problem is that pruning decisions made on the initial, general-purpose weights are fixed and don't adapt as the model's weights are updated during domain-specific fine-tuning. This can lead to suboptimal pruning, where important structures for the domain are removed, resulting in performance degradation. This is particularly problematic when fine-tuning data is scarce, a common scenario for domain-specific applications.
Methods
The paper proposes ATP (All-in-One Tuning and Structural Pruning), a unified one-stage framework. The key innovations are:
- Trainable Pruning-Decision Generator (G): Instead of fixed pruning decisions, ATP uses a generator network that dynamically learns and updates these decisions throughout the fine-tuning process. This allows the pruning to adapt to the evolving importance of weights in the domain-specific context.
- LoRA-Aware Design: Given the prevalence of Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA for domain adaptation with limited data, ATP integrates LoRA directly.
- LoRA-Aware Forward Pass: This simulates the effect of pruning on the LLM's output without actually removing weights during the intermediate stages, enabling the generator to learn effective pruning decisions.
- LoRA-Aware Sparsity Regularization: This encourages the LoRA weights associated with pruned structures to approach zero, facilitating the clean removal of these structures at the end of the process. This is achieved using a group lasso regularization.
This integrated approach allows pruning decisions and fine-tuning to interact dynamically, leading to more optimal substructures for the target domain.
Datasets
The paper uses datasets for two specific domains:
- HealthCare Domain:
- Training Data (Dt): A combination of MedNLI, PubMedQA, and HQS (HealthQuestionSummary) in a 7:7:1 ratio, totaling 15,000 samples.
- Calibration Data (De): A mix of MedNLI, PubMedQA, HQS, and C4 (general domain data) totaling 1,300 samples.
- Legal Domain:
- Training Data (Dt): A combination of CaseHold and BillSum in a 13:2 ratio, totaling 15,000 samples.
- Calibration Data (De): A mix of CaseHold, BillSum, and C4 totaling 1,300 samples.
The paper explicitly states that they do not include samples from HarrisonTextBook (a medical textbook) or MultiLegalPile (a large legal corpus) in their training or calibration sets, to focus on more specific domain tasks.
Key Insights and Ideas
- Pruning Decisions Evolve: The most critical insight is that pruning decisions derived from a general model are not static. As a model fine-tunes for a specific domain, the importance of different weights changes, necessitating dynamic pruning.
- One-Stage is Better for Domain Adaptation: By unifying pruning and fine-tuning, ATP avoids the suboptimality of fixed pruning decisions from two-stage methods, leading to better domain alignment.
- LoRA Integration is Key: Leveraging LoRA for fine-tuning is crucial for domain-specific tasks with limited data. ATP's LoRA-aware designs ensure that the pruning process works harmoniously with LoRA adaptation.
- Hierarchical Pruning: The analysis of finalized pruning decisions shows a trend where earlier layers are pruned less and later layers more, aligning with the hierarchical nature of LLMs where early layers capture general features and later layers specialize.
Key Results
ATP demonstrates significant improvements over state-of-the-art two-stage pruning methods (LLM-Pruner and SliceGPT) across HealthCare and Legal domains.
- Performance Recovery:
- For LLaMA3-8B, ATP recovers up to 88% (at 40% sparsity) and 91% (at 50% sparsity) of the dense model's performance.
- For LLaMA2-7B, ATP recovers up to 81% (at 40% sparsity) and 91% (at 50% sparsity) of the dense model's performance.
- Language Modeling & Summarization: ATP achieves the lowest perplexity and better summarization capabilities, especially in the Legal domain where context is richer.
- High Sparsity: Even at high sparsity levels (e.g., 40-50%), ATP maintains performance comparable to the dense model, outperforming baselines that struggle.
- Case Studies: Qualitative examples show ATP's summaries better capture domain-specific nuances and critical points compared to baselines.
Limitations and Future Work
- Limitations:
- Repetitive Phrases: In summarization tasks, pruned models can occasionally get stuck repeating words or phrases, though ATP reduces this compared to other methods.
- Extreme Sparsity Degradation: At very high sparsity levels (p ≥ 0.6), a substantial performance drop is observed, indicating that aggressive parameter removal can disproportionately affect the model's ability to retain critical knowledge. Mitigating this degradation quickly remains a challenge.
- Future Work:
- Full-Parameter Fine-tuning Extension: The paper suggests ATP can be extended to full-parameter fine-tuning with minimal effort by applying the group lasso regularization directly to the original weights.
- Practical Deployment: Addressing the limitations for practical and scalable deployment in domain-specific applications.
- Investigating Calibration Data Sampling: The paper notes a repeated pattern in the training dynamics of the pruning-decision generator due to the use of an iterable object for the small calibration dataset. Future work might explore random mini-batch sampling for this generator.
Summary updated