TL;DR
This paper introduces a task-specific compression framework that enables the deployment of Large Language Models (LLMs) as medical AI assistants on edge devices like the NVIDIA Jetson Orin Nano and Raspberry Pi 5. By leveraging an input-driven, dual-stage saliency metric to prune irrelevant neurons on domain-specific data followed by 4-bit quantization, the authors compress models by up to 67% while maintaining high accuracy and achieving energy-efficient, real-time inference.
What Problem Does This Paper Address?
While LLMs show immense promise in healthcare, their massive parameter counts make them prohibitively expensive and slow to run on resource-constrained edge devices. In clinical settings, on-device deployment is crucial for preserving patient privacy, minimizing latency, and operating autonomously without relying on cloud connectivity.
Existing model compression techniques (like structured pruning) typically treat all domains equally, pruning networks in a task-agnostic manner. However, specialized applications like medical question-answering only exercise a small subset of an LLM's total capacity. This paper addresses the gap by proposing a domain-specific pruning strategy that identifies and retains only the neurons critical to medical language processing.
Methods
The authors propose a multi-stage pipeline consisting of input-driven pruning, post-pruning quantization, and downstream fine-tuning:
- Input-Driven Saliency Estimation: To determine which neurons are actually useful for medical tasks, the framework passes domain-specific data through the model and computes a dual-stage saliency metric for each neuron in the Feed-Forward Network (FFN) layers:
- Magnitude Saliency: Measured using the $L_2$ norm of the neuron's activation output.
- Gradient Saliency: Measured using the Jacobian norm sensitivity of the activation function with respect to its input.
- Differentiable Masking: Neurons with low scores in both metrics are deemed redundant. The framework optimizes a resource-constrained loss function via backpropagation to iteratively update soft masks into binary masks (0 for pruned, 1 for retained).
- Quantization & Fine-Tuning: After pruning, the remaining weights are quantized to 4-bit precision (
INT4, specifically theQ4_0format) usingllama.cpp. To recover any lost performance, Low-Rank Adaptation (LoRA) is applied to fine-tune the compressed model on medical datasets.
Datasets
The framework utilizes several prominent medical NLP datasets for pruning, fine-tuning, and evaluation:
- Medical Meadow: Used during the pruning and fine-tuning phases to maintain general medical reasoning and instruction-following capabilities.
- MedQuAD: A collection of high-quality, fact-based medical QA pairs used for task-specific fine-tuning.
- Evaluation Benchmarks: The compressed models were evaluated across three major medical question-answering datasets: MedMCQA, MedQA, and PubMedQA. Perplexity was benchmarked using text from Harrison's Principles of Internal Medicine.
Key Insights and Ideas
- Input Distribution Dictates Saliency: A neuron's importance is highly dependent on the input data. By evaluating saliency on a medical corpus rather than general text, the framework safely removes large chunks of the network that are inactive during clinical tasks.
- FFN Layers are the Primary Target: Pruning is restricted entirely to the FFN layers because they contain the majority of the model's parameters and dominate inference latency on edge hardware.
- The "Performance Cliff": LLMs exhibit a high tolerance for task-specific pruning up to a certain threshold (50% for Gemma, 67% for LLaMA3), after which perplexity sharply degrades, indicating a total breakdown of the model's internal representations.
Key Results
- Superior Compression vs. Baselines: For LLaMA3-8B, the proposed method reduced the parameter count to 4.30B while achieving a perplexity score of 10.9. This represents a 1.4–1.6× lower perplexity at a smaller model size compared to state-of-the-art task-agnostic methods like LLM-Pruner, SliceGPT, and ATP.
- High Accuracy Retention: The 50% pruned Gemma-7B model retained strong performance, scoring 30.82% on MedMCQA and 61.70% on PubMedQA while shrinking its overall memory footprint from 28 GB down to just 5 GB.
- Edge Deployment Success:
- On the NVIDIA Jetson Orin Nano, the 67% pruned LLaMA3-8B achieved a throughput of 22.3 tokens per second with a peak power consumption of 18.7W.
- On the low-cost Raspberry Pi 5 (CPU-only), both the compressed Gemma and LLaMA3 models achieved a usable throughput of 5.3 tokens per second at a highly efficient peak power of ~6.3W.
Limitations and Future Work
The authors note that while in-domain performance remains robust under aggressive pruning, cross-domain generalization declines much earlier. For example, a model pruned and fine-tuned strictly on MedQuAD experiences a sharper rise in perplexity when tested on the broader Medical Meadow dataset.
As a next step, the researchers plan to extend this deployment framework into real-world clinical settings to validate its utility for privacy-preserving, point-of-care medical applications.
Summary updated