Bridging the Objective Gap: A Unified Pre-Training Framework for Few-Shot Medical Image Segmentation
Proceedings of the Thirty-Fifth International Joint Conference on Artificial Intelligence. Main Track. Pages 998-1006.
https://doi.org/10.24963/ijcai.2026/112
Keywords
- Machine Learning: Few-shot learning
- Computer Vision: Biomedical image analysis
- Computer Vision: Segmentation, grouping and shape analysis
Abstract
Few-shot medical image segmentation relies on dense, boundary-sensitive prototype matching, yet common pre-training objectives mainly optimize global alignment or reconstruction, creating an objective gap that hurts boundary delineation and increases adaptation cost. This raises the question: how to pre-train representations intrinsically matchable for episodic FSS while requiring minimal adaptation-induced re-organization? We introduce a Drift-Gap diagnostic to quantify intrinsic dense-matching misalignment and adaptation-induced feature drift. Guided by this lens, we propose BOG-PRETRAIN, combining Reliability-Gated Alignment to mitigate noisy report supervision, Semantic-Guided MIM to emphasize boundary-informative regions, and Dual Consistency Regularization to stabilize episodic metric geometry. Across five benchmarks (1/4/16-shot), BOG-PRETRAIN improves mean Dice by +15.5/+15.9/+12.5 points over best priors and reduces mean HD95 by 0.9/4.6/10.1; it achieves the lowest Drift (0.052 vs. 0.155 baseline) and Gap_PT (0.256), with ablations confirming the components' complementarity.
- [Al-Dhabyani et al., 2020] Walid Al-Dhabyani, Mohammed Gomaa, Hussien Khaled, and Aly Fahmy. Dataset of breast ultrasound images. Data in brief, 28:104863, 2020.
- [Azizi et al., 2021] Shekoofeh Azizi, Basil Mustafa, Fiona Ryan, Zachary Beaver, Jan Freyberg, Jonathan Deaton, Aaron Loh, Alan Karthikesalingam, Simon Kornblith, Ting Chen, Vivek Natarajan, and Mohammad Norouzi. Big self-supervised models advance medical image clas- sification. In 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pages 3458-3468. IEEE, 2021.
- [Boecking et al., 2022] Benedikt Boecking, Naoto Usuyama, Shruthi Bannur, Daniel C. Castro, Anton Schwaighofer, Stephanie L. Hyland, Maria Wetscherek, Tristan Naumann, Aditya V. Nori, Javier Alvarez-Valle, Hoifung Poon, and Ozan Oktay. Making the most of text semantics to improve biomedical vision-language pro- cessing. In Shai Avidan, Gabriel J. Brostow, Moustapha Cissé, Giovanni Maria Farinella, and Tal Hassner, editors, Computer Vision -ECCV 2022 -17th European Confer- ence, Tel Aviv, Israel, October 23-27, 2022, Proceedings, Part XXXVI, volume 13696 of Lecture Notes in Computer Science, pages 1-21. Springer, 2022.
- [Butoi et al., 2023] Victor Ion Butoi, Jose Javier Gonzalez Ortiz, Tianyu Ma, Mert R. Sabuncu, John V. Guttag, and Adrian V. Dalca. Universeg: Universal medical image segmentation. In IEEE/CVF International Conference on Computer Vision, ICCV 2023, Paris, France, October 1-6, 2023, pages 21381-21394. IEEE, 2023.
- [Byra et al., 2020] Michal Byra, Piotr Jarosik, Aleksandra Szubert, Michael Y. Galperin, Haydee Ojeda-Fournier, Linda K. Olson, Mary O'Boyle, Christopher Comstock, and Michael P. André. Breast mass segmentation in ul- trasound with selective kernel u-net convolutional neural network. Biomed. Signal Process. Control., 61:102027, 2020.
- [Chen et al., 2017] Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. CoRR, abs/1706.05587, 2017.
- [Chen et al., 2021] Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vi- sion transformers. In 2021 IEEE/CVF International Con- ference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pages 9620-9629. IEEE, 2021.
- [Cheng et al., 2015] Jun Cheng, Wei Huang, Shuangliang Cao, Ru Yang, Wei Yang, Zhaoqiang Yun, Zhijian Wang, and Qianjin Feng. Enhanced performance of brain tumor classification via tumor region augmentation and partition. PloS one, 10(10):e0140381, 2015.
- [Chowdhury et al., 2020] Muhammad Enamul Hoque Chowdhury, Tawsifur Rahman, Amith Khandakar, Rashid Mazhar, Muhammad Abdul Kadir, Zaid Bin Mahbub, Khandakar Reajul Islam, Muhammad Salman Khan, Atif Iqbal, Nasser Al-Emadi, Mamun Bin Ibne Reaz, and Mo- hammad Tariqul Islam. Can AI help in screening viral and COVID-19 pneumonia? IEEE Access, 8:132665-132676, 2020.
- [Devlin et al., 2019] Jacob Devlin, Ming-Wei Chang, Ken- ton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understand- ing. In Jill Burstein, Christy Doran, and Thamar Solorio, editors, Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers), pages 4171-4186. Association for Computational Linguistics, 2019.
- [Gong et al., 2021] Haifan Gong, Guanqi Chen, Ranran Wang, Xiang Xie, Mingzhi Mao, Yizhou Yu, Fei Chen, and Guanbin Li. Multi-task learning for thyroid nodule segmentation with thyroid region prior. In 18th IEEE International Symposium on Biomedical Imaging, ISBI 2021, Nice, France, April 13-16, 2021, pages 257-261. IEEE, 2021.
- [He et al., 2022] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross B. Girshick. Masked autoencoders are scalable vision learners. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2022, New Orleans, LA, USA, June 18-24, 2022, pages 15979-15988. IEEE, 2022.
- [Jha et al., 2020] Debesh Jha, Pia H. Smedsrud, Michael A. Riegler, Pål Halvorsen, Thomas de Lange, Dag Johansen, and Håvard D. Johansen. Kvasir-seg: A segmented polyp dataset. In Yong Man Ro, Wen-Huang Cheng, Junmo Kim, Wei-Ta Chu, Peng Cui, Jung-Woo Choi, Min-Chun Hu, and Wesley De Neve, editors, MultiMedia Modeling -26th International Conference, MMM 2020, Daejeon, South Korea, January 5-8, 2020, Proceedings, Part II, vol- ume 11962 of Lecture Notes in Computer Science, pages 451-462. Springer, 2020.
- [Koleilat et al., 2025] Taha Koleilat, Hojat Asgariandehko- rdi, Hassan Rivaz, and Yiming Xiao. Medclip-samv2: To- wards universal text-driven medical image segmentation. Medical Image Anal., 106:103749, 2025.
- [Litjens et al., 2017] Geert Litjens, Thijs Kooi, Babak Ehte- shami Bejnordi, Arnaud Arindra Adiyoso Setio, Francesco Ciompi, Mohsen Ghafoorian, Jeroen A. W. M. van der Laak, Bram van Ginneken, and Clara I. Sánchez. A sur- vey on deep learning in medical image analysis. Medical Image Anal., 42:60-88, 2017.
- [Liu et al., 2021] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In 2021 IEEE/CVF International Con- ference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pages 9992-10002. IEEE, 2021.
- [Ouyang et al., 2020] Cheng Ouyang, Carlo Biffi, Chen Chen, Turkay Kart, Huaqi Qiu, and Daniel Rueckert. Self- supervision with superpixels: Training few-shot medi- cal image segmentation without annotation. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, Computer Vision -ECCV 2020 -16th Eu- ropean Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part XXIX, volume 12374 of Lecture Notes in Computer Science, pages 762-780. Springer, 2020.
- [Radford et al., 2021] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agar- wal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language super- vision. In Marina Meila and Tong Zhang, editors, Pro- ceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, vol- ume 139 of Proceedings of Machine Learning Research, pages 8748-8763. PMLR, 2021.
- [Rahman et al., 2021] Tawsifur Rahman, Amith Khandakar, Yazan Qiblawey, Anas M. Tahir, Serkan Kiranyaz, Saad Bin Abul Kashem, Mohammad Tariqul Islam, Somaya Al- Máadeed, Susu M. Zughaier, Muhammad Salman Khan, and Muhammad Enamul Hoque Chowdhury. Exploring the effect of image enhancement techniques on COVID- 19 detection using chest x-ray images. Comput. Biol. Medicine, 132:104319, 2021.
- [Ronneberger et al., 2015] Olaf Ronneberger, Philipp Fis- cher, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Nassir Navab, Joachim Hornegger, William M. Wells III, and Alejan- dro F. Frangi, editors, Medical Image Computing and Computer-Assisted Intervention -MICCAI 2015 -18th In- ternational Conference Munich, Germany, October 5 -9, 2015, Proceedings, Part III, volume 9351 of Lecture Notes in Computer Science, pages 234-241. Springer, 2015.
- [Siragusa et al., 2025] Irene Siragusa, Salvatore Contino, Massimo La Ciura, Rosario Alicata, and Roberto Pirrone. Medpix 2.0: A comprehensive multimodal biomedical data set for advanced ai applications with retrieval aug- mented generation and knowledge graphs. Data Science and Engineering, pages 1-17, 2025.
- [Snell et al., 2017] Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few- shot learning. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 4077-4087, 2017.
- [Tang et al., 2025] Song Tang, Shaxu Yan, Xiaozhi Qi, Jianxin Gao, Mao Ye, Jianwei Zhang, and Xiatian Zhu. Few-shot medical image segmentation with high-fidelity prototypes. Medical Image Anal., 100:103412, 2025.
- [Wang et al., 2020] Haochen Wang, Xudong Zhang, Yutao Hu, Yandan Yang, Xianbin Cao, and Xiantong Zhen. Few- shot semantic segmentation with democratic attention net- works. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, Computer Vision -ECCV 2020 -16th European Conference, Glasgow, UK, Au- gust 23-28, 2020, Proceedings, Part XIII, volume 12358 of Lecture Notes in Computer Science, pages 730-746. Springer, 2020.
- [Wang et al., 2022] Zifeng Wang, Zhenbang Wu, Dinesh Agarwal, and Jimeng Sun. Medclip: Contrastive learning from unpaired medical images and text. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 3876-3887. Association for Computational Linguistics, 2022.
- [Ye et al., 2024] Yiwen Ye, Yutong Xie, Jianpeng Zhang, Ziyang Chen, Qi Wu, and Yong Xia. Continual self- supervised learning: Towards universal multi-modal medi- cal data representation learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2024, Seattle, WA, USA, June 16-22, 2024, pages 11114-11124. IEEE, 2024.
References were extracted automatically from the PDF and may contain errors.
Full text extracted automatically from the PDF; figures, tables and equations may differ. The PDF is the version of record.
1 Introduction
Deep learning has substantially advanced medical image segmentation, yet clinical adoption is hindered by high annotation costs [Litjens et al., 2017; Ronneberger et al., 2015]. Few-shot segmentation (FSS) addresses this via prototypebased matching from limited support images [Wang et al., 2020; Snell et al., 2017]. While recent pipelines leverage large-scale pre-training [Azizi et al., 2021], standard initializers often fall short for boundary-sensitive dense matching in episodic FSS. We attribute this to an objective gap in task form: prevalent pre-training objectives emphasize global alignment or reconstruction, which misaligns with the local, pixel-precise separability required by mask-conditioned prototype matching. As a result, similarity maps can be unreliable (especially near boundaries), and few-shot fine-tuning must substantially reshape representations, leading to unstable and costly adaptation.
* Corresponding authors.
† The official implementation is available at https://github.com/ spchen01/BOG-Pretrain.

A good initializer should (i) be intrinsically matchable for dense prototype matching before any adaptation and (ii) remain stable under few-shot fine-tuning. We therefore introduce a Drift-Gap diagnostic (Fig. 1) that measures intrinsic dense-matching misalignment (GapPT) and adaptationinduced representation change (Drift). LowDrift indicates a well-organized episodic metric geometry, enabling effective adaptation with minimal representation re-organization; the bottom-left "sweet spot" simultaneously achieves lowGapPT and low Drift. This diagnostic also reveals characteristic shifts when individual objectives are removed, suggesting that the objective gap arises from multiple mismatches that must be addressed jointly.
Concretely, we trace the objective gap to three conflicts between generic pre-training and episodic FSS. Semantic mismatch: Radiology reports are frequently noisy or only partially relevant [Wang et al., 2022]; uniform image-text alignment can corrupt prototype semantics and weaken internal coherence. Structural mismatch: Standard masked image modeling optimizes reconstruction fidelity without prioritizing boundary-discriminative regions [He et al., 2022], limiting boundary-sensitive delineation. Metric instability: Without explicit consistency constraints, same-class features can vary substantially across views, forcing large feature drift during adaptation to align support and query prototypes. We formalize these effects in §3.1 and use them to guide objective design.
To bridge these gaps, we propose BOG-PRETRAIN, a pre-training framework for episodic FSS with three complementary components. Reliability-Gated Alignment (regularized by masked language modeling [Devlin et al., 2019]) down-weights unreliable report supervision to improve prototype coherence (reducing the interior mismatch). SemanticGuided MIM biases masking and reconstruction toward boundary-informative regions to enhance boundary sensitivity (reducing the boundary mismatch). Finally, Dual Consistency Regularization combines prototype-level consistency (ProtoNCE) and same-image consistency (SameImg) to stabilize episodic metric geometry and reduce Drift, enabling effective adaptation with minimal representation shift. Across five benchmarks, BOG-PRETRAIN improves mean Dice by up to +15.5/+15.9/+12.5 points and reduces mean HD95 by 0.9/4.6/10.1 under 1/4/16-shot settings. Together, they move the initializer toward the "sweet spot" in Fig. 1.
Our contributions are summarized as follows:
- Global objective bridging for episodic FSS. We propose Reliability-Gated Alignment to robustly leverage noisy image-report data, improving prototype coherence and intrinsic matchability.
- Local objective bridging for boundary-sensitive prediction. We propose Semantic-Guided MIM to prioritize boundary-informative regions during masked modeling, improving boundary adherence.
- A unified pre-training framework under an episodic diagnostic. We introduce the Drift-Gap diagnostic and Dual Consistency Regularization to stabilize episodic metric geometry and substantially reduce adaptation drift; the resulting BOG-PRETRAIN consistently outperforms existing methods across five benchmarks in both region and boundary metrics.
2 RelatedWork
2.1 Few-Shot and Universal Medical Image Segmentation
Few-shot segmentation (FSS) transfers segmentation to novel classes from a few annotated support images, and many pipelines adopt prototype-based metric matching to predict query masks in a shared embedding space [Snell et al., 2017]. Recent medical FSS and universal segmentation methods improve robustness via prototype refinement, self-supervised episodic training, or support-conditioned inference [Tang et al., 2025; Ouyang et al., 2020; Butoi et al., 2023]. While these designs strengthen adaptation and generalization, they largely operate within a given representation space and thus remain bounded by the initializer: whether dense features are already separable for mask-conditioned matching and how much they must change under few-shot adaptation. This motivates studying pre-training in terms of intrinsic matchability and adaptation cost for episodic FSS (Fig. 1).
2.2 Generic Self-Supervised Pre-Training: Structural and Geometric Limitations for Episodic Dense Matching
Self-supervised learning (SSL) provides strong generalpurpose initializers. Contrastive objectives such as MoCo v3 encourage view-invariant instance discrimination, typically on global embeddings [Chen et al., 2021], while masked image modeling (e.g., MAE) learns via reconstructing masked patches [He et al., 2022]. However, these objectives are not designed around mask-conditioned dense separability: reconstruction can preserve appearance without sharpening boundary-relevant cues, and instance-level invariance does not directly calibrate the dense metric geometry used by prototype matching. As a result, SSL/MIM initializers can exhibit intrinsic mismatch for boundary-sensitive delineation and require substantial representation re-organization during episodic fine-tuning, often appearing as elevated GapPT and/or Drift regimes in Fig. 1. For episodic FSS, this highlights the need to explicitly stabilize the episodic metric geometry (e.g., via consistency constraints) so that adaptation incurs minimal drift.
2.3 Vision-Language Pre-Training: Semantic Benefits with Reliability Challenges
Vision-language pre-training (VLP) injects semantic supervision by aligning image and text representations, as exemplified by CLIP [Radford et al., 2021] and medical adaptations such as MedCLIP and BioViL [Wang et al., 2022; Boecking et al., 2022], with continual multimodal learning explored in MedCoSS [Ye et al., 2024]. For prototype-based FSS, semantics can be valuable because prototypes act as episode-specific anchors for matching. However, radiology reports are often global, noisy, or only partially relevant to localized findings, making uniform alignment unreliable and potentially weakening region-level semantic coherence. Accordingly, VLP can improve intrinsic matchability in some cases yet remain sensitive to report quality and adaptation, leading to varied trade-offs between GapPT and Drift across datasets in Fig. 1.
Together, these limitations motivate our approach. We revisit pre-training for episodic, boundary-sensitive FSS from a coupled perspective of (i) semantic coherence for reliable prototypes, (ii) boundary-aware dense structure, and (iii) a stable episodic metric geometry with low adaptation drift. Building on segmentation-centric pipelines that accept given representations [Butoi et al., 2023; Tang et al., 2025; Ouyang et al., 2020] and generic SSL/VLP baselines [Chen et al., 2021; He et al., 2022; Radford et al., 2021; Ye et al., 2024], we develop an objective-gap-bridging pre-training framework that jointly targets these aspects under the DriftGap diagnostic, driving the initializer toward the bottom-left "sweet spot" with low GapPT and low Drift .
3 Methodology
Episodic FSS predicts a query mask via mask-conditioned prototype matching in a dense feature space, so the initializer should already support boundary-sensitive dense matching and remain stable under few-shot adaptation. We therefore aim to pre-train representations natively compatible with episodic, mask-conditioned prototype matching. Figure 2 illustrates BOG-PRETRAIN, grouping objectives by targeted mismatches to clarify global, local, and geometric interactions. We next formalize the episodic quantities defining a good initializer, then present the three components following the structure in Fig. 2.
Setup and notation. Given an image-report pair (Ii,Ri), the vision encoder EV produces dense features Fi ∈ RC×Hf×Wf and a pooled embedding vi ∈ Rd , while the text encoder ET produces a global embedding ti ∈ Rd and token embeddings Ti = {Ti,l}Ll=1 . We use cosine similarity sim(·, ·) and ℓ2 normalization; unless specified, weighting signals are treated as constants (stop-gradient).
3.1 Bridging theObjectiveGap: Episodic Diagnostics and Learning Objectives
Episodic FSS predicts a query mask via mask-conditioned prototype matching in a dense feature space. From this viewpoint, a good initializer should (i) enable accurate dense matching before any adaptation and (ii) require only lightweight representation change under few-shot finetuning. We instantiate these desiderata as intrinsic preadaptation misalignment GapPT and adaptation-induced feature change Drift (Fig. 1), and use them to organize the learning objectives of BOG-PRETRAIN.
Mask-conditioned similarity map. Given a query image with dense features F and a binary foreground mask M (at image resolution), we sample Q points {pj}Qj=1 from M and compute an averaged similarity heatmap:
where ˆ F(·) denotes ℓ2-normalized features and sim(·, ·) is cosine similarity.
Objective Gap (GapPT) and its decomposition. To avoid threshold tuning (which can be dataset-, class-, and episodedependent and introduces an extra hyperparameter), we binarize the heatmap by a size-matched top-k rule, where k = |M|. This threshold-free binarization controls the predicted foreground size and focuses the evaluation on the ranking quality of the similarity map. Let ˆM = TopK(S, |M|) keep the top-|M| pixels of S. We define the pre-training alignment gap as
To localize the mismatch, we split M into an interior region and a boundary band using morphology at image resolution: Min = Erode(M, r) and Mbd = Dilate(M, r) -Min. We then measure region-specific gaps as
Here Gapin reflects semantic coherence inside the target region (prototype reliability), while Gapbd reflects boundarysensitive dense separability for precise delineation.
Feature Drift (adaptation cost). Let F pt and F ft be the dense features of the same query image extracted by the pretrained backbone and the few-shot adapted backbone, respectively. We quantify the adaptation-induced change as the mean cosine distance over spatial locations:
where N = HfWf . Low Drift indicates a stable episodic metric geometry, enabling effective adaptation without large representation re-organization.
Learning objectives guided by the episodic lens. The above quantities clarify what an initializer must provide for episodic dense matching: reliable semantics (low Gapin), boundary-sensitive structure (low Gapbd), and a stable metric geometry (low Drift). Following the roadmap in Fig. 2, we next introduce three components that target these properties from complementary angles: reliability-aware global alignment (§3.2), boundary-aware local modeling (§3.3), and dual consistency regularization (§3.4).
3.2 Reliability-GatedGlobal Alignment for Reducing Interior Gap
Reliability-gated global alignment. As analyzed in §3.1, a large interior gap (Gapin) indicates insufficient semantic coherence inside the target region, which weakens prototype reliability even before episodic adaptation. Paired reports can inject global semantics to tighten this coherence, but clinical narratives are often noisy, incomplete, or only partially relevant; enforcing uniform image-report alignment can therefore propagate misleading gradients and distort the semantic anchors that prototypes depend on. We address this by making global alignment selective: each image-report pair contributes proportionally to its estimated reliability.
Concretely, for each pair (Ii,Ri) we compute a reliability score γi ∈ [0, 1] by fusing complementary signals of alignment confidence, linguistic coherence (via an auxiliary MLM signal), report informativeness, and batch-wise consistency:
where Z(·) denotes standardization, and pi, mi, ri, ci are the image-text cosine similarity, MLM token-prediction confidence, TF-IDF report informativeness score, and batchwise prototype consistency, respectively. We stop gradients through γi so that the gate only modulates optimization.

We then re-weight a standard symmetric image-text contrastive objective by γi:
where LdITC (i) is the standard InfoNCE term for direction d and sample i, and sg(·) denotes stop-gradient. By attenuating unreliable pairs, the global semantic geometry becomes less sensitive to report noise, yielding more reliable prototype anchors and directly reducing Gapin.
3.3 Local Structural Modeling via SemanticGuided Masked Reconstruction
Semantic-guided masked reconstruction. A high boundary gap (Gapbd) in §3.1 indicates that dense features are not sufficiently boundary-discriminative for episodic delineation. Masked reconstruction can strengthen local structure, but uniform masking tends to allocate learning to generic textures rather than boundary-critical regions. We instead make reconstruction spatially selective, concentrating supervision on edge- and semantics-informative locations to sharpen boundary sensitivity.
Text-conditioned semantic relevance map. At feature resolution, we compute a semantic relevance map Si ∈ [0, 1]Hf×Wf by correlating dense visual features with informative report tokens. Let ϕv(·) and ϕt(·) be lightweight projections, and Ki denote tokens whose TF-IDF weight exceeds the per-report median. We define
followed by per-image normalization to [0, 1]. Text features are detached when forming Si, so the map serves as a masking prior rather than an additional supervision target.
Edge-semantic fusion with reliability-gated guidance. We compute an edge prior Ei ∈ [0, 1]Hf×Wf from image gradients and fuse it with semantics as Wi = (1 - β)Ei + βSi. Crucially, we gate this guidance by the global reliability γi from §3.2: when reports are unreliable, text-guided masking should not shape local structure; when reports are reliable, reconstruction should focus on boundary- and semantic-rich regions. Given a random/block mask M blk i and a curriculum ηt ∈ [0, 1] increasing over training, we form a soft mask
Masked reconstruction objective. Let ˆ yi(u) and yi(u) be the prediction and target at location u. We apply a standard reconstruction loss on masked regions, aggregated by the soft mask:
When γi is high, masking concentrates on Wi and forces recovery of edge/semantic details; when γi is low, it reverts to M blk i . This reliability-gated, boundary-aware reconstruction directly targets Gapbd by sharpening boundary-sensitive dense separability.
3.4 Dual Consistency Regularization for Stabilizing Metric Geometry
Reducing Gapin and Gapbd improves intrinsic matchability; to further suppress adaptation-induced drift (Drift), we introduce Dual Consistency Regularization that enforces stable metric geometry via complementary prototype- and instancelevel constraints.
Prototype-level consistency (ProtoNCE). We maintain a prototype bank {ck}Kk=1 in the text embedding space, capturing semantic modes inferred from reports. Each sample is assigned to its nearest prototype in text space, k(i) = argmaxk sim(ti, ck); prototypes are updated via EMA with momentum m=0.97 outside the computational graph, so a single noisy text embedding contributes only ∼3% per step and is further diluted by batch averaging. We then pull the visual embedding vi toward its assigned prototype while pushing it away from others:
This encourages compact semantic clusters and reduces the degrees of freedom of the embedding space, yielding a more stable episodic metric.
Instance-level consistency (SameImg). When optimizing multiple objectives (global alignment, local reconstruction, prototype consistency), the same image may receive conflicting gradients. We directly enforce that embeddings of the same image produced under different views/pathways remain consistent. Let v(a) i and v(b) i be two pooled embeddings of the same image (e.g., from different augmentations or objective pathways), we apply a cosine pull with stop-gradient:
where ˆ v denotes ℓ2-normalized embeddings. This term suppresses cross-objective interference by forcing a unified representation for the same content.
Overall effect on Drift. ProtoNCE compacts the semantic geometry, while SameImg aligns the optimization signals across objectives/views. Together, they yield a tight and consistent metric space, which substantially reduces Drift during few-shot adaptation.
3.5 Overall Objective and Conceptual Summary
Overall objective. We jointly optimize all components of BOG-PRETRAIN with:
where
We optionally add λmlmLMLM to regularize the text encoder and to provide the linguistic-coherence cue in Eq. (5).
Conceptual summary under the Drift-Gap lens. BOGPRETRAIN is organized around the episodic diagnostics in §3.1. The reliability-gated global alignment LG-ITC makes semantic supervision selective under noisy reports, improving interior coherence and lowering Gapin. The semanticand edge-guided masked reconstruction LSG-MIM concentrates local supervision on boundary-critical regions, sharpening dense separability and lowering Gapbd. Finally, dual consistency regularization (LProto and LSI) stabilizes the metric geometry by enforcing compact semantics and suppressing cross-objective/view interference, which directly reduces Feature Drift during few-shot adaptation.
Together, these objectives align the pre-trained representation with the demands of episodic, mask-conditioned matching, driving the initializer toward the low-gap, low-drift "sweet spot" in Fig. 1.
4 Experiments
4.1 Experimental Setup
Pre-training data. We pre-train on MedPix 2.0 [Siragusa et al., 2025], a comprehensive multimodal archive containing ∼59K images paired with structured clinical case reports. The rich linguistic context in this dataset provides diverse semantic supervision, which is critical for optimizing our Reliability-Gated Alignment module.
Downstream evaluation. We evaluate on five benchmarks [Cheng et al., 2015; Al-Dhabyani et al., 2020; Byra et al., 2020; Jha et al., 2020; Chowdhury et al., 2020; Rahman et al., 2021; Gong et al., 2021]. Following MedCLIPSAMv2 [Koleilat et al., 2025], we adopt their splits for Brain, Lung, and Breast tumors. Notably, Breast Tumor adopts a cross-dataset setting (train on BUSI [Al-Dhabyani et al., 2020], test on UDIAT [Byra et al., 2020]). For Thyroid [Gong et al., 2021], we use the official split, and for Kvasir-SEG [Jha et al., 2020], a random 70/30 partition.
Architecture and protocol. We use an ImageNet-initialized Swin-S [Liu et al., 2021] with an ASPP head [Chen et al., 2017]. Results are reported as mean Dice and HD95 over 1,000 episodes under 1/4/16-shot settings. We pre-train for 200 epochs using AdamW (lr = 5e-4 , weight decay 0.05, batch size 128); total cost is ∼3.7 GPU·h on 1×RTX4090 with 62.96M parameters (≈1.7× the wall-clock of a CLIP baseline on the same backbone). The text encoder is discarded after pre-training, so inference cost matches an imageonly Swin-S.
Diagnostic metrics. To probe pre-training quality beyond end-task scores, we report (i) Objective Gap (Gapin/Gapbd) that decomposes intrinsic misalignment into semantic coherence (Interior) and boundary delineation (Boundary) without adaptation, and (ii) Feature Drift measured by cosine distance between pre-trained and adapted prototype features after few-shot support.
4.2 Main Results: Comparison with SOTA
Table 1 reports few-shot segmentation results (1/4/16-shot). In line with our Objective Gap formulation, we interpret these gains through the intrinsic dense-matching misalignment and adaptation cost. As summarized in Table 2 and visualized in Fig. 1, BOG-PRETRAIN moves the initializer toward the desired bottom-left regime: it achieves the lowest GapPT before adaptation and the lowest Drift during adaptation among all compared methods, confirming that the initializer is both intrinsically matchable and geometrically stable without requiring costly representation re-organization.
The downstream improvements align with the decomposed gap analysis established in §3.1 and validated in §4.3. First, higher Dice indicates more coherent prototype anchors, consistent with a reduced interior semantic gap (Gapin): by down-weighting unreliable report semantics, the pre-trained embedding becomes less sensitive to noisy/global text, leading to stronger overlap across modalities and annotation settings (e.g., large Dice gains on Kvasir and the crossdataset Breast Tumors benchmark). Second, we emphasize HD95 because it reflects boundary adherence that Dice can miss; our boundary-aware pre-training reduces the boundary gap (Gapbd), which is most evident on irregular structures (e.g., Kvasir shows a pronounced HD95 drop), matching the boundary-gap trends in §4.3.
| Few-shot | Method | Brain Tumors | (n=600) Breast Tumors (n=113) | Kvasir (n=300) | Lung X-ray (n=957) | Thyroid (n=614) | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Dice ↑ | HD95 ↓ | Dice ↑ | HD95 ↓ | Dice ↑ | HD95 ↓ | Dice ↑ | HD95 ↓ | Dice ↑ | HD95 ↓ | ||
| 16-shot | SSL-ALPNet UniverSeg MedCoSS Ours | 43.0531.53 50.6736.07 56.3734.15 58.2827.90 | 68.38116.85 79.79125.36 79.5473.00 50.56128.63 | 49.3225.42 64.3625.30 67.4725.86 70.3222.01 | 33.0922.84 34.1530.96 88.0195.35 23.9925.12 | 53.8524.77 47.6324.38 43.5918.55 79.8118.25 | 70.3311.84 42.1917.28 108.7786.01 34.6529.79 | 83.506.29 90.967.47 91.716.30 93.465.73 | 12.7112.51 16.8216.36 11.7316.16 9.2710.15 | 40.2623.97 50.7225.02 34.6715.01 64.8326.39 | 65.2139.25 34.3816.58 202.89131.48 38.1646.33 |
| 4-shot | SSL-ALPNet UniverSeg MedCoSS Ours | 34.1436.70 38.5833.94 44.0626.76 46.6029.96 | 107.47156.02 73.42120.92 142.8479.10 64.54134.15 | 41.8132.50 36.8525.73 53.1728.50 59.3526.28 | 77.8567.58 60.4872.60 136.2590.43 51.8769.97 | 40.2225.94 42.1923.30 33.7614.96 73.7718.74 | 76.1726.34 43.5516.66 141.4297.02 38.2728.28 | 74.766.12 86.4410.03 87.6312.92 90.125.71 | 19.3213.41 20.5718.64 24.9223.06 12.2312.09 | 36.4626.44 37.9425.68 20.7615.20 51.4821.67 | 78.2439.18 49.0018.32 236.91114.23 57.1233.21 |
| one-shot | SSL-ALPNet UniverSeg MedCoSS Ours | 12.2828.55 13.0320.31 15.1417.07 16.8526.25 | 294.45264.31 290.83273.57 222.1447.10 276.84241.94 | 34.9330.73 20.1621.43 30.4324.69 47.6730.74 | 155.43182.06 132.31113.04 171.2598.09 109.70187.14 | 30.7027.19 23.0219.71 29.3717.28 60.3019.74 | 83.5430.97 43.7617.02 209.92103.19 63.3031.24 | 64.656.63 77.7211.50 80.9510.58 86.326.19 | 28.0410.17 23.9116.78 34.3317.23 17.1511.00 | 37.7419.32 36.1619.01 19.9314.55 46.9022.04 | 84.3146.38 36.2914.30 249.21119.70 55.7526.67 |
| sup. | nnU-Net | 87.0613.29 | 12.0315.91 | 80.4022.04 | 28.8015.29 | 89.5614.75 | 30.6626.26 | 98.151.36 | 16.625.91 | 83.7016.67 | 27.3043.75 |
| Method | Drift ↓ | GapPT ↓ |
|---|---|---|
| MoCo v3 [Chen et al., 2021] MAE [He et al., 2022] CLIP [Radford et al., 2021] SSL-ALPNet [Ouyang et al., 2020] UniverSeg [Butoi et al., 2023] MedCoSS [Ye et al., 2024] Ours (BOG-PRETRAIN) | 0.4480.045 0.4630.053 0.2440.021 0.5230.023 0.2330.034 0.1550.031 0.0520.012 | 0.3150.043 0.7040.086 0.2890.086 0.6460.171 0.2630.042 0.4390.074 0.2560.035 |
We note that on Brain Tumors (1-shot) the HD95 improvement is less consistent. With a single support mask and highly irregular tumor contours, boundary refinement remains strongly support-dependent and HD95 is sensitive to small outlier regions, a known challenge even for supervised segmenters, while BOG-PRETRAIN still yields the best Dice, indicating more reliable localization under extreme label scarcity. Finally, the gap to nnU-Net reflects the inherent cost-performance trade-off between fully-supervised dense annotation and few-shot generalization: our goal is to improve the efficiency frontier under scarce supervision, and BOG-PRETRAIN consistently advances both overlap and boundary quality among few-shot methods, making it a strong candidate for annotation-scarce clinical scenarios.
4.3 MechanismAnalysis: Decoupling the Gains
To move beyond performance tables and interpret why our method works, we leverage the proposed diagnostic metrics to decouple the contributions of Global, Local, and Consistency modules.

1. Spatially Decoupled Improvements (Global vs. Local). As visualized in Figure 3, the ablation reveals a clear functional separation: Reliability-Gated Alignment delivers a large reduction in Gapin, confirming that global contrastive learning aggregates object-interior pixels into coherent semantic clusters; once Gapin saturates, adding SG-MIM triggers a secondary drop specifically in Gapbd, proving the local objective captures high-frequency boundary details overlooked by global objectives. Figure 4 further validates this via strong correlations (r>0.9) between Gapin and Dice and between Gapbd and HD95, suggesting that the two diagnostic axes are complementary and neither alone suffices to predict overall segmentation quality.
| Objective | Dice ↑ | HD95 ↓ | Gapin ↓ | Gapbd ↓ | Drift ↓ |
|---|---|---|---|---|---|
| MoCo v3 | 63.25 | 46.00 | 0.33 | 0.79 | 0.448 |
| MAE | 65.33 | 38.73 | 0.45 | 0.71 | 0.463 |
| CLIP | 64.61 | 49.99 | 0.30 | 0.85 | 0.244 |
| Ours | 75.24 | 29.37 | 0.28 | 0.69 | 0.052 |
| Variant | Dice ↑ | HD95 ↓ | Gapin ↓ | Gapbd ↓ | Drift ↓ |
|---|---|---|---|---|---|
| Full (G+L+C) | 75.24 | 29.37 | 0.28 | 0.69 | 0.052 |
| w/o Global | 72.06 | 34.48 | 0.31 | 0.70 | 0.101 |
| w/o Local | 70.29 | 43.23 | 0.27 | 0.76 | 0.147 |
| w/o Cons. | 72.72 | 34.49 | 0.32 | 0.74 | 0.215 |

2. Efficiency and Stability (The Role of Consistency). Projecting models onto the Drift-Gap plane (Fig. 5) reveals an orthogonal two-phase trajectory: Phase 1 (Global + Local) drives a vertical descent that closes the Gap, while Phase 2 (Consistency) drives a horizontal shift that reduces Drift by over 80% (from ∼0.48 to 0.08) without further changing Gap, indicating that the two improvement axes are largely independent. This shows that consistency constraints do not merely fine-tune accuracy but fundamentally restructure the feature space to resist few-shot adaptation shifts, enabling effective generalization even under extreme label scarcity.
4.4 Ablation Studies
Table 3 links end-task performance to our decomposed Objective Gap. Compared with generic SSL/MIM/VLP objectives, BOG-PRETRAIN achieves the best Dice/HD95 while lowering both Gapin and Gapbd, indicating improved intrinsic matchability for mask-conditioned dense prototype matching. Notably, BOG-PRETRAIN also yields the lowest Drift, suggesting that its embedding geometry requires minimal re-organization during few-shot fine-tuning.

Table 4 attributes improvements to specific components under the Drift-Gap lens. Removing Global increases Gapin (0.28→0.31) and reduces Dice (75.24→72.06), consistent with reliability-gated alignment protecting prototype anchors from noisy report semantics. Removing Local markedly increases Gapbd (0.69→0.76) and causes the largest HD95 degradation (29.37→43.23), confirming that boundary-aware structural modeling is essential for closing the boundary gap and sharpening contours. Finally, removing Consistency produces the largest Drift increase (0.052→0.215) with comparatively smaller gap changes, showing that consistency regularization primarily stabilizes episodic metric geometry rather than merely improving intrinsic alignment.
5 Conclusion
We proposed BOG-PRETRAIN, a unified pre-training framework that bridges the objective gap between representation learning and episodic few-shot medical segmentation. BOGPRETRAIN combines (i) reliability-gated image-text alignment to mitigate noisy reports, (ii) semantic- and edge-guided masked reconstruction to enhance boundary-sensitive structure, and (iii) consistency regularization to stabilize episodic metric geometry. Experiments on five public benchmarks show consistent improvements over strong baselines in both Dice and HD95, especially in low-shot regimes where labels are scarce. Moreover, our Drift-Gap diagnostics and mechanism analyses show that Gapin, Gapbd, and feature drift decrease step-wise with each component and correlate strongly with downstream performance. We hope BOG-PRETRAIN encourages objective-driven pre-training designs that narrow the pre-training-to-few-shot segmentation mismatch for accurate and stable label-efficient medical segmentation.
Acknowledgments
This work was supported by the Shenzhen Science and Technology Program (RCBS20231211090723042).
@inproceedings{ijcai2026p112,
title = {Bridging the Objective Gap: A Unified Pre-Training Framework for Few-Shot Medical Image Segmentation},
author = {Chen, Shoupeng and Miao, Yiming and Peng, Limei and Ho, Pin-Han},
booktitle = {Proceedings of the Thirty-Fifth International Joint Conference on
Artificial Intelligence, {IJCAI-26}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {Diego Calvanese},
pages = {998--1006},
year = {2026},
month = {8},
note = {Main Track},
doi = {10.24963/ijcai.2026/112},
url = {https://doi.org/10.24963/ijcai.2026/112},
}
TY - CPAPER TI - Bridging the Objective Gap: A Unified Pre-Training Framework for Few-Shot Medical Image Segmentation AU - Chen, Shoupeng AU - Miao, Yiming AU - Peng, Limei AU - Ho, Pin-Han T2 - Proceedings of the Thirty-Fifth International Joint Conference on Artificial Intelligence, IJCAI-26 PB - International Joint Conferences on Artificial Intelligence Organization PY - 2026 SP - 998 EP - 1006 DO - 10.24963/ijcai.2026/112 UR - https://doi.org/10.24963/ijcai.2026/112 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: