Prompt-Free Lightweight SAM Adaptation for Histopathology Nuclei Segmentation with Strong Cross-Dataset Generalization

Muhammad Hassan Maqsood, Yanming Zhu, Alfred Lam, Getamesay Dagnaw, Xuefei Yin, Alan Wee-Chung Liew

TL;DR

This paper introduces a prompt-free, lightweight adaptation of the Segment Anything Model (SAM) specifically optimized for segmenting dense nuclei in histopathology images. By freezing SAM's encoder, applying Low-Rank Adaptation (LoRA), and introducing a custom residual decoder, the method achieves state-of-the-art accuracy and exceptional cross-dataset generalization using only 4.1 million trainable parameters.

What Problem Does This Paper Address?

Accurate nuclei segmentation in histopathology is a cornerstone of quantitative tissue analysis, helping clinicians with tumor grading, biomarker quantification, and cancer prognosis. While deep learning models (like U-Net and its transformer-based variants) have shown great promise, they suffer from two major flaws in clinical settings: they are computationally heavy and generalize poorly when exposed to new datasets with different tissue types or staining protocols (domain shift).

Recently, vision foundation models like the Segment Anything Model (SAM) have demonstrated incredible zero-shot generalization. However, SAM isn't a drop-in solution for pathology. It relies heavily on manual prompt guidance (like bounding boxes or points) or complex, heavy decoders, making it highly impractical for histopathology images that contain hundreds of dense, heterogeneous nuclei. This paper tackles the challenge of making SAM prompt-free, lightweight, and robust against domain shifts.

Methods

The authors propose a parameter-efficient framework that adapts a pretrained SAM (specifically the ViT-B variant) for automated, prompt-free segmentation.

Fig. 1. Overview of the proposed framework. A frozen SAM image encoder is adapted with LoRA modules inserted into its attention layers for parameter-efficient fine-tuning. Multi-level features from selected Transformer blocks are processed by lightweight residual decoder blocks and then fused to produce the final segmentation mask.

The architecture consists of three core components:

  1. LoRA-Enhanced SAM Encoder: The original weights of the SAM image encoder are frozen to preserve its rich, pretrained representations. Low-Rank Adaptation (LoRA) modules are inserted into the attention layers of all Transformer blocks. Only these LoRA layers are trained, which drastically reduces the parameter footprint.
  2. Multi-Level Feature Extraction: Instead of relying only on the final layer, the framework extracts intermediate feature maps from Blocks 8, 10, and 12. This captures a balanced mix of mid-level details (fine textures and boundaries) and deep-level features (broad contextual structures).
  3. Lightweight Residual Decoder: SAM's original prompt-dependent decoder is replaced with a prompt-free decoder composed of lightweight residual blocks (two $3\times3$ convolutions, batch normalization, and ReLU activations with an identity skip connection). The decoded features from the different blocks are concatenated and passed through a final $1\times1$ convolution.

To stabilize early training against severe class imbalance (few nuclei pixels vs. large background areas), the authors initialize the bias ($b_0$) of the final convolutional layer using the empirical nuclei foreground ratio: $$b_0 = \log\left(\frac{\pi}{1 - \pi}\right)$$ where $\pi$ is the average nuclei pixel ratio. The model is optimized using the Focal Tversky loss function.

Datasets

The framework was evaluated on three widely recognized histopathology benchmarks:

  • TNBC (Triple Negative Breast Cancer): A dataset focused on breast cancer biopsies.
  • MoNuSeg (Multi-Organ Nuclei Segmentation): A dataset containing diverse patient samples across multiple organs to test robustness.
  • PanNuke: An extensive open pan-cancer histology dataset covering 19 different tissue types.

Key Insights and Ideas

  • Foundation Models Can Be Lean: You don't need to fine-tune an entire foundation model to get domain-specific excellence. Tuning just 4.1M parameters via LoRA was enough to outperform models with over 60M parameters.
  • Skipping the Prompts via Residual Fusion: By replacing SAM's prompt-based decoding mechanism with a multi-level residual feature fusion strategy, the model successfully transitions from an interactive segmentation tool to a fully automated, dense segmentation pipeline.
  • Prior Knowledge Matters for Convergence: Initializing the final layer's bias with the empirical foreground class prior prevents the model from destabilizing during early training epochs, a common issue when dealing with highly imbalanced medical imaging masks.

Key Results

The proposed method was compared against standard CNNs, Transformers, and other SAM adaptation methods.

In-Domain Performance

As shown in the benchmark results, the proposed model achieved the highest Dice scores across all three datasets while maintaining a remarkably low parameter count.

Quantitative comparison of segmentation performance across TNBC, MoNuSeg, and PanNuke datasets.

Cross-Dataset Generalization

To simulate real-world clinical deployment where domain shifts occur, the models were trained on one dataset and directly evaluated on the other two without any fine-tuning.

Table 2. Cross-dataset generalization of nuclei segmentation models, reported as Dice/IoU percentages. Bold indicates the best result and underline the second best.

The proposed framework consistently achieved top performance. For instance, when trained on MoNuSeg and tested on the unseen TNBC dataset, it achieved a 79.45% Dice score, significantly outperforming U-Net (16.20%) and Swin-Unet (41.92%).

Qualitatively, the model demonstrates a strong ability to cleanly separate tightly clustered nuclei and maintain sharp boundaries under varying stain intensities.

Fig. 2. Qualitative segmentation results on TNBC (Col 1-3), PanNuke (Col 4-5), and MoNuSeg (Col 6-8) datasets. Input images (top), ground truth annotations (middle), and predicted masks (bottom) are shown.

Limitations and Future Work

Not discussed in the paper.

Summary updated

BibTeX
@inproceedings{maqsood2026prompt,
  author = {Muhammad Hassan Maqsood and Yanming Zhu and Alfred Lam and Getamesay Dagnaw and Xuefei Yin and Alan Wee-Chung Liew},
  title = {{Prompt-Free Lightweight SAM Adaptation for Histopathology Nuclei Segmentation with Strong Cross-Dataset Generalization}},
  booktitle = {ISBI},
  year = {2026},
  doi = {10.1109/isbi61048.2026.11515728},
}
Figure