{"id":"201750c7-6b25-4b69-8eae-decc0556660e","arxiv_id":"2411.10136","paper_version":1,"verdict":"CONDITIONAL","confidence":"HIGH","novelty_score":6.0,"correctness_risk":"medium","formal_verification":"none","parameter_count":6,"one_line_summary":"CoSAM improves domain generalization in 2D medical image segmentation by using a trained error decoder to correct SAM's prompt-free coarse masks and cyclically refining predictions with point, box, and mask prompts.","lead":"This paper introduces CoSAM, a method that makes SAM self-correcting for 2D medical image segmentation under domain shift. It first generates a coarse mask without prompts, trains a decoder to predict where that mask is wrong, and then feeds corrected masks back as prompts to refine SAM's output iteratively.","discovery_kind":"new_method","skeptic_critique":{"model":"deepseek-v4-flash","headline":"The error-decoder training is internally inconsistent: Eq. (4) feeds the perturbed mask to the decoder, but the error label in Eq. (5)/Alg. 1 is computed from the unperturbed mask, so the decoder cannot learn the mask-dependent error map used in the self-correction loop.","rationale":"The reader identified the error decoder's generalization to unseen domains as the weakest assumption. I agree that this module is critical, but I find a more concrete and load-bearing problem: the training objective for the error decoder is internally inconsistent. Equations (3)-(5) and Algorithm 1 state that the decoder input is the perturbed mask ˆyp while the error label is computed from the unperturbed mask ˆy. This mismatch makes the described learning task ill-posed and incompatible with the inference-time use of the decoder in Algorithm 2, where the input is the current mask and the output must depend on that mask. If the implementation follows the text, the decoder would learn to ignore the mask input, breaking the self-correcting loop. If the implementation deviates from the text, then the paper's description is incorrect and the reported results cannot be reproduced from the given information. In either case, the central claim that CoSAM performs self-correction via a generalized error decoder is not established by the manuscript. This does not necessarily falsify the empirical result, but it makes the method as described unsupported. The reader's verdict of CONDITIONAL remains appropriate, now conditioned on resolving this internal inconsistency rather than only on code availability or error bars. I therefore keep the verdict unchanged but emphasize that the condition is more specific and more urgent.","tokens_in":13573,"tokens_out":6156,"duration_ms":63150,"concrete_test":"Re-implement the prostate-training loop exactly as written: input Pd(ˆyp) to the error decoder but supervise with e = XOR(ˆy, y). Then change only the label to e = XOR(ˆyp, y) and retrain. Compare Table 1 average DSC and the ablation gain of Le from Table 3. If the literal description fails to reproduce the reported 78.41 average, or if the corrected-label version changes the Le contribution substantially, the published results do not support the self-correction claim as stated.","verdict_should_be":"UNCHANGED","load_bearing_attack":"Section 4.3 defines the error-decoder input as the perturbed binarized mask ˆyp (Eq. 4), yet the error-map label e is computed as XOR(ˆy, y), i.e., errors of the unperturbed coarse mask (text after Eq. 4; Algorithm 1, line 9). This is an internal inconsistency: the decoder is never trained to predict errors for the mask it actually receives. During training the mask input is an independent Bernoulli-flipped version of the coarse mask, while the supervision is tied to the original coarse mask; therefore the decoder is discouraged from using the mask input and cannot learn the conditional mapping required at inference. In Algorithm 2, the decoder receives the current (unperturbed) mask and is expected to produce error maps that depend on that mask. If the text is followed literally, the error map would be a nearly mask-independent image prediction, which contradicts the claimed iterative-refinement behavior and undermines the central self-correction mechanism. A likely explanation is a typo in the paper, but as written the method is unreproducible and the reported contribution of Le in Table 3 cannot be attributed to genuine error correction. This concern is more fundamental than the appearance-shift concern raised in the reader's verdict, because it affects the internal consistency of the proposed training objective regardless of domain shift.","agreement_with_reader":"partial"},"referee_report":{"model":"deepseek-v4-flash","summary":"The paper proposes CoSAM, a SAM-based method for domain generalization in 2D medical image segmentation. CoSAM first produces a coarse mask with SAM in a prompt-free manner, then uses a learned error decoder to predict an error map between the coarse mask and the ground truth, and corrects the mask accordingly. The corrected mask and a set of diverse prompts (point, box, mask) are fed back into SAM's mask decoder, and this refinement is repeated for T iterations with an early-stop mechanism. The method is evaluated with leave-one-domain-out experiments on prostate MRI segmentation (six domains) and joint optic disc/cup segmentation (four domains), reporting average DSC improvements over five SAM-based baselines.","tokens_in":13886,"tokens_out":7408,"duration_ms":66353,"significance":"If the reported results are reproducible, CoSAM contributes a conceptually simple way to leverage SAM's prompt-based design without requiring a prompt generator or manual prompts, addressing a real need in clinical deployment under distribution shifts. The use of a dedicated error decoder to guide iterative refinement is a sensible idea, and the reported improvements over multiple baselines on two benchmarks are encouraging. However, the verification is weakened by the absence of statistical significance tests and by an internal inconsistency in the error-decoder training objective described below.","major_comments":[{"comment":"The error decoder receives the perturbed mask ˆyp as input but is supervised with the error map e = XOR(ˆy, y) of the unperturbed coarse mask. At inference (Algorithm 2, line 7) the decoder receives the unperturbed current mask and is expected to predict its error map. As written, the training objective teaches the decoder to produce error maps for a mask it does not see, so the decoder cannot learn the conditional mapping required for self-correction. This internal inconsistency undermines the attribution of the Le contribution in Table 3 and makes the method unreproducible. The authors likely meant to compute e = XOR(ˆyp, y) or to feed the unperturbed mask in Eq. (4); either way the manuscript must be corrected and the experiments rerun.","section":"Section 4.3, Eq. (4)-(5), Algorithm 1 lines 7-9"},{"comment":"No standard deviations, confidence intervals, or significance tests are reported for any DSC value, and the reported improvements over the best baselines are modest (average DSC gains of 1.64 and 1.72 points on the two tasks). Since the main claim is superiority over existing methods, the absence of repeated-run statistics makes it difficult to judge whether the improvements are stable. Please report mean and standard deviation over at least three runs, and ideally paired significance tests.","section":"Tables 1-5"},{"comment":"The perturbation used to train the error decoder acts only on the binary mask, not on the image appearance. Because the decoder also receives image embeddings E(x) as input, the domain shift in image statistics (scanner/protocol variations) is not simulated, so the claim that the decoder is 'generalized' across image domains is not directly supported. The authors should provide evidence that the error decoder maintains accuracy on target domains, for example by reporting error-map quality or by ablating the perturbation under image-level augmentation.","section":"Section 4.3, Eq. (3)"}],"minor_comments":[{"comment":"The weighted BCE is written as Le(˜e, e) = ωe log(˜e) + (1− e) log(1− ˜e), which is ambiguous about whether ω multiplies e and where the minus sign is. Please write the standard form Le = −[ω e log(˜e) + (1−e) log(1−˜e)].","section":"Eq. (5)"},{"comment":"The baseline 'SAM' is described as 'fine-tuning SAM with the full image size as box prompts'; this conflicts with the earlier description of prompt-free methods. Please clarify the exact prompting configuration of the SAM baseline.","section":"Section 5.3"},{"comment":"The rows for Random-K and Top-K contain formatting artifacts (font-size shift) in the submitted PDF; please ensure the table renders uniformly.","section":"Table 5"},{"comment":"References [5] and [6] are the same paper (Chen et al., 'Treasure in distribution...'); duplicate bibliography entries should be merged.","section":"References"},{"comment":"The definition of nw as 'the number of correct and error points in ˜e' is contradictory; from the equation nw should refer only to error points and nr to correct points. Please fix the wording.","section":"Section 4.3, text after Eq. (6)"},{"comment":"The early-stop logic in Algorithm 2 is described only in the caption of Figure 2; consider stating it explicitly in the main text of Section 4.5 for clarity.","section":"Section 4.5 and Algorithm 2"}],"recommendation":"major_revision","confidential_remarks":"The paper has a plausible idea and initially suggestive results, but the training-inference mismatch in the error decoder is a serious correctness issue that must be resolved. I recommend requesting a corrected version with rerun experiments, error bars, and a clear statement of the error-decoder supervision. The authors should also double-check the duplicate reference and the SAM baseline description."},"author_rebuttal":null,"desk_editor":{"model":"deepseek-v4-flash","letter":"Colleague,\n\nQuick take: CoSAM is a reasonable new combination — SAM coarse masks, a SESV-style error decoder that corrects those masks, and iterative prompt feedback. The empirical work is real: leave-one-domain-out on prostate MRI and fundus OD/OC, with ablations on losses, prompt types, and hyperparameters. Average DSC gains of 1.6–1.7 over the best baselines are modest but consistent. The paper is clearly written and the related work is handled fairly.\n\nHowever, there is a load-bearing inconsistency in the training objective. Section 4.3 says the error decoder receives the perturbed mask ŷ_p (Eq. 4), but the error-map label e is computed as XOR(ŷ, y), i.e., errors of the unperturbed mask (text after Eq. 5; Algorithm 1, lines 7 and 9). If that is literal, the decoder is trained to predict errors for one mask while being shown a different, random-perturbed mask. It cannot learn the conditional mapping it is supposed to use at inference, and the contribution of the error decoder in Table 3 becomes unexplained. This looks like a typo — perhaps the label should be XOR(ŷ_p, y) — but as written the method is unreproducible.\n\nThe stress-test note calls this more fundamental than the appearance-shift concern, and I agree. The perturbation only alters the mask, not the image, so even a fixed version may overstate robustness to scanner/protocol shifts. Still, the idea of self-correction via error decoding is plausible and the rest of the pipeline could work if the training target is corrected.\n\nOther soft spots are the absence of error bars or significance tests — with gains around 1.6 DSC, run-to-run variance matters — and no code release. The citation pattern looks fine.\n\nWho is this for? Anyone working on SAM-based medical image segmentation or domain generalization. It deserves a serious referee: the experiments are extensive and the core idea is worth exploring, but the paper needs major revision, a clarification of Eq. (3)–(5) / Algorithm 1, and ideally code.\n\nMy recommendation: send it to peer review with a request for a careful check of the training loop and an explicit statement of what the error decoder actually learns. If the inconsistency is just a typo, a corrected version could be acceptable.\n\n—","headline":"The self-correcting SAM idea is promising and the experiments are solid, but a training-input/supervision mismatch in the error decoder (likely a typo) needs to be fixed before the central claim holds.","tokens_in":14410,"tokens_out":2940,"would_cite":false,"duration_ms":28197,"reading_group":"maybe","serious_thinker":"no","would_accept_peer_review":true},"rs_alignment":null,"lean_confirmation":null,"pith_extraction":{"msc":[],"pacs":[],"model":"deepseek-v4-flash","headline":"Self-correcting SAM improves medical image segmentation on unseen domains.","keywords":["domain generalization","medical image segmentation","Segment Anything Model","self-correcting segmentation","error decoder","prompt-based refinement","prostate MRI","optic disc and cup segmentation"],"falsifier":"Take a target-domain image whose scanner or protocol never appears in training, compute CoSAM's predicted error map, and compare it with the true error map defined as the XOR of the coarse mask and the clinician label; if the self-correction loop's improvement over the coarse mask disappears whenever the predicted error map misses a large fraction of true error pixels, the core claim fails.","tokens_in":13403,"feed_emoji":"🩺","tokens_out":6247,"duration_ms":57860,"temperature":0.7,"pith_summary":"CoSAM makes the case that a Segment Anything Model (SAM) can improve cross-domain medical image segmentation by correcting its own outputs rather than relying on a learned prompt generator. The paper's proposal is to generate a coarse mask from SAM without prompts, train a generalized error decoder to mark which pixels of that mask are wrong, flip those pixels to produce a corrected mask, and then use point, box, and mask prompts derived from the corrected mask to prompt SAM again in an iterative loop. Under leave-one-domain-out training on prostate MRI (six domains) and optic disc and cup segmentation from fundus photos (four domains), the paper reports average Dice scores of 78.41 and 68.57, above five SAM-based baselines. A sympathetic reader would read the contribution as a mechanism for making SAM's prompt-based advantage available automatically at test time, without manual prompts.","feed_headline":"Self-correcting SAM outdoes prompt-generator rivals on new domains","feed_subtitle":"No prompt generator needed: CoSAM corrects SAM's own coarse masks and re-prompts it iteratively.","key_machinery":"The load-bearing component is the generalized error decoder, a U-Net decoder that takes the concatenation of SAM's image embedding and mask embeddings from SAM's dense prompt encoder, which is reused as a mask encoder, and predicts an error map in which correct pixels are 0 and error pixels are 1. It is trained with random Bernoulli flips of the binary coarse mask and a class-balanced weighted loss, which is meant to simulate distribution shift and clinician correction. The self-correcting loop, driven by corrected masks and diverse point, box, and mask prompts, is what turns the predicted error map into improved segmentation.","core_discovery":"CoSAM claims that coarse masks produced by a prompt-free SAM are a sufficient starting point for prompting, provided the model can learn to correct them. During training, random Bernoulli perturbations of the coarse mask make the error decoder more robust to distribution shifts in the error-prediction task. At inference, corrected masks are converted into three prompt types—top-K point prompts from error locations, a box prompt from the largest foreground-connected region, and a mask prompt from the corrected mask—and fed back into SAM. The loop repeats for up to T iterations and stops early when the predicted number of error points stops falling. CoSAM reports that this loop outperforms SAM and five SAM-based baselines on both benchmark tasks.","pith_inferences":["Nothing in the method is organ-specific, so the same correct-then-reprompt cycle should transfer to other promptable segmentation backbones and other 2D medical targets, a claim the paper leaves untested.","Because the perturbation used to train the error decoder only flips mask pixels, real scanner-level appearance shifts remain the likeliest failure mode; adding image-level augmentations on top of the mask perturbation would be a direct test of that boundary.","The early-stop rule could be reinterpreted as a confidence signal and used to reject unreliable corrections rather than simply halting refinement, an extension the paper does not explore."],"forward_implications":["A test-time pipeline can avoid manual prompts and separate trainable prompt generators, using SAM's own coarse mask as the seed.","Predicted error maps can serve as a quality monitor, since the refinement loop stops when the estimated number of error points would increase.","Combining point, box, and mask prompts gives more consistent gains than any single prompt type in the reported ablations.","On the two benchmarks, the improvement is concentrated in average performance across leave-one-domain-out settings rather than in every individual source domain."],"supporting_citations":[{"why":"Supplies the frozen SAM image encoder, prompt encoder, and mask decoder that CoSAM reuses and fine-tunes.","marker":"[20]"},{"why":"Defines the SAM-Adapter baseline that CoSAM compares against on both benchmarks.","marker":"[4]"},{"why":"Defines the SAMed LoRA fine-tuning baseline used as a prompt-free competitor.","marker":"[46]"},{"why":"Defines the DeSAM baseline that decouples prompt encoding from mask prediction.","marker":"[12]"},{"why":"Defines the HSAM hierarchical-decoding baseline used in the comparison.","marker":"[9]"},{"why":"Defines the SAM4Med automatic prompt-generator baseline most directly challenged by CoSAM's design.","marker":"[41]"},{"why":"Provides the six-domain prostate MRI dataset used for the prostate segmentation benchmark.","marker":"[25]"},{"why":"Provides the REFUGE dataset used as domains A and D in the fundus segmentation benchmark.","marker":"[31]"},{"why":"Provides the Drishti-GS dataset used as domain B in the optic disc and cup benchmark.","marker":"[37]"},{"why":"Provides the ORIGA dataset used as domain C in the optic disc and cup benchmark.","marker":"[47]"}],"fun_headline_variants":["CoSAM: SAM fixes its own masks, no prompt generator needed","Self-correcting loop lets SAM adapt to new medical domains","No prompt generator: CoSAM self-corrects SAM's masks iteratively","SAM self-correction loop beats prompt-generator methods on new domains","CoSAM: iterative self-correction makes SAM generalize to new medical domains"],"cache_read_input_tokens":3200,"weakest_assumption_plain":"The load-bearing premise is that an error decoder trained on source images, with random flips applied only to the binary mask and never to image appearance, will predict which pixels of the coarse mask are wrong accurately enough on an unseen target domain to drive useful corrections.","fun_headline_variants_meta":{"raw":{"variants":["CoSAM: SAM fixes its own masks, no prompt generator needed","Self-correcting loop lets SAM adapt to new medical domains","No prompt generator: CoSAM self-corrects SAM's masks iteratively","SAM self-correction loop beats prompt-generator methods on new domains","CoSAM: iterative self-correction makes SAM generalize to new medical domains"]},"model":"deepseek-v4-flash","effort":"low","cost_usd":0.001134,"raw_usage":{"total_tokens":4706,"prompt_tokens":933,"completion_tokens":3773,"prompt_tokens_details":{"cached_tokens":384},"prompt_cache_hit_tokens":384,"prompt_cache_miss_tokens":549,"completion_tokens_details":{"reasoning_tokens":3680}},"tokens_in":549,"tokens_out":3773,"duration_ms":23598,"temperature":1.0,"reasoning_tokens":3680,"cache_read_input_tokens":384,"cache_creation_input_tokens":0},"cache_creation_input_tokens":0},"created_at":"2026-08-12T19:55:04.899534+00:00","model_set":{"reader":"deepseek-v4-flash"},"falsifier":"Take a target-domain image whose scanner or protocol never appears in training, compute CoSAM's predicted error map, and compare it with the true error map defined as the XOR of the coarse mask and the clinician label; if the self-correction loop's improvement over the coarse mask disappears whenever the predicted error map misses a large fraction of true error pixels, the core claim fails.","supporting_citations":[{"cited_title":"Segment any- thing","cited_arxiv_id":null,"evidence_quote":"Supplies the frozen SAM image encoder, prompt encoder, and mask decoder that CoSAM reuses and fine-tunes."},{"cited_title":"Sam-adapter: Adapting segment any- thing in underperformed scenes","cited_arxiv_id":null,"evidence_quote":"Defines the SAM-Adapter baseline that CoSAM compares against on both benchmarks."},{"cited_title":"Desam: Decoupled segment anything model for gen- eralizable medical image segmentation","cited_arxiv_id":null,"evidence_quote":"Defines the DeSAM baseline that decouples prompt encoding from mask prediction."},{"cited_title":"Unleashing the potential of sam for medical adaptation via hierarchical de- coding","cited_arxiv_id":null,"evidence_quote":"Defines the HSAM hierarchical-decoding baseline used in the comparison."},{"cited_title":"Shape-aware meta-learning for generalizing prostate mri segmentation to 9 unseen domains","cited_arxiv_id":null,"evidence_quote":"Provides the six-domain prostate MRI dataset used for the prostate segmentation benchmark."},{"cited_title":"Refuge challenge: A unified framework for evaluat- ing automated methods for glaucoma assessment from fun- dus photographs","cited_arxiv_id":null,"evidence_quote":"Provides the REFUGE dataset used as domains A and D in the fundus segmentation benchmark."},{"cited_title":"Drishti-gs: Retinal image dataset for optic nerve head (onh) segmentation","cited_arxiv_id":null,"evidence_quote":"Provides the Drishti-GS dataset used as domain B in the optic disc and cup benchmark."},{"cited_title":"Origa-light: An online retinal fundus image database for glaucoma analysis and research","cited_arxiv_id":null,"evidence_quote":"Provides the ORIGA dataset used as domain C in the optic disc and cup benchmark."}],"review_version":1}