{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/arxiv-2605-13688","title":"MedCore: Boundary-Preserving Medical Core Pruning for MedSAM","arxiv_id":"2605.13688","date":"2026-05-13","proceeding":null,"authors":["Cenwei Zhang","Suncheng Xiang","Lei You"],"abstract":"Medical segmentation foundation models such as SAM and MedSAM provide strong prompt-driven segmentation, but their image encoders are still too large for many clinical settings. Compression is also risky in medicine because a model can keep high Dice while losing boundary fidelity. We propose MedCore, a structured pruning framework for MedSAM. The main idea is to preserve two kinds of structures: structures that became important during SAM-to-MedSAM adaptation, and structures that have high boundary leverage. We identify the first type by a dual-intervention score that compares zeroing a group with resetting it to its original SAM weight. We identify the second type by boundary-aware Fisher estimation. We also introduce a boundary leverage principle, which shows that compression-induced boundary displacement is controlled by logit perturbation on the boundary divided by the logit spatial gradient. This principle explains why boundary metrics can degrade even when Dice remains high. On polyp segmentation benchmarks, MedCore reduces parameters by 60.0% and FLOPs by 58.4% while achieving Dice 0.9549, Boundary F1 0.6388, and HD95 5.14 after recovery fine-tuning. It also reaches 86.6% parameter reduction and 90.4G FLOPs with strong boundary quality. Our analysis further shows that MedSAM lies in a head-fragile boundary regime: head-pruning steps have 2.887 times larger 95th-percentile boundary leverage than MLP-pruning steps, and this logit-level effect is consistent with BF1 and HD95 degradation. Our code is available at https://github.com/cenweizhang/MedCore.","url_abs":"https://arxiv.org/abs/2605.13688","url_pdf":"https://arxiv.org/pdf/2605.13688","source":{"archive":null,"snapshot":"2025-07-28","note":"not in the Papers with Code archive (frozen at the snapshot)","row_kind":"graph","title_abstract_authors_date":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)"},"code_links":[],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2605.13688","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2605.13688"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"mentioned_in_github":null,"is_official":null,"provenance":"deterministic:regex_extraction","mentioned_in_paper":null,"url":"https://github.com/cenweizhang/MedCore","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":24},"by_repo_kind":{"found_in_text":{"samples":24,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"2d5b4e5ac88130e4","entry":"apply_head_mask_to_model","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/pruning.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/pruning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2d5b4e5ac88130e4"}},{"code_sha256_prefix":"88b2d46468cf9a33","entry":"apply_mlp_mask_to_model","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/pruning.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/pruning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"88b2d46468cf9a33"}},{"code_sha256_prefix":"bbed6d1a723d39a1","entry":"compute_boundary_f1","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/metrics.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/metrics.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bbed6d1a723d39a1"}},{"code_sha256_prefix":"dd312e008248930c","entry":"compute_boundary_sampling_weights","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/evaluation.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/evaluation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dd312e008248930c"}},{"code_sha256_prefix":"1faef889488ec091","entry":"compute_cascade_stats","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/pruning.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/pruning.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1faef889488ec091"}},{"code_sha256_prefix":"baf80ae7dc5ccf40","entry":"compute_cross_fisher","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/fisher.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/fisher.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"baf80ae7dc5ccf40"}},{"code_sha256_prefix":"97de9bfe5b3e05f1","entry":"compute_diagonal_fisher_boundary_aware","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/fisher.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/fisher.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"97de9bfe5b3e05f1"}},{"code_sha256_prefix":"26d78e051b3db046","entry":"compute_dice","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/metrics.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/metrics.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"26d78e051b3db046"}},{"code_sha256_prefix":"390b8ca528024272","entry":"compute_head_scores","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/scoring.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/scoring.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"390b8ca528024272"}},{"code_sha256_prefix":"c3ff88b7bf97c76a","entry":"compute_iou","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/metrics.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/metrics.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c3ff88b7bf97c76a"}},{"code_sha256_prefix":"bcecb71b17db5fe7","entry":"compute_mlp_neuron_scores","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/scoring.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/scoring.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bcecb71b17db5fe7"}},{"code_sha256_prefix":"94c2f9d0ac628556","entry":"eval_all","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/evaluation.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/evaluation.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"94c2f9d0ac628556"}},{"code_sha256_prefix":"aa3f8bc40bbfd638","entry":"export_compact_model","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/compact.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/compact.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"aa3f8bc40bbfd638"}},{"code_sha256_prefix":"f8aa46dcd86ec93d","entry":"file_sha256","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/utils.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f8aa46dcd86ec93d"}},{"code_sha256_prefix":"43f2aa47c9481875","entry":"load_checkpoint","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/checkpoints.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/checkpoints.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"43f2aa47c9481875"}},{"code_sha256_prefix":"17dadc3fb49927f7","entry":"load_compact_checkpoint","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/compact.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/compact.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"17dadc3fb49927f7"}},{"code_sha256_prefix":"32a9ca5d937d9531","entry":"load_sam_encoder_params","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/scoring.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/scoring.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"32a9ca5d937d9531"}},{"code_sha256_prefix":"94d3f90f149a1f97","entry":"parse_config","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/utils.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"94d3f90f149a1f97"}},{"code_sha256_prefix":"858e877d2f3108c4","entry":"run_epoch","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/training.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/training.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"858e877d2f3108c4"}},{"code_sha256_prefix":"ec89cd9780053c16","entry":"save_checkpoint","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/checkpoints.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/checkpoints.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ec89cd9780053c16"}},{"code_sha256_prefix":"ae45b1e40594e114","entry":"save_compact_checkpoint","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/compact.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/compact.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ae45b1e40594e114"}},{"code_sha256_prefix":"66d6fd877bf3b503","entry":"segmentation_logits","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/training.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/training.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"66d6fd877bf3b503"}},{"code_sha256_prefix":"3326ff201e710fe5","entry":"segmentation_loss","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/training.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/training.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3326ff201e710fe5"}},{"code_sha256_prefix":"11b435db8e74e9a2","entry":"validate_device","repo":"cenweizhang/MedCore","repo_kind":"found_in_text","path":"medcore_pruning/utils.py","file_url":"https://github.com/cenweizhang/MedCore/blob/HEAD/medcore_pruning/utils.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"11b435db8e74e9a2"}}]},"arxiv_metadata":{"licence":"arXiv metadata, CC0 1.0 (https://info.arxiv.org/help/license)","fields":["title","abstract","authors","date"],"primary_category":"cs.LG","source":"arxiv_2026.jsonl"},"syntology_extracted_results":null}