WorksComputer Science
When Reconstruction Is Not Enough: Doubly Robust Counterfactual and Interventional Mediation Analysis with Learned Multimodal Representations
Abstract
Learned representations of high-dimensional multimodal health records are increasingly used to adjust for confounding, yet they are usually trained to reconstruct the data rather than preserve the information that causal identification requires. We study counterfactual outcomes under alternative treatments, including phenotype-specific effects and patient-level counterfactual risk profiles of the kind digital twins provide, and interventional direct and indirect effects under exposure-induced intermediate confounding. We give conditions under which a representation preserves identification and show that interventional mediation is more demanding than counterfactual comparison. We prove that no covariate-only training objective, whether reconstruction, contrastive, or physics-informed, can certify that a representation is sufficient, and that, in a linear structural model, a representation can lose arbitrarily little reconstruction accuracy yet induce arbitrarily large bias. We decompose the error of cross-fitted doubly robust estimators into a first-order representation bias, which neither double robustness nor cross-fitting removes, and a second-order remainder of nuisance-estimation errors, so coverage worsens as the sample size grows when the representation is insufficient. We propose a workflow combining modality-specific variational autoencoders trained outside the estimation sample, cross-fitted doubly robust estimators, locked phenotypes, select-then-confirm pathway analysis, portable representations, and diagnostics for representation insufficiency, exposure leakage, and sensitivity. In simulations, discarding a rare, moderately strong confounder gave indirect-effect intervals with 2% coverage at n = 3,000; reconstruction loss missed the problem, and a simple predictive diagnostic flagged it in every replicate.
Introduction
Electronic health records, biobanks, and participant surveys now describe patients through many data types at once: diagnoses, medications, laboratory values, vital signs, social and behavioral measures, and genomes. Causal questions asked of these data, such as whether a treatment works better for some patients than for others, or how much of an exposure’s effect on a later outcome runs through an early intermediate change, require adjustment for confounding by many of these characteristics simultaneously. A common strategy is to compress the multimodal record into a low-dimensional representation, for example with modality-specific variational autoencoders (VAEs) (Kingma and Welling, 2014), and to use that representation as the adjustment set in downstream causal analyses [7 a]. The appeal is practical: nuisance models with thousands of sparse, correlated, and partly missing features are hard to fit, whereas a handful of learned dimensions is easy to work with.
The difficulty is that a VAE is trained to reconstruct its inputs. Nothing in that objective requires the representation to retain the information that identifies a causal effect, namely information about how the exposure was assigned, how intermediate variables respond, and how the outcome is generated. A variable can matter greatly for confounding while contributing little to reconstruction, for instance a rare diagnosis among hundreds of codes. More generally, good predictive performance does not by itself yield valid causal estimates (Westreich et al., 2020; Naimi et al., 2023). In related settings we found that learned components that predict or reconstruct well can still yield poor causal answers: low nuisance-function prediction error did not identify the better causal estimator [7]; learned exposure mappings with near-identical predictive accuracy implied different spillover effects (Cao, 2026a); and different representation-learning objectives recovered different latent structures from the same data (Cao et al., 2026). For conditional average treatment effects, Melnychuk et al. (2024) showed that low-dimensional representations can induce confounding bias and derived bounds for it.
Mediation analysis is more demanding still. When an exposure affects a confounder of the mediator–outcome relation, natural direct and indirect effects are not identified, and interventional effects are used instead (VanderWeele et al., 2014; Vansteelandt and Daniel, 2017). Their identifying functional involves the exposure mechanism, the distribution of the intermediate confounder, the mediator distribution, and the outcome regression, and efficient estimators combine all of them [1] (Díaz et al. 2021; Díaz et al. 2024). A representation must preserve the information needed by every one of these nuisance functions. Interventional effects also depend on the covariates used to define the random draw of the mediator, so an insufficient representation changes the target itself, not only the estimate.
Representation learning for treatment effects is well developed (Shalit et al., 2017; Louizos et al., 2017; Shi et al., 2019), and recent work characterizes which information in a learned representation suffices for efficient adjustment (Christgau and Hansen, 2024). Deep-learning approaches to mediation include debiased semiparametric estimators (Xu et al., 2022), VAE-based models with hidden confounders (Cheng et al., 2022), VAEs for multi-dimensional and indirectly observed mediators (Jiang et al., 2023), and joint representations of covariates and mediators within cross-fitted estimators of natural effects [3]. These approaches either target natural effects or assume that the learned representation is sufficient. To our knowledge, the consequences of representation insufficiency for interventional effects under intermediate confounding, and practical diagnostics for it, have not been studied.
This paper makes six contributions. First, we give sufficiency conditions under which a learned representation preserves identification of counterfactual means and of interventional effects, and we show that the interventional conditions are strictly more demanding (§ 3.1). Second, we prove that no training objective that depends only on the covariates, including reconstruction, contrastive, and physics-informed objectives, can certify sufficiency (§ 3.1), and, for a linear structural model, we derive the bias of interventional indirect effects induced by an insufficient representation and show that no function of reconstruction error bounds it (§ 3.2). Third, we decompose the error of cross-fitted doubly robust estimators that use a learned representation into a first-order representation bias and a second-order remainder, and we show that coverage deteriorates with sample size when the representation is insufficient (§ 3.3). Fourth, we describe a workflow that applies one representation to counterfactual treatment comparisons, locked phenotypes, interventional mediation, select-then-confirm pathway analysis, and portable external replication, including time-indexed multimodal records with a pre-exposure window (§ 4). Fifth, we propose diagnostics for representation insufficiency, exposure leakage, and representation sensitivity, together with a rule for choosing the representation by nuisance loss rather than reconstruction loss (§ 5). Finally, we evaluate these methods in a simulation study with a tunable information-loss mechanism (§ 6 and § 7).
Setup and estimands
Data and potential outcomes
We observe independent copies of . Here collects pretreatment covariates from modalities, for example diagnoses, medications, laboratory values, vital signs, and social and behavioral measures; is a treatment or exposure; is an intermediate confounder that may be affected by ; is a mediator measured after , such as early weight change; and is an outcome measured after . For counterfactual treatment comparisons we also allow a vector of binary failure indicators in place of . Let denote the potential outcome under , the potential mediator, and the potential outcome under and .
For a generic adjustment set , which will be either or a representation , define the nuisance functions
Here is the conditional density of , and is the density of given with marginalized.
Estimands
Counterfactual outcomes under alternative treatments. The first family compares treatment options for the same patients. Its targets are the counterfactual mean ; the phenotype-specific counterfactual mean and effect , where is a pretreatment phenotype (§ 4.3); and the counterfactual risk profile for failure mode under treatment . The risk profile answers the question a clinician asks at the first visit: for this patient, which failure is most likely under each option?
Interventional direct and indirect effects. The second family decomposes the effect of on through . Following VanderWeele et al. (2014), let denote a random draw from the distribution of given , and define
The interventional indirect and direct effects are
which sum to the overall interventional effect . In words, the IIE is the change in the average outcome when only the distribution of the mediator is shifted from its level under to its level under , holding the exposure at . The subscript matters: the estimand is defined relative to the covariates used to define the random draw.
Identification given the full covariate set
Assumption 1 (Identification given ). (i) Consistency: and . (ii) and for all . (iii) for all . (iv) Positivity: and wherever , almost surely.
Under Assumption 1, the counterfactual mean is identified by and the interventional mean by (VanderWeele et al., 2014; Díaz et al., 2021)
For a representation , write and for the same functionals with replaced by in every nuisance function and in the outer expectation. These are the quantities that a doubly robust estimator using as covariates targets. The question is when they equal and .
Multimodal representations
For each modality , a VAE with encoder and decoder is trained by maximizing the evidence lower bound
with likelihoods matched to the data type (Gaussian for continuous laboratory values, Bernoulli for diagnosis indicators, categorical for survey items). The patient representation is the concatenation of posterior means,
which compresses each modality separately before integration, as in our earlier latent-space analyses ([7]). We also consider the augmented representation , in which a short list of prespecified clinical confounders is added unchanged.
Because the representation is itself estimated, where it is trained matters. We distinguish three regimes. Under external training (R1), the encoders are trained on covariate data from individuals outside the analytic sample, for example other participants of the same biobank, and then held fixed. Under fold-specific training (R2), within -fold cross-fitting, the encoders for fold are trained on the covariates of the other folds, together with the nuisance models for fold . Under full-sample unsupervised training (R3), the encoders are trained on the covariates of the whole analytic sample, without using , , , or , and the nuisance models are then cross-fitted.
Time-indexed records. In many settings the multimodal record is a time series, for example continuous physiological monitoring, device and activity logs, or audio and video recordings of a clinical episode, and the exposure is defined at or after a time zero , as in target-trial emulation ((Hernán and Robins, 2016)). The framework applies with replaced by the pre-exposure window : the encoders are trained, and the representation is computed, only from data recorded before . Data recorded after may reflect the exposure or its consequences. Including them in the representation conditions on post-exposure variables, can encode the exposure itself (diagnostic D2 in § 5), and changes the estimand. Post-exposure variables that are affected by the exposure and confound the mediator–outcome relation enter the analysis as intermediate confounders , not through the representation. When an exposure accumulates over a window, for example as a count or a rate, the window and should be fixed in advance, so that longer or more complex episodes do not receive larger exposure values merely because they last longer.
Mechanism-informed objectives. The VAE objective can be augmented with penalties that encode mechanistic knowledge, as in physics-informed neural networks (Raissi et al., 2019), in which a learned model is also required to satisfy a differential equation; we have used this approach to forecast urban air pollution from traffic and weather (Cao et al., 2025). Two kinds of mechanism should be distinguished. A mechanism that describes only the covariates, for example the dynamics of pretreatment physiological trajectories, yields an objective that still depends on the law of alone and is therefore subject to Proposition 2: it may make the representation more accurate or more stable, but it cannot by itself make it sufficient. A mechanism that links the exposure, the mediator, and the outcome, for example an energy-balance model of how a change in energy intake under treatment translates into weight change over time (Hall et al., 2011), constrains the nuisance functions on which sufficiency depends and may therefore help. Because such an objective uses , , or , it falls under the rule below, and its benefit should be checked with diagnostic D1 rather than assumed.
Representations whose training loss involves , , , or (supervised or semi-supervised objectives) use outcome information and are admissible only under regimes (R1) or (R2).
When does a learned representation preserve identification
Sufficient representations
Definition 1 (Sufficiency). Let be a measurable map of .
(a) is balancing if , and prognostic if depends on only through for .
(b) is nuisance-sufficient for mediation if , , and depend on only through , for all .
(c) is process-sufficient if .
Balancing and prognostic representations generalize the propensity score (Rosenbaum and Rubin, 1983) and the prognostic score (Hansen, 2008) to learned, multivariate summaries.
Proposition 1 (Identification with a representation). Suppose Assumption 1 holds.
(a) If is balancing or prognostic, then . If, in addition, the phenotype is a function of , then .
(b) If is nuisance-sufficient for mediation, then for all .
(c) If is process-sufficient, then Assumption 1 holds with replaced by ; the conditional law of given equals its conditional law given ; and both and .
(d) Balancing does not imply : there are laws under which a balancing identifies every counterfactual mean but not the interventional effects.
Proofs are in Appendix § 13. Part (d) follows from a simple case: if is randomized, a constant is balancing and , yet whenever confounds the mediator–outcome relation, is the unadjusted interventional functional and differs from . The practical implication is that a representation adequate for comparing treatments can be inadequate for decomposing their effects.
Remark 1 (The estimand moves with the representation). Interventional effects are defined relative to the covariates used to draw the mediator. Under process sufficiency the random draws and have the same distribution, so nothing is lost. Without sufficiency, is in general neither nor the causal quantity , because exchangeability fails given .
Remark 2 (Reconstruction targets none of these conditions). The VAE objective depends only on the marginal law of . All conditions in Definition 1 concern the conditional law of given . Two data-generating laws with the same distribution of therefore yield the same representation, while one may satisfy sufficiency and the other not. Proposition 2 makes this precise for every objective of this kind, and § 3.2 makes it quantitative.
Definition 2 (Covariate-only objective). A training objective for a representation is covariate-only if, for every candidate , its value depends on the data-generating law only through the marginal law of . Reconstruction objectives such as the evidence lower bound, contrastive objectives defined on , and physics-informed penalties that constrain only the dynamics of are covariate-only.
Proposition 2 (No covariate-only objective certifies sufficiency). Let take values in a standard Borel space, and let be a representation such that is not almost surely a function of . Then there are three laws , , and with the same marginal law of , each satisfying Assumption 1, such that is process-sufficient under , under , and under . In particular, every covariate-only objective takes the same value at under all three laws, so no such objective, and no rule that selects a representation by its value, can distinguish a sufficient representation from an insufficient one.
The only representations that are sufficient under every law are those that retain all of the information in , and they provide no compression. Sufficiency therefore has to come from information about the exposure, mediator, and outcome mechanisms, either through the training objective (§ 2.4) or through diagnostics such as D1 (§ 5).
Insufficiency bias in a linear structural model
Let , where is retained by the representation, , and is a scalar that is lost, with and . (Any lost component can be taken orthogonal to after projection.) Consider
with independent Gaussian errors of variances , Gaussian , and no intermediate confounder. The exposure is continuous here so that the result has closed form; then and interventional and natural indirect effects coincide.
Proposition 3 (Closed-form insufficiency bias). Let
Adjusting for gives , where
so the bias per unit contrast is . The bias of the total effect is .
The two factors have distinct sources. The exposure–mediator path is biased when the lost component affects both the exposure and the mediator (); the mediator–outcome path is biased when it affects both the mediator and the outcome (), even if the exposure is randomized (, so and ). The second case is the linear counterpart of Proposition 1(d).
Corollary 1 (Reconstruction error does not bound the bias). Suppose is a coordinate of and reconstruction is measured by squared error. Dropping increases the minimal reconstruction error by exactly , a quantity determined by the law of alone. For every and there are coefficients such that and per unit contrast.
A representation can therefore reconstruct the data almost perfectly and still yield arbitrarily large bias. A rare diagnosis that strongly affects both treatment choice and early response is the clinical prototype: it contributes little to reconstruction, so a compressed representation has every incentive to drop it.
Error decomposition for cross-fitted estimators
Let denote either , , or , and let be a learned representation that is independent of the estimation sample, as under regime (R1); under regime (R2) the argument below applies fold by fold. Write for the true nuisance functions of the adjustment set , for their cross-fitted estimates, for the efficient influence function of the functional treating as fixed, and for the cross-fitted augmented inverse-probability-weighted or one-step estimator that uses as covariates.
Theorem 1 (Error decomposition). Suppose that, conditionally on , the nuisance estimates are -consistent, the exposure-propensity and density-ratio estimates are bounded away from zero, and the usual cross-fitting conditions hold. Then
For , . For , is a sum of products of errors in the exposure, intermediate-confounder, mediator, and outcome nuisances, as given by Díaz et al. (2021).
The decomposition separates what the estimation procedure can and cannot fix. Double robustness and cross-fitting make and the empirical-process term negligible under rate conditions (Chernozhukov et al., 2018; Zivich and Breskin, 2021), so that is asymptotically normal around . They do nothing about , which is fixed once the representation is fixed and does not shrink as grows. The bias can be split further as , where is the population limit of the training procedure: the first term reflects estimation of the representation and is small when the encoders are trained on a large external sample; the second reflects insufficiency of the architecture and objective and is not reduced by more training data.
Corollary 2 (Coverage deteriorates with sample size). If and the variance estimator is consistent for , the coverage of the Wald interval for is approximately , which tends to zero as .
Remark 3 (Full-sample unsupervised training). Under regime (R3), depends on the covariates of the estimation sample, so the conditional argument above does not apply directly. The decomposition continues to hold if the encoder class is Donsker or the training algorithm is sufficiently stable, because uses no information about . Whether this matters in practice is examined in the simulation.
Remark 4 (Connection to prediction error). With , no representation, and the partially linear residualized estimator of a constant effect , the second-order term reduces to in the notation of Cao (2026b). That paper’s finding that marginal prediction error does not track causal bias is thus a statement about the second term of Theorem 1; the present paper adds the first.
Estimation workflow
The workflow fits one representation and uses it for every causal estimand. Throughout, the sample is split once into a development part , used to train encoders under regime (R1) or (R2), choose the representation, and derive phenotypes, and an estimation part , used for cross-fitted estimation with everything learned on held fixed. All observations of a patient, and of a cluster when observations are clustered, stay on one side of every split.
Counterfactual comparisons of treatments
With cross-fitted estimates and computed on , define the doubly robust pseudo-outcome
Its sample mean estimates the average effect, its mean within estimates for a locked phenotype, and its regression on in a further split gives the doubly robust learner of the conditional effect function (Kennedy, 2023). Under Proposition 1(a) and Theorem 1, these estimators are consistent for the -adjusted targets when is balancing or prognostic, which is a weaker requirement than in mediation.
The counterfactual risk profile is the cross-fitted outcome model for failure mode in treatment arm , evaluated for every patient under every option, so that each patient receives a profile of predicted failure risks across treatments and the failure most likely under each option. Because the profile is a plug-in quantity without an augmentation term, we check it against doubly robust targets: within bins of predicted risk, the mean of is compared with the doubly robust estimate of , which gives a counterfactual calibration plot for each option. Failure modes are treated as separate binary outcomes; competing failures can be handled with a multinomial outcome model without changing the rest of the workflow.
Remark 5 (Counterfactual risk profiles as digital twins). A model that predicts each patient’s outcomes under every treatment option is what the clinical literature calls a digital twin [2] (National Academies of Sciences, Engineering, and Medicine 2024). The results above state when such a twin can be trusted. For comparisons between treatments, the representation must be balancing or prognostic (Proposition 1(a)); if the twin is also used to explain why outcomes differ, through interventional mediation, it must satisfy the stronger conditions of Proposition 1(b) or (c). The counterfactual calibration check above validates a twin’s predictions under each option, and landmark updating (§ 4.3) corresponds to updating the twin with new data, with the caveat that updated predictions condition on the treatment actually received and are therefore not counterfactual comparisons between options.
Interventional mediation
Interventional effects are estimated with the cross-fitted one-step estimator of Díaz et al. (2021), using or in place of ; the 2024 correction to that paper applies (Díaz et al., 2024). We write the mediator density ratio in the efficient influence function through Bayes’ rule, so that it requires only the probabilities and rather than conditional densities (Appendix § 14). We implement the estimator directly because regime (R2) uses a different covariate matrix in each fold; for adjustment sets that are common to all folds it can be compared with the medoutcon implementation (Hejazi et al., 2022), which accommodates a single binary intermediate confounder, and settings with several mediators or intermediate confounders can use the extension of Rudolph et al. (2024), implemented in HDmediation. The implementation reproduces the true values exactly when the true nuisance functions are supplied, and remains unbiased when the outcome model or the exposure model is deliberately misspecified. Variances are estimated from the efficient influence function, with cluster-level score sums when observations are clustered. When is an incident event, follow-up begins after is measured so that the mediator precedes the outcome.
Phenotypes
A phenotype is a pretreatment grouping derived on , for example by linking the representation to observed response and failure modes, and then locked. Each phenotype is described by the features of that distinguish it, so that it can be recognized without running the model. Locking is what makes phenotype-specific inference valid: because is a fixed function when is analyzed, and the phenotype-specific interventional effects are ordinary functionals, estimated by within-phenotype averages of the corresponding uncentered influence functions. Deriving and evaluating phenotypes on the same data would make data-dependent and the resulting intervals too narrow.
The added value of the representation is assessed by comparing phenotype and outcome models built on with models built on conventional clinical characteristics and with models using the same data without a learned representation. Phenotype assignments can be updated at later landmarks, such as six weeks or six months after treatment start, by adding early response to the model without changing the phenotype definitions (van Houwelingen, 2007). Updated assignments condition on the treatment actually received and on early response, so they are predictions for monitoring, not counterfactual comparisons between treatments.
Select-then-confirm pathway analysis
When many candidate exposure–mediator–outcome pathways are examined, as in latent-space mediation analyses with hundreds of combinations (Cao and Ma, [7]), ranking and inference on the same data inflate the selected effects. We therefore split into a screening part and a confirmation part. On the screening part, each candidate interventional indirect effect is estimated, candidates are ranked by , and the stability of each candidate is measured by its frequency among the top across bootstrap resamples. The top-ranked stable candidates are then re-estimated on the confirmation part, with a Holm adjustment over the selected set. Because the selected set depends on the screening data only, the confirmation estimates retain their usual asymptotic distribution conditionally on the selection. We describe this step as internal re-testing, not independent replication.
Portable representations and external replication
Data sources record different variables. A portable representation is trained on the variables that all sources share, with a prespecified substitute for any variable that one source records differently, and is applied unchanged elsewhere. Portability has a checkable and an uncheckable part. The checkable part is whether restricting to already loses information in the development source: the difference , computed on the same estimation sample with a bootstrap interval, should be near zero. The uncheckable part is whether conditional exchangeability between populations holds given (Pearl and Bareinboim, 2014; Dahabreh et al., 2020). External replication then compares prespecified quantities between sources: phenotype prevalence, defining features, calibration and discrimination of each outcome model, and performance across age, sex, race and ethnicity, and other prespecified subgroups.
Diagnostics
Theorem 1 shows that the representation bias cannot be controlled by the estimator, so it has to be examined directly. We propose four diagnostics, all computed without access to the outcome of the estimation sample beyond what the nuisance models already use.
D1: Nuisance insufficiency. For each nuisance function required by the estimand ( and for counterfactual comparisons; , , the mediator model, and for mediation), compare the cross-validated loss of a model using with that of the same learner using . Per-observation held-out loss differences give a mean improvement and a standard error. A clear improvement shows that is not nuisance-sufficient for that function (Definition 1). The converse does not hold: no improvement is consistent with sufficiency but does not prove it, and the diagnostic cannot detect unmeasured confounding. When is too high-dimensional for the learner, a penalized learner on or on plus the residuals of given can be used.
D2: Exposure leakage and overlap. A representation of a rich health record may encode the exposure itself, for example when diagnoses, laboratory values, or medications that define the exposure are among its inputs. We report the cross-validated area under the curve for predicting from , the distribution of , and the share of observations with estimated propensities outside . An area near one signals a practical positivity violation; the remedy is to remove exposure-defining variables from the encoder inputs, with trimming as a sensitivity analysis.
D3: Representation sensitivity. We recompute every estimate across latent dimensions, KL weights, random seeds, and representation objectives (VAE, principal components, and a supervised alternative) and report the range. Different objectives can recover different structures from the same data (Cao et al., 2026); conclusions that change across this range are fragile.
D4: Choosing the representation. Reconstruction loss is reported but not used to choose the representation for causal analysis (Proposition 2 and Corollary 1). Instead, on the development data, we choose the architecture, latent dimension, and KL weight that minimize the sum of standardized cross-validated losses of the nuisance functions that the estimand requires. This targets Definition 1(b) directly, although it remains silent about confounders that are not in ; standard sensitivity analyses for unmeasured confounding of the exposure–outcome and mediator–outcome relations (VanderWeele, 2015) are reported alongside.
Simulation study
The study is designed following the ADEMP structure (Morris et al., 2019); results are reported in § 7.
Aims. (i) To quantify the bias, variance, and coverage of cross-fitted estimators of counterfactual and interventional effects that adjust for a learned representation, as the representation loses confounding information; (ii) to compare the three training regimes; (iii) to test whether reconstruction loss tracks bias (Corollary 1) and whether coverage deteriorates with sample size under insufficiency (Corollary 2); and (iv) to evaluate diagnostics D1–D4, phenotype-specific estimation, select-then-confirm analysis, and portable representations.
Data-generating mechanisms. A latent vector generates three modalities: 20 continuous laboratory-type variables with , so that determines up to negligible noise and Assumption 1 holds given ; 30 binary diagnosis-type indicators with ; and 10 four-level ordinal survey-type items obtained by thresholding . A rare binary code , independent of , is appended to the diagnosis modality. The causal variables are
with standard normal errors, and two binary failure modes that are logistic in . The code raises the probability of treatment, the intermediate confounder, and the mediator, and lowers the outcome (, ), so that the biases of the exposure–mediator and mediator–outcome paths reinforce rather than cancel (Proposition 3). The dial sets the confounding strength of : with the latent factors are sufficient; with a representation that drops is not. All coefficients, loadings, and intercepts are fixed across replicates and listed in Supplementary Table S1. Sample sizes are , and each setting uses 200 replicates, so that the Monte Carlo standard error of estimated coverage is at most 0.035 and about 0.015 near the nominal 95% level. A single external covariate-only sample of 20,000 draws of is used to train the (R1) encoders, the principal components, and the locked phenotypes, which are three -means clusters of the (R1) representation with four latent dimensions per modality.
Estimands. The average effect ; the phenotype-specific effects for the three locked phenotypes; the interventional indirect and direct effects; and the counterfactual risk of each failure mode under each treatment. True values are computed by Monte Carlo integration over draws of , using the closed form of , in which the intermediate confounder follows its law under and the mediator its law under , as in equation (1); phenotype-specific truths use draws of and the locked phenotype map; true counterfactual risks are known for every simulated patient.
Methods. All methods use five-fold cross-fitting with the same folds and the same nuisance learners, namely logistic and linear regression for adjustment sets with at most 30 columns and cross-validated lasso otherwise, with outcome-type nuisances fitted separately in each exposure arm. They differ only in the adjustment set or in how it is learned: (M1) the oracle, which adjusts for ; (M2) the raw covariates, all 61 variables of ; (M3) a VAE with external training (R1), with latent dimension per modality in , chosen either by validation reconstruction loss or by the nuisance-loss rule D4; (M4) a VAE with fold-specific training (R2); (M5) a VAE with full-sample unsupervised training (R3); (M6) the VAE from (R1) plus key covariates, , with two laboratory variables and as the key covariates; (M7) principal components trained on the external sample; and (M8) the VAE from (R3) without cross-fitting of the nuisance models. Methods (M4)–(M7) use four latent dimensions or components per modality.
Performance measures. Bias, empirical standard error, root mean squared error, coverage and width of nominal 95% intervals, and the ratio of mean estimated to empirical standard error, each with Monte Carlo standard errors. For the diagnostics: the share of replicates in which D1 rejects, at and at ; the area under the curve in D2; the range of estimates across latent dimensions and principal components in D3; and the correlation between reconstruction loss and bias across latent dimensions. For the counterfactual risk profiles: root mean squared error against the true risks and agreement on the failure most likely under each option.
Additional experiments. Both use and the two sample sizes. (a) Select-then-confirm: 20 candidate mediators, of which two carry non-zero indirect effects; the others are nulls in which the exposure affects the mediator but not the outcome, or the reverse. Same-sample ranking (top three of 20, unadjusted tests) is compared with select-then-confirm (screening on half of the sample, stability by multiplier bootstrap of the influence functions with 200 resamples and a 50% threshold, Holm-adjusted confirmation of the top three on the other half), on family-wise error, power, and bias of the selected estimates. (b) Portability: the portable representation uses the (R1) laboratory and diagnosis encoders only and is applied unchanged to a target population with in which the survey modality is unavailable; in the source is compared with the bias in the target. A clustered-data experiment is deferred to a later version.
Simulation results
Representation insufficiency and coverage
With , so that the latent factors were sufficient, the VAE representation (R1, ) estimated the interventional indirect effect with bias and coverage at , compared with and for the oracle (Table 1). As the lost code became a stronger confounder, the bias grew to , , and (, , and ) and coverage fell to , , and at . Where the representation was insufficient, coverage fell as the sample size grew while the bias stayed roughly constant: from to at and from to at between and , and it was at both sample sizes at (Figure 1), as Corollary 2 predicts. Adding the prespecified key covariates restored coverage ( at for ), as did adjusting for the raw covariates (). The average treatment effect was much less affected: at and , its bias with the same representation was , compared with for the IIE (Supplementary Table S2), illustrating that the requirements for mediation are stricter than for treatment comparison. The interventional direct effect was biased by a similar amount in the opposite direction (; Supplementary Table S3): the lost code distorted how the effect was split between pathways far more than the effect itself.
| Method | ||||||
| Bias | RMSE | Cov. | Bias | RMSE | Cov. | |
| Oracle | 0.011 | 0.082 | 0.935 | 0.046 | 0.955 | |
| Raw covariates | 0.020 | 0.076 | 0.900 | 0.002 | 0.043 | 0.940 |
| VAE (R1), | 0.011 | 0.084 | 0.935 | 0.047 | 0.950 | |
| VAE (R1), by nuisance loss | 0.010 | 0.085 | 0.935 | 0.047 | 0.950 | |
| VAE (R2), fold-specific | 0.008 | 0.085 | 0.935 | 0.047 | 0.950 | |
| VAE (R3), full-sample | 0.009 | 0.085 | 0.935 | 0.047 | 0.950 | |
| VAE (R1) + key covariates | 0.011 | 0.086 | 0.925 | 0.047 | 0.950 | |
| PCA (R1) | 0.010 | 0.084 | 0.945 | 0.047 | 0.950 | |
| VAE (R3), no cross-fitting | 0.008 | 0.081 | 0.915 | 0.047 | 0.945 | |
| Oracle | 0.083 | 0.930 | 0.002 | 0.045 | 0.965 | |
| Raw covariates | 0.012 | 0.074 | 0.920 | 0.006 | 0.042 | 0.925 |
| VAE (R1), | 0.043 | 0.095 | 0.920 | 0.047 | 0.065 | 0.810 |
| VAE (R1), by nuisance loss | 0.040 | 0.093 | 0.930 | 0.047 | 0.064 | 0.810 |
| VAE (R2), fold-specific | 0.041 | 0.093 | 0.935 | 0.047 | 0.064 | 0.815 |
| VAE (R3), full-sample | 0.041 | 0.093 | 0.930 | 0.047 | 0.064 | 0.815 |
| VAE (R1) + key covariates | 0.088 | 0.940 | 0.001 | 0.045 | 0.970 | |
| PCA (R1) | 0.042 | 0.094 | 0.920 | 0.047 | 0.065 | 0.810 |
| VAE (R3), no cross-fitting | 0.041 | 0.089 | 0.910 | 0.046 | 0.064 | 0.805 |
| Oracle | 0.081 | 0.955 | 0.005 | 0.041 | 0.970 | |
| Raw covariates | 0.012 | 0.074 | 0.900 | 0.008 | 0.041 | 0.925 |
| VAE (R1), | 0.181 | 0.197 | 0.375 | 0.186 | 0.189 | 0.015 |
| VAE (R1), by nuisance loss | 0.179 | 0.195 | 0.390 | 0.163 | 0.170 | 0.110 |
| VAE (R2), fold-specific | 0.177 | 0.193 | 0.395 | 0.185 | 0.188 | 0.015 |
| VAE (R3), full-sample | 0.179 | 0.195 | 0.400 | 0.184 | 0.188 | 0.015 |
| VAE (R1) + key covariates | 0.085 | 0.950 | 0.005 | 0.043 | 0.965 | |
| PCA (R1) | 0.180 | 0.197 | 0.395 | 0.186 | 0.189 | 0.015 |
| VAE (R3), no cross-fitting | 0.175 | 0.190 | 0.315 | 0.183 | 0.187 | 0.005 |
| Oracle | 0.010 | 0.090 | 0.950 | 0.046 | 0.955 | |
| Raw covariates | 0.029 | 0.082 | 0.850 | 0.004 | 0.043 | 0.930 |
| VAE (R1), | 0.500 | 0.502 | 0.000 | 0.491 | 0.491 | 0.000 |
| VAE (R1), by nuisance loss | 0.473 | 0.479 | 0.000 | 0.372 | 0.374 | 0.000 |
| VAE (R2), fold-specific | 0.495 | 0.498 | 0.000 | 0.490 | 0.491 | 0.000 |
| VAE (R3), full-sample | 0.496 | 0.499 | 0.000 | 0.490 | 0.490 | 0.000 |
| VAE (R1) + key covariates | 0.009 | 0.098 | 0.940 | 0.046 | 0.950 | |
| PCA (R1) | 0.501 | 0.503 | 0.000 | 0.491 | 0.492 | 0.000 |
| VAE (R3), no cross-fitting | 0.493 | 0.495 | 0.000 | 0.488 | 0.488 | 0.000 |
Table 1. Estimation of the IIE across methods, confounding strength of the lost code (), and sample size. Note. 200 replicates per setting; Cov., coverage of nominal 95% intervals. Largest Monte Carlo standard errors: bias 0.007, coverage 0.035.
Figure 1. Coverage of nominal 95% intervals for the IIE by sample size, for each confounding strength of the lost code. The dashed line marks 0.95; 200 replicates per setting.
Reconstruction loss does not track bias
Reconstruction loss was lowest at (Table 2), so the reconstruction rule selected that dimension in every replicate. Across latent dimensions, the correlation between reconstruction loss and the absolute bias of the IIE ranged from to across settings (Figure 2): it was positive at ( and at and ) but negative at ( and ), where better reconstruction went with larger bias. At and , the dimension chosen by reconstruction gave bias and coverage , and the dimension chosen by nuisance loss gave and . At every candidate dimension gave a biased estimate of the IIE, so neither rule could remove the bias; what detected the problem was D1 (§ 7.4), and what removed it was adding the key covariates.
| Recon. loss | Bias | Cov. | Chosen | Bias | Cov. | Chosen | ||
| 0 | 1 | 31.00 | −0.097 | 0.830 | 0% | −0.107 | 0.515 | 0% |
| 0 | 2 | 25.19 | −0.045 | 0.920 | 2% | −0.056 | 0.805 | 0% |
| 0 | 4 | 18.55 | 0.011 | 0.935 | 98% | −0.001 | 0.950 | 100% |
| 0 | 8 | 18.49 | 0.007 | 0.940 | 0% | −0.000 | 0.945 | 0% |
| 0.5 | 1 | 31.00 | −0.063 | 0.880 | 0% | −0.059 | 0.800 | 0% |
| 0.5 | 2 | 25.19 | −0.010 | 0.935 | 4% | −0.003 | 0.940 | 0% |
| 0.5 | 4 | 18.55 | 0.043 | 0.920 | 96% | 0.047 | 0.810 | 97% |
| 0.5 | 8 | 18.49 | 0.032 | 0.950 | 0% | 0.032 | 0.885 | 3% |
| 1 | 1 | 31.00 | 0.069 | 0.885 | 0% | 0.076 | 0.700 | 0% |
| 1 | 2 | 25.19 | 0.130 | 0.630 | 3% | 0.132 | 0.195 | 0% |
| 1 | 4 | 18.55 | 0.181 | 0.375 | 97% | 0.186 | 0.015 | 65% |
| 1 | 8 | 18.49 | 0.121 | 0.705 | 0% | 0.127 | 0.185 | 35% |
| 2 | 1 | 31.00 | 0.412 | 0.010 | 0% | 0.402 | 0.000 | 0% |
| 2 | 2 | 25.19 | 0.460 | 0.005 | 4% | 0.451 | 0.000 | 0% |
| 2 | 4 | 18.55 | 0.500 | 0.000 | 78% | 0.491 | 0.000 | 3% |
| 2 | 8 | 18.49 | 0.375 | 0.005 | 19% | 0.368 | 0.000 | 97% |
Table 2. Latent dimension, reconstruction loss, and estimation of the IIE (regime R1). “Chosen” is the share of replicates in which the nuisance-loss rule D4 selected that dimension; the reconstruction rule selects the dimension with the lowest reconstruction loss in every replicate.
Figure 2. Absolute bias of the IIE against validation reconstruction loss across latent dimensions of the (R1) VAE, by confounding strength and sample size .
Training regimes
At , the three training regimes gave similar results: IIE coverage at was 0.950 for external training, 0.950 for fold-specific training, and 0.950 for full-sample unsupervised training (Table 1). Omitting cross-fitting of the nuisance models gave coverage 0.945 at and 0.915 at . At the three regimes and the principal components were biased to the same degree (IIE bias 0.184 to 0.186 at and ), so the bias came from the lost code rather than from how the encoder was trained.
Diagnostics
Diagnostic D1 flagged the representation in 0% of replicates at and , where it was sufficient, and in 100% at ; it flagged the representation, which cannot recover the four latent factors, in 100% of replicates at (Table 3). At , where the bias was smaller, D1 flagged the representation in 28% of replicates at and in 99% at . The cross-validated area under the curve for predicting the exposure from the representation ranged from 0.668 to 0.683, so exposure leakage was not a concern in this design. Estimates varied across latent dimensions by 0.112 on average at and (D3), compared with 0.110 at , where the spread came from the lower-dimensional representations that cannot recover .
Table 3: Diagnostics. D1: share of replicates in which adding the raw covariates significantly improved a nuisance model (Holm-adjusted, 5% level). D2: cross-validated area under the curve for predicting . D3: mean range of IIE estimates across latent dimensions and PCA within a replicate.
| D1, | D1, | D2 AUC, VAE | D2 AUC, raw | D3 range | ||
| 0 | 1,000 | 100% | 2% | 0.678 | 0.683 | 0.127 |
| 0 | 3,000 | 100% | 0% | 0.683 | 0.685 | 0.110 |
| 0.5 | 1,000 | 100% | 28% | 0.671 | 0.678 | 0.123 |
| 0.5 | 3,000 | 100% | 99% | 0.683 | 0.687 | 0.109 |
| 1 | 1,000 | 100% | 100% | 0.670 | 0.685 | 0.127 |
| 1 | 3,000 | 100% | 100% | 0.681 | 0.696 | 0.112 |
| 2 | 1,000 | 100% | 100% | 0.668 | 0.711 | 0.137 |
| 2 | 3,000 | 100% | 100% | 0.675 | 0.716 | 0.125 |
Table 3.
Counterfactual comparisons, phenotypes, pathway selection, and portability
Phenotype-specific effects were covered at an average rate of 0.955 with the representation at and 0.947 at (; Table 4). Patient-level counterfactual risk profiles were more sensitive: their root mean squared error against the true risks rose from 0.046 at to 0.089 and 0.137 at and 2, compared with 0.051 when the key covariates were added, and agreement with the true most likely failure fell from 90% to 85% and 82% of patients and options.
| Method | ATE bias | ATE cov. | (s) cov. | Risk RMSE | Agree | ATE bias | ATE cov. | (s) cov. | Risk RMSE | Agree | |
| 0 | Oracle () | 0.014 | 0.960 | 0.955 | 0.053 | 0.893 | −0.001 | 0.935 | 0.953 | 0.030 | 0.936 |
| 0 | Raw covariates | 0.033 | 0.950 | 0.942 | 0.066 | 0.834 | 0.006 | 0.930 | 0.953 | 0.042 | 0.906 |
| 0 | VAE (R1), | 0.016 | 0.975 | 0.953 | 0.079 | 0.841 | 0.000 | 0.930 | 0.955 | 0.046 | 0.901 |
| 0 | VAE (R1) + key covariates | 0.017 | 0.970 | 0.957 | 0.089 | 0.826 | 0.000 | 0.930 | 0.955 | 0.051 | 0.891 |
| 0.5 | Oracle () | −0.012 | 0.955 | 0.948 | 0.053 | 0.901 | 0.001 | 0.940 | 0.960 | 0.030 | 0.943 |
| 0.5 | Raw covariates | 0.006 | 0.930 | 0.948 | 0.075 | 0.818 | 0.007 | 0.935 | 0.952 | 0.047 | 0.899 |
| 0.5 | VAE (R1), | −0.010 | 0.960 | 0.950 | 0.089 | 0.818 | 0.002 | 0.965 | 0.953 | 0.060 | 0.874 |
| 0.5 | VAE (R1) + key covariates | −0.010 | 0.950 | 0.952 | 0.089 | 0.837 | 0.002 | 0.945 | 0.958 | 0.050 | 0.902 |
| 1 | Oracle () | 0.001 | 0.940 | 0.948 | 0.053 | 0.908 | 0.003 | 0.975 | 0.953 | 0.031 | 0.945 |
| 1 | Raw covariates | 0.018 | 0.950 | 0.938 | 0.079 | 0.838 | 0.009 | 0.945 | 0.948 | 0.047 | 0.910 |
| 1 | VAE (R1), | 0.002 | 0.960 | 0.953 | 0.111 | 0.807 | 0.004 | 0.970 | 0.947 | 0.089 | 0.850 |
| 1 | VAE (R1) + key covariates | 0.006 | 0.955 | 0.948 | 0.089 | 0.846 | 0.005 | 0.975 | 0.950 | 0.051 | 0.904 |
| 2 | Oracle () | 0.015 | 0.970 | 0.955 | 0.053 | 0.906 | 0.001 | 0.930 | 0.947 | 0.031 | 0.943 |
| 2 | Raw covariates | 0.030 | 0.935 | 0.935 | 0.084 | 0.843 | 0.005 | 0.925 | 0.937 | 0.049 | 0.910 |
| 2 | VAE (R1), | −0.000 | 0.955 | 0.952 | 0.155 | 0.787 | −0.016 | 0.930 | 0.950 | 0.137 | 0.821 |
| 2 | VAE (R1) + key covariates | 0.019 | 0.955 | 0.953 | 0.090 | 0.841 | 0.002 | 0.925 | 0.943 | 0.051 | 0.903 |
Table 4. Counterfactual comparisons: average effect (bias, coverage), phenotype-specific effects (mean coverage across phenotypes), counterfactual risk profiles (root mean squared error against the true risks), and agreement on which failure is most likely under each option.
In the pathway-selection experiment (Supplementary Table S4), same-sample ranking declared at least one null pathway significant in 52% and 56% of replicates at , whereas select-then-confirm declared none, with power 47% at and 99% at . At the family-wise error of select-then-confirm rose to 21% and 34%, and the selection bias was 0.32 to 0.36 under both procedures: sample splitting removes the bias from ranking, not the bias from the representation.
Restricting the representation to the shared modalities changed the source estimate of the IIE by 0.000 on average, with an interval containing zero in 95% to 97% of replicates (Supplementary Table S5). In the shifted target population, the portable representation was nearly unbiased at (bias 0.001 to 0.003) but had bias of about 0.18 at , the same as in the source: a value of near zero shows that the restriction loses nothing, not that the representation is sufficient.
Discussion
Learned representations make high-dimensional, multimodal adjustment practical, but they move part of the identification problem into the representation. The central message of this paper is that the error this creates is first order. Cross-fitting and double robustness protect against slow estimation of nuisance functions given the representation; they do not protect against information the representation has discarded, and that bias does not shrink with sample size. Larger samples make it more visible, because intervals narrow around the wrong value.
Three consequences for practice follow. First, the requirements depend on the estimand: comparing treatments requires a representation that is balancing or prognostic, whereas interventional mediation requires that the representation preserve the information used by the exposure, intermediate-confounder, mediator, and outcome models together. A representation validated for one purpose should not be assumed adequate for the other. Second, neither reconstruction quality nor any other covariate-only criterion, including physics-informed penalties on the covariates, is evidence of adequacy for causal analysis; representations should be chosen by the losses of the nuisance functions the estimand requires and checked with diagnostics such as D1–D3. Third, representations should be trained outside the estimation sample, either on external covariate data or within cross-fitting folds, and known strong confounders should be added to the representation rather than left to it. Phenotypes and selected pathways should be locked on data separate from the data used to estimate their effects.
The work has limitations. All results assume no unmeasured confounding given ; the diagnostics detect predictive insufficiency of the representation relative to measured covariates, not confounding by unmeasured variables, and a non-significant diagnostic is not proof of sufficiency. The closed-form bias is derived for a linear Gaussian model; the decomposition in Theorem 1 is general but conditional on a representation trained independently of the estimation sample, and full-sample unsupervised training requires an additional stability condition. The mediation estimator uses a single binary intermediate confounder. Counterfactual risk profiles are plug-in quantities and inherit the calibration of the outcome models. Mechanism-informed objectives that link the exposure, mediator, and outcome, and digital twins built on them, may reduce representation bias; whether they do is an empirical question that the diagnostics proposed here can answer, and we leave it to future work. Finally, the simulation study uses one data-generating design, two sample sizes, and 200 replicates per setting; applications to obesity treatment, comparing response and failure across metabolic and bariatric surgery and glucagon-like peptide-1 receptor agonist therapy and decomposing the role of early weight change, are reported separately.
Data and Code Availability
No patient data were analyzed; all results are based on simulated data. Code implementing the estimators, the diagnostics, and the simulation study is publicly available at https://github.com/congca0/reconstruction-is-not-enough and archived at https://doi.org/10.5281/zenodo.23524452.
Ethics Statement
This study used only simulated data. No human participants or identifiable data were involved, and ethical approval was not required.
Funding
The author received no specific funding for this work.
Competing Interests
The author declares no competing interests.
Proofs
Proposition 1(a). If is balancing, . By Assumption 1(ii), , so and ; taking expectations gives . If is prognostic, and , so . When is a function of , the same arguments hold conditionally on by the tower property.
Proposition 1(b). The -adjusted nuisances are conditional averages of the -adjusted ones: , , and the density of given is . If each -adjusted nuisance depends on only through , each conditional average equals the function itself evaluated at . Substituting into the -version of (1) and taking the outer expectation over gives (1).
Proposition 1(c). Process sufficiency implies and, by weak union, and . The argument of part (a) applied to and to gives Assumption 1(ii) given . For (iii), . Positivity transfers because . The law of given is that of given , which by equals that of given , the law of given . The nuisances in (b) are then -measurable, so (b) applies.
Proposition 1(d). Let be randomized, constant, and a binary confounder of and that is unaffected by . Then is balancing and , while uses in place of and differs from whenever affects both and .
Proposition 2. Because takes values in a standard Borel space and is not almost surely a function of , there is a bounded measurable function with ; otherwise every bounded function of would be almost surely equal to a function of , and would be almost surely a function of by the Doob–Dynkin lemma. Let , so that , for some , and . Fix the law of , let be independent of each other and of and , and let be degenerate. Under , independently of , , and ; then , so is process-sufficient. Under , with , , and . Then , whereas , so . Under , independently of , , and . Then and the draw of given has mean , so and . Given , let and ; because is Gaussian, is nondecreasing, with derivative , and strictly increasing on the event , which has positive probability. Since is independent of , , and given is distributed as . Hence and , so . In all three laws every dependence among operates through and the error terms are independent, so Assumption 1 holds, with positivity guaranteed by and by the Gaussian errors. A covariate-only objective depends on the law only through the common marginal law of , so it takes the same value at under , , and .
Proposition 3. All variables are jointly Gaussian. Since , and , so and the coefficient of in is . Next, , , and , so the coefficient of in is . With linear Gaussian nuisances, the -adjusted functional gives . The total-effect coefficient in is .
Corollary 1. The best squared-error reconstruction of from is , with error ; the other coordinates are unaffected. Fix , , , and , so
that and . The bias is , which exceeds in absolute value for .
Theorem 1. Conditionally on , the adjustment set is a fixed function of , and the standard expansion for cross-fitted one-step estimators applies (Chernozhukov et al., 2018; Kennedy, 2016; Díaz et al., 2021):
where the last term is by cross-fitting and -consistency. Adding and subtracting gives the result. For , the augmented inverse-probability-weighted estimator has , with all functions evaluated at .
Corollary 2. By Theorem 1, , and the coverage of follows.
Influence function used for estimation
With and fixed, write , , , , and , and define , , and . The efficient influence function of (Díaz et al., 2021) is
where the first weight is rewritten by Bayes’ rule. The one-step estimator is the sample mean of with cross-fitted nuisance estimates; is estimated by regressing on and among observations with .
Supplementary tables
| Component | Specification |
| Latent factors | |
| Laboratory modality | 20 variables, , |
| Diagnosis modality | 30 binary codes, logistic in , plus |
| Survey modality | 10 four-level items, thresholded , |
| Loadings | entries , drawn once (seed 20261020); diagnosis intercepts |
| Exposure | logit: , |
| Intermediate confounder | logit: , , , |
| Mediator | , , , , |
| Outcome | , , , , , |
| Failure mode 1 | logit: |
| Failure mode 2 | logit: |
| Dial and sizes | ; ; 200 replicates |
| Representations | VAE latent dimension per modality 1, 2, 4, 8 for (R1), 4 otherwise; external sample 20,000; 5-fold cross-fitting |
| Pathway selection | 20 candidate mediators, two with non-zero indirect effects |
| Portability | target , survey modality unavailable |
Table S1. Fixed parameters of the data-generating mechanism.
| Method | Bias | RMSE | Cov. | Bias | RMSE | Cov. |
| Oracle (, ) | 0.014 | 0.092 | 0.960 | 0.053 | 0.935 | |
| Raw covariates | 0.033 | 0.095 | 0.950 | 0.006 | 0.052 | 0.930 |
| VAE (R1), | 0.016 | 0.093 | 0.975 | 0.000 | 0.052 | 0.930 |
| VAE (R1), by nuisance loss | 0.017 | 0.094 | 0.975 | 0.000 | 0.052 | 0.930 |
| VAE (R2), fold-specific | 0.018 | 0.094 | 0.975 | 0.001 | 0.052 | 0.935 |
| VAE (R3), full-sample | 0.016 | 0.093 | 0.965 | 0.001 | 0.053 | 0.930 |
| VAE (R1) + key covariates | 0.017 | 0.094 | 0.970 | 0.000 | 0.053 | 0.930 |
| PCA (R1) | 0.014 | 0.093 | 0.985 | 0.052 | 0.935 | |
| VAE (R3), no cross-fitting | 0.016 | 0.092 | 0.975 | 0.002 | 0.052 | 0.925 |
| Oracle (, ) | 0.096 | 0.955 | 0.001 | 0.052 | 0.940 | |
| Raw covariates | 0.006 | 0.095 | 0.930 | 0.007 | 0.052 | 0.935 |
| VAE (R1), | 0.097 | 0.960 | 0.002 | 0.052 | 0.965 | |
| VAE (R1), by nuisance loss | 0.098 | 0.960 | 0.002 | 0.052 | 0.960 | |
| VAE (R2), fold-specific | 0.097 | 0.950 | 0.003 | 0.052 | 0.955 | |
| VAE (R3), full-sample | 0.098 | 0.955 | 0.003 | 0.053 | 0.950 | |
| VAE (R1) + key covariates | 0.098 | 0.950 | 0.002 | 0.052 | 0.945 | |
| PCA (R1) | 0.098 | 0.955 | 0.000 | 0.052 | 0.950 | |
| VAE (R3), no cross-fitting | 0.095 | 0.945 | 0.003 | 0.053 | 0.940 | |
| Oracle (, ) | 0.001 | 0.097 | 0.940 | 0.003 | 0.052 | 0.975 |
| Raw covariates | 0.018 | 0.094 | 0.950 | 0.009 | 0.052 | 0.945 |
| VAE (R1), | 0.002 | 0.094 | 0.960 | 0.004 | 0.053 | 0.970 |
| VAE (R1), by nuisance loss | 0.006 | 0.098 | 0.950 | 0.005 | 0.053 | 0.965 |
| VAE (R2), fold-specific | 0.003 | 0.094 | 0.965 | 0.005 | 0.052 | 0.965 |
| VAE (R3), full-sample | 0.003 | 0.095 | 0.950 | 0.005 | 0.052 | 0.970 |
| VAE (R1) + key covariates | 0.006 | 0.098 | 0.955 | 0.005 | 0.053 | 0.975 |
| PCA (R1) | 0.001 | 0.094 | 0.965 | 0.003 | 0.052 | 0.970 |
| VAE (R3), no cross-fitting | 0.002 | 0.092 | 0.940 | 0.005 | 0.052 | 0.970 |
| Oracle (, ) | 0.015 | 0.104 | 0.970 | 0.001 | 0.060 | 0.930 |
| Raw covariates | 0.030 | 0.099 | 0.935 | 0.005 | 0.057 | 0.925 |
| VAE (R1), | 0.093 | 0.955 | 0.057 | 0.930 | ||
| VAE (R1), by nuisance loss | 0.005 | 0.098 | 0.955 | 0.056 | 0.920 | |
| VAE (R2), fold-specific | 0.004 | 0.093 | 0.960 | 0.056 | 0.935 | |
| VAE (R3), full-sample | 0.002 | 0.092 | 0.950 | 0.056 | 0.940 | |
| VAE (R1) + key covariates | 0.019 | 0.111 | 0.955 | 0.002 | 0.062 | 0.925 |
| PCA (R1) | 0.001 | 0.093 | 0.955 | 0.058 | 0.935 | |
| VAE (R3), no cross-fitting | 0.003 | 0.092 | 0.955 | 0.056 | 0.945 |
Table S2. Estimation of the ATE across methods, confounding strength of the lost code (), and sample size. Note. 200 replicates per setting; Cov., coverage of nominal 95% intervals. Largest Monte Carlo standard errors: bias 0.008, coverage 0.019.
| Method | Bias | RMSE | Cov. | Bias | RMSE | Cov. |
| Oracle (, ) | 0.003 | 0.086 | 0.975 | 0.000 | 0.059 | 0.935 |
| Raw covariates | 0.019 | 0.080 | 0.940 | 0.007 | 0.055 | 0.910 |
| VAE (R1), | 0.005 | 0.089 | 0.990 | 0.003 | 0.059 | 0.940 |
| VAE (R1), by nuisance loss | 0.007 | 0.091 | 0.980 | 0.003 | 0.059 | 0.940 |
| VAE (R2), fold-specific | 0.009 | 0.086 | 0.990 | 0.004 | 0.059 | 0.935 |
| VAE (R3), full-sample | 0.006 | 0.087 | 0.980 | 0.004 | 0.059 | 0.935 |
| VAE (R1) + key covariates | 0.005 | 0.092 | 0.990 | 0.002 | 0.060 | 0.950 |
| PCA (R1) | 0.003 | 0.088 | 0.980 | 0.001 | 0.059 | 0.940 |
| VAE (R3), no cross-fitting | 0.007 | 0.083 | 0.975 | 0.005 | 0.058 | 0.935 |
| Oracle (, ) | 0.093 | 0.960 | 0.053 | 0.950 | ||
| Raw covariates | 0.083 | 0.935 | 0.001 | 0.051 | 0.930 | |
| VAE (R1), | 0.110 | 0.930 | 0.071 | 0.880 | ||
| VAE (R1), by nuisance loss | 0.109 | 0.930 | 0.071 | 0.885 | ||
| VAE (R2), fold-specific | 0.105 | 0.945 | 0.070 | 0.895 | ||
| VAE (R3), full-sample | 0.107 | 0.940 | 0.070 | 0.885 | ||
| VAE (R1) + key covariates | 0.098 | 0.960 | 0.001 | 0.053 | 0.945 | |
| PCA (R1) | 0.108 | 0.940 | 0.072 | 0.875 | ||
| VAE (R3), no cross-fitting | 0.103 | 0.915 | 0.069 | 0.885 | ||
| Oracle (, ) | 0.004 | 0.094 | 0.950 | 0.048 | 0.975 | |
| Raw covariates | 0.003 | 0.085 | 0.925 | 0.001 | 0.046 | 0.965 |
| VAE (R1), | 0.204 | 0.630 | 0.188 | 0.080 | ||
| VAE (R1), by nuisance loss | 0.202 | 0.635 | 0.168 | 0.215 | ||
| VAE (R2), fold-specific | 0.200 | 0.635 | 0.185 | 0.080 | ||
| VAE (R3), full-sample | 0.201 | 0.625 | 0.185 | 0.080 | ||
| VAE (R1) + key covariates | 0.007 | 0.097 | 0.950 | 0.050 | 0.970 | |
| PCA (R1) | 0.204 | 0.645 | 0.189 | 0.075 | ||
| VAE (R3), no cross-fitting | 0.195 | 0.565 | 0.184 | 0.085 | ||
| Oracle (, ) | 0.004 | 0.107 | 0.935 | 0.055 | 0.935 | |
| Raw covariates | 0.095 | 0.895 | 0.053 | 0.930 | ||
| VAE (R1), | 0.502 | 0.010 | 0.501 | 0.000 | ||
| VAE (R1), by nuisance loss | 0.477 | 0.020 | 0.390 | 0.000 | ||
| VAE (R2), fold-specific | 0.495 | 0.010 | 0.499 | 0.000 | ||
| VAE (R3), full-sample | 0.497 | 0.015 | 0.499 | 0.000 | ||
| VAE (R1) + key covariates | 0.009 | 0.111 | 0.950 | 0.001 | 0.055 | 0.945 |
| PCA (R1) | 0.502 | 0.010 | 0.503 | 0.000 | ||
| VAE (R3), no cross-fitting | 0.491 | 0.005 | 0.496 | 0.000 |
Table S3. Table S3: Estimation of the IDE across methods, confounding strength of the lost code (), and sample size. Note. 200 replicates per setting; Cov., coverage of nominal 95% intervals. Largest Monte Carlo standard errors: bias 0.008, coverage 0.035.
| Procedure | FWER | Power | Selection bias | ||
| 0 | 1,000 | Same-sample ranking | 52% | 96% | 0.044 |
| 0 | 1,000 | Select-then-confirm | 0% | 47% | 0.030 |
| 0 | 3,000 | Same-sample ranking | 56% | 100% | 0.024 |
| 0 | 3,000 | Select-then-confirm | 0% | 99% | 0.006 |
| 1 | 1,000 | Same-sample ranking | 100% | 94% | 0.358 |
| 1 | 1,000 | Select-then-confirm | 21% | 68% | 0.329 |
| 1 | 3,000 | Same-sample ranking | 100% | 99% | 0.340 |
| 1 | 3,000 | Select-then-confirm | 34% | 97% | 0.324 |
Table S4. Pathway selection among 20 candidate mediators (two true). FWER: share of replicates with at least one null pathway declared significant; power: share of the two true pathways declared significant; selection bias: mean of over selected pathways.
| 0 in CI | Source bias | Target bias | Target cov. | |||
| 0 | 1,000 | −0.001 | 95% | −0.002 | 0.003 | 0.965 |
| 0 | 3,000 | 0.000 | 97% | −0.002 | 0.001 | 0.970 |
| 1 | 1,000 | 0.000 | 95% | 0.185 | 0.180 | 0.300 |
| 1 | 3,000 | 0.000 | 97% | 0.182 | 0.176 | 0.020 |
Table S5. Portable representation (lab and diagnosis encoders only). : mean difference in the IIE between the full and portable representations in the source; “0 in CI”: share of replicates whose interval for contains zero. Target: shifted population without the survey modality.
References
- [1]David Benkeser and Jialu Ran. Nonparametric inference for interventional effects with multiple mediators. Journal of Causal Inference, 9(1):172–189, 2021.arxiv.org/abs/2001.06027
- [2]Bergthor Björnsson, Carl Borrebaeck, Nils Elander, et al. Digital twins to personalize medicine. Genome Medicine, 12:4, 2020.DOI
- [3]Shi Bo, Debarghya Mukherjee, and AmirEmad Ghassami. MediEncoder: Nonlinear representation learning for high-dimensional causal mediation analysis. arXiv:2606.30648, 2026.arxiv.org/abs/2606.30648
- [7]Cong Cao and Shuangge Ma. AI-driven multimodal representation learning for latent mediation structure discovery of socioeconomic disadvantage, psychosocial factors, and cardiometabolic multimorbidity: Insights from the All of Us research program. arXiv:2608.04016, 2026b.arxiv.org/abs/2608.04016

