Segmentor-Guided Counterfactual Fine-Tuning
- The paper introduces Seg-CFT, a method that fine-tunes a HVAE using a frozen segmentation network to generate structure-specific counterfactual images.
- It employs a segmentation-derived measurement loss to enforce agreement between target scalar interventions and predicted anatomical changes.
- Positional Seg-CFT further partitions images into anatomical regions, enabling localized and anatomically coherent counterfactual adjustments.
Searching arXiv for the cited papers to ground the article in the current literature. Segmentor-Guided Counterfactual Fine-Tuning (Seg-CFT) is a method for fine-tuning a pretrained deep structural causal model so that an intervention on a structure-specific scalar variable yields an image whose segmentation-derived measurement matches the target intervention. In the formulation reported for medical imaging, the underlying generator is a hierarchical variational autoencoder (HVAE), and the supervisory signal is supplied by a frozen segmentation network rather than by an external regressor. This design is intended to preserve the simplicity of scalar-valued interventions while producing locally coherent counterfactuals for structures such as lung fields, calcified plaque, non-calcified plaque, or lumen area. A later extension, Positional Seg-CFT, subdivides each structure into anatomical regions and derives independent measurements per region, thereby enabling spatially localized and anatomically coherent counterfactuals without requiring user-defined counterfactual masks (Xia et al., 29 Sep 2025, Xia et al., 22 Mar 2026).
1. Research context and problem setting
Counterfactual image generation has been presented as a tool for controlled data augmentation, bias mitigation, disease modeling, and anatomically interpretable causal analysis. The motivating limitation of earlier counterfactual fine-tuning schemes is that classifier- or regressor-guided objectives are well suited to subject-level interventions such as age, but are insufficient for structure-specific variables such as area measurements. In the reported setting, a frozen regressor can satisfy the intervention objective by exploiting global, spurious cues, for example overall vessel intensity or brightness, rather than by altering the target anatomy itself (Xia et al., 29 Sep 2025).
Seg-CFT addresses that limitation by replacing the external regressor with a frozen segmentor. The segmentor outputs a soft segmentation map, and scalar measurements are recovered by summing pixel-wise class probabilities. The resulting loss directly penalizes disagreement between the target scalar and the segmentation-derived scalar measured on the generated counterfactual. In this way, the fine-tuning signal is tied to the spatial support of the target structure rather than to an arbitrary global predictor (Xia et al., 29 Sep 2025).
A second limitation remained in the original framework. Because each structure was represented by a single scalar measurement, the model could increase or decrease the total area of a structure but could not specify where within the image domain the change should occur. Positional Seg-CFT addresses that issue by partitioning the image into disjoint anatomical regions and imposing region-wise measurement constraints. This suggests a progression from subject-level control, to structure-specific control, and then to within-structure positional control (Xia et al., 22 Mar 2026).
2. Causal and generative formulation
The underlying deep structural causal model is implemented as an HVAE conditioned on low-dimensional parent attributes. Let denote the observed medical image and let be low-dimensional attributes, among which are structure-specific variables such as calcified plaque area (CPA), non-calcified plaque area (NCPA), and lumen area (LA). In the DSCM/HVAE formulation, counterfactual inference proceeds by abduction, action, and prediction:
followed by the intervention
and then prediction through the generator
The base HVAE training objective is the ELBO,
with the encoder, the decoder, and a standard normal prior (Xia et al., 29 Sep 2025).
A central empirical observation is that naively sampling after intervention may ignore the instructed change. Counterfactual fine-tuning remedies this by adding a term that encourages the generated image to encode the intended intervention. In regressor-based CFT, the fine-tuning signal is
0
with 1 frozen. Seg-CFT replaces that regressor with a segmentor-driven measurement (Xia et al., 29 Sep 2025).
3. Segmentor-guided objective, architecture, and training
In Seg-CFT, a frozen segmentation network 2 receives the counterfactual image 3 and outputs a soft mask 4. For a structure 5 in a set 6 of structures of interest, the predicted area is defined as
7
Counterfactual fine-tuning then enforces agreement between the predicted measurement and the target counterfactual scalar. The structure-wise loss is written as
8
where 9 or 0. In the alternative presentation of the same method, the deviation is penalized by mean squared error,
1
In practice, the CFT term is added to the original ELBO, weighted by a hyper-parameter 2,
3
Optionally, if subject-level attributes such as age or sex are also to be preserved, a regressor loss can be added in parallel (Xia et al., 29 Sep 2025).
The reported architecture comprises a generator HVAE with encoder 4 and decoder 5, together with normalizing flows 6 for the low-dimensional variables so that there is an explicit, invertible mapping between noise 7 and attribute 8. The segmentor 9 is a U-Net-style convolutional network; in one description it is Dice-trained and remains frozen during fine-tuning, and in another it is pretrained on ground-truth masks of lumen and plaque, outputting a 0-channel softmax map of size 1, one channel per structure (Xia et al., 29 Sep 2025).
The algorithmic procedure is straightforward. A real image 2 is sampled, its scalar parents 3 are extracted, and a latent code is inferred via 4. A counterfactual parent value 5 is then specified, the image 6 is generated, the predicted mask 7 is computed, and the scalar 8 is measured. The final loss is 9, and 0 are updated by gradient descent. Reported fine-tuning hyper-parameters for the original paper are batch size 1, learning rate 2, number of CFT steps 3, and 4, tuned on the validation set. The same source notes that a moderate 5 such as 6–7 prevents the model from overfitting local changes at the expense of realism, and that early stopping on a held-out counterfactual effectiveness metric helps prevent drift (Xia et al., 29 Sep 2025).
4. Positional Seg-CFT and spatial localization
The key limitation of the original Seg-CFT is that each structure 8 yields a single scalar measurement 9. The model can therefore increase or decrease a global structure-specific quantity, but it cannot choose in which part of the vessel or organ the change occurs. Positional Seg-CFT resolves this by subdividing the image domain into 0 disjoint anatomical regions 1, for example proximal, mid, and distal artery segments. These masks are binary 2 maps that sum to 3 across 4 at each pixel (Xia et al., 22 Mar 2026).
Given a predicted segmentation map 5 for structure 6 on the generated image 7, the region-specific measurement is
8
Instead of a single scalar per structure, one obtains 9 independent scalar measurements, one per region. For an intervention of the form 0, the positional loss becomes
1
Here 2 is the target counterfactual area for structure 3 in region 4, while all other regions’ targets are kept at their factual values. By driving each region’s predicted area toward its target, the generator is encouraged to confine changes to the specified anatomical segment (Xia et al., 22 Mar 2026).
A notable feature of the extension is that no change is required to the HVAE or to the segmentor’s weights. The modification is confined to replacing the global-measurement loss by the region-wise loss, while at training time interventions are sampled independently per region. The overall optimization still jointly updates 5 via gradient descent on 6 plus the original HVAE term (Xia et al., 22 Mar 2026).
5. Empirical evidence
The original Seg-CFT paper reports experiments on chest radiographs and coronary CT angiography (CCTA). For PadChest, the dataset split is 7 train, 8 validation, and 9 test, with images resized to 0. The target structures are left lung area (LLA), right lung area (RLA), and heart area (HA), and segmentation masks are obtained from TorchXRayVision pre-trained U-Nets. For CCTA straightened curvilinear planar reformations, the split is 1 train, 2 validation, and 3 test at 4 resolution, with structures NCPA, CPA, and LA, and masks generated by rasterizing segmented 3D meshes. Pretraining uses standard ELBO training for the HVAE for 5k steps with Adam learning rate 6; segmentors are trained for 7 epochs with Adam learning rate 8 and Dice loss; the Reg-CFT baseline uses a ResNet-18 regressor trained with MSE area regression for 9 epochs at learning rate 0 (Xia et al., 29 Sep 2025).
Effectiveness in the original Seg-CFT experiments is measured by the deviation between the intervened parent 1 and the predicted parent 2 on the generated counterfactual. For chest radiographs, the paper reports mean absolute percentage error. Base DSCM obtains 3 for LLA, 4 for RLA, and 5 for HA; Reg-CFT reduces these to 6, 7, and 8; Seg-CFT reports 9, 0, and 1, respectively. For CCTA plaque and lumen measurements, the reported MAE in mm2 is 3, 4, and 5 for Base DSCM on NCPA, CPA, and LA; 6, 7, and 8 for Reg-CFT; and 9, 00, and 01 for Seg-CFT (Xia et al., 29 Sep 2025).
The positional extension is evaluated on an internal CCTA dataset of straightened curvilinear planar reformations of the left anterior descending artery, at 02 mm resolution and cropped to 03 pixels. Ground-truth masks for lumen, CPA, and NCPA are obtained by rasterizing 3D meshes. The split is 04 training, 05 validation, and 06 testing images, and each image is automatically partitioned into three equal vessel regions—proximal, mid, and distal—along its long axis. Following Monteiro et al. (2023), effectiveness is measured as the absolute error between the target and the segmentor’s predicted area in each region,
07
A well-localized intervention is therefore expected to yield low error in the intervened region and minimal change in the non-target regions (Xia et al., 22 Mar 2026).
Representative quantitative results indicate improved localization. For 08, the reported mid-region error is 09 for No-CFT, 10 for Reg-CFT, and 11 for Pos-Seg-CFT, while the distal off-target error is 12, 13, and 14, respectively. For 15, the distal error is 16 for No-CFT, 17 for Reg-CFT, and 18 for Pos-Seg-CFT; the proximal and mid off-target errors are also reduced to 19 and 20, compared with 21 and 22 for Reg-CFT. The accompanying qualitative comparison for a 23 mm24 CPA intervention reports that Reg-CFT exhibits strong unwanted expansion of calcified plaque in non-target segments and diffuse global brightening, whereas Pos-Seg-CFT confines the added plaque to the intended vessel segment with sharply localized change and no visible artifact elsewhere (Xia et al., 22 Mar 2026).
6. Applications, limitations, and relation to adjacent methods
The reported applications of Seg-CFT include data augmentation, de-biasing datasets, modeling disease, and explainability through direct visualization of anatomical “what if” scenarios. The positional extension adds disease-progression modeling of focal stenoses, targeted augmentation for underrepresented lesion locations, and anatomically interpretable causal analyses centered on localized structural change (Xia et al., 29 Sep 2025, Xia et al., 22 Mar 2026).
Several limitations are explicit. In the original Seg-CFT formulation, the current method intervenes only on a single numeric property, namely area; shape, position, or texture interventions remain future work. The method also assumes independence between multiple structure-specific parents such as NCPA and CPA, and a full causal graph over masks is described as an open challenge. In the positional variant, region masks must be defined a priori, for example along vessel segments, and extremely fine subdivisions, such as fewer than 25 pixels, may challenge the accuracy of segmentation-derived areas (Xia et al., 29 Sep 2025, Xia et al., 22 Mar 2026).
A recurrent misconception is that anatomy-aware counterfactual editing necessarily requires a user to supply hypothetical pixel-level masks. Seg-CFT is specifically framed as avoiding that requirement: the user specifies scalar targets, while the frozen segmentor provides the measurement used in the loss. Positional Seg-CFT preserves that scalar-based design; the regional masks are fixed anatomical partitions used to aggregate the segmentor output, not bespoke counterfactual masks. Another misconception is that regressor-guided fine-tuning is sufficient for structure-specific interventions. The reported evidence argues otherwise: regressors can rely on global spurious cues, whereas segmentation-derived supervision better couples the intervention objective to the target anatomy (Xia et al., 29 Sep 2025, Xia et al., 22 Mar 2026).