Detection of Breast Cancer Lumpectomy Margin with SAM-incorporated Forward-Forward Contrastive Learning

Tyler Ward, Xiaoqin Wang, Braxton McFarland, Md. Atik Ahamed, Sahar Nozad, Talal Arshad, Hafsa Nebbache, Jin Chen, Abdullah-Al-Zubaer ImranarXiv 2025 · DOI

Abstract

Breast-conserving surgery (lumpectomy) often faces high re-excision rates due to the low sensitivity of intraoperative specimen radiography (SR). This paper introduces FFCL-SAM, a novel framework combining Forward-Forward Contrastive Learning (FFCL) for robust patch-level classification with the Segment Anything Model (SAM) for precise mask refinement. The proposed method achieves a 27.4% improvement in segmentation accuracy (Dice Similarity Coefficient) over baseline models, offering a promising real-time tool for surgical margin assessment.

Introduction

In lumpectomy, the primary surgical objective is the complete removal of malignant tissue with a "negative margin"—a surrounding border of healthy tissue. Currently, surgeons rely on 2D specimen radiography (SR) to assess margins intraoperatively. However, the visual similarity between tumors and healthy soft tissues on X-rays leads to low sensitivity (36–58%). Consequently, approximately 25% of patients require secondary surgeries after pathology confirms positive margins. There is an urgent need for automated, high-precision tools to assist in real-time margin detection.

Methodology

The FFCL-SAM framework utilizes a two-stage pipeline to bridge the gap between coarse patch-level classification and fine-grained anatomical segmentation.

Overview of the FFCL-SAM pipeline, showing the transition from original image to refined mask.

1. Forward-Forward Contrastive Learning (FFCL)

To overcome the limitations of standard backpropagation on small medical datasets, the authors employ the "Forward-Forward" algorithm for pre-training a ResNet-18 backbone. This approach involves two distinct contrastive learning phases:

  • Local Contrastive Learning: Individual layers are trained to distinguish between positive and negative tissue patches.
  • Global Contrastive Learning: The network optimizes representations across all layers to capture broader contextual features.
The FFCL architecture, illustrating Local and Global Contrastive Representation Learning followed by Backpropagation.

2. SAM-Based Refinement

The patch-level predictions are aggregated into a coarse binary mask. This mask serves as a prompt (bounding box and mask) for the Segment Anything Model (SAM 2). SAM leverages its zero-shot capabilities to refine the blocky predictions, aligning them with the actual anatomical boundaries of the specimen.

Experimental Setup and Datasets

The study utilized 92 intraoperative specimen radiographs from 46 patients. Expert radiologists provided ground-truth annotations for malignant regions and pathology-confirmed positive margins. To ensure robustness, the model was trained on over 26,000 extracted patches, with positive margin cases reserved exclusively for validation and testing to evaluate generalization.

Results and Discussion

The FFCL-pretrained ResNet-18 achieved an AUC of 0.8455 in patch classification. The integration of SAM 2 significantly enhanced the final output, improving the Dice Similarity Coefficient (DSC) by 27.4% compared to unrefined masks. Notably, the refinement process is highly efficient, taking only 47 milliseconds, which is well within the requirements for real-time intraoperative use.

While promising, the study is limited by its relatively small cohort size (46 patients) and the inherent sensitivity of SAM to the quality of the initial classification prompts. Future work will focus on multi-center validation and more automated prompt generation techniques.

Conclusion

FFCL-SAM demonstrates that combining domain-specific "backpropagation-free" pre-training with powerful foundation models like SAM can significantly improve medical image segmentation in data-scarce environments. This framework provides a viable path toward reducing re-excision rates in breast cancer surgery.

Summary updated

BibTeX
@misc{ward2025detection,
  author = {Tyler Ward and Xiaoqin Wang and Braxton McFarland and Md. Atik Ahamed and Sahar Nozad and Talal Arshad and Hafsa Nebbache and Jin Chen and Abdullah-Al-Zubaer Imran},
  title = {{Detection of Breast Cancer Lumpectomy Margin with SAM-incorporated Forward-Forward Contrastive Learning}},
  year = {2025},
  eprint = {2506.21006},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.21006},
}
Figure