Depth-Discounted Balancing for Treatment Effects with Hierarchical Covariates

Estimating what a treatment would do for a specific patient from observational records is hard because doctors do not assign treatments at random. A standard fix, balanced representation learning, trains a neural encoder so that treated and untreated patients look statistically alike in the learned space, and then predicts each patient's outcome under both options. The fix has a known failure: forcing the two groups to look alike also erases features that predict the outcome, which is called over-balancing. We propose a principled way to decide what to erase when covariates come from a hierarchy, such as diagnosis codes nested inside disease families. The hypothesis is that treatment choices are usually driven by coarse categories ("cardiac patient"), while outcomes also depend on fine distinctions ("which arrhythmia subtype"). If that holds, the encoder should align the two groups at the coarse levels and leave the fine levels alone.

Hyperbolic space makes this split something we can compute rather than hand-engineer. Hyperbolic space is a curved geometry in which distance from the origin naturally encodes depth in a tree. We embed patients there and penalize treated/control mismatch along horospheres, which are curved "level sets" pointing toward a direction at the boundary of the space. The penalty is discounted with depth, so coarse disagreements cost a lot and leaf-level disagreements cost little. A learned adversary picks the boundary directions, so the method finds, branch by branch, where the confounding actually sits. That branch-by-branch adaptivity is what separates the idea from simply rolling codes up to a fixed level of the ontology.

Core Claim

When confounding concentrates at shallow levels of a covariate hierarchy, and that depth varies across branches, a depth-discounted intrinsic hyperbolic balancing penalty should estimate individual effects more accurately than three alternatives. These are Euclidean balancing, hyperbolic encoders balanced with ordinary Wasserstein distance, and fixed-level code roll-up. When the hierarchy is absent or the confounding is not shallow, the method should do no worse than standard Counterfactual Regression (CFR), the neural model with separate treated and control output heads plus a balancing penalty. We will report the method as useless if it fails either test.

Relation to Prior Work

The balancing objective and its error bound come from Learning Representations for Counterfactual Inference and Estimating individual treatment effect: generalization bounds and algorithms. These papers bound the error of individual effect estimates by factual error plus a distribution distance between groups, measured in flat space. We reuse the CFR architecture and the bound's logic, but change the family of test functions that defines the distance. Two papers motivate our concern with over-balancing. Benchmarking Heterogeneous Treatment Effect Models through the Lens of Interpretability shows that balancing can suppress exactly the features that modify the effect. SCRNet responds by splitting covariates into confounders, instruments and prognostic variables and balancing only the confounders; its split is a hard partition of flat features. Spiked-CFR is our closest methodological template. It assumes selection bias lives in a low-dimensional subspace and uses an adversary to balance the worst-case subspace. We carry this "balance only where the bias lives" idea from Euclidean subspaces to depth levels of a hierarchy.

The only direct bridge between the two directions is TAHyper. It encodes a social network with a hyperbolic graph network to capture hidden confounders and balances the whole representation with a Wasserstein term. It needs an explicit graph, does not use intrinsic hyperbolic transport, and does not address over-balancing. Our setting has hierarchy in the covariates themselves and no social graph, and over-balancing is the central question.

Three papers supply our tools. The geometry comes from Poincaré Embeddings for Learning Hierarchical Representations, in which the norm of a point encodes depth. The discrepancy comes from Hyperbolic Sliced-Wasserstein via Geodesic and Horospherical Projections. That paper builds fast one-dimensional projections along horospheres using Busemann functions, but tested them only on classification and autoencoding, never on treatment/control balancing. A distortion regularizer comes from Improving Hyperbolic Representations via Gromov-Wasserstein Regularization. It keeps pairwise input distances when tabular data is pushed into hyperbolic space, which matters because prognostic structure must survive the mapping.

One paper constrains the design. Unsupervised Hierarchy Matching with Optimal Transport over Hyperbolic Spaces shows that independently learned hierarchies can be rotated or branch-shuffled relative to each other. We avoid this failure by using one shared encoder for both groups, so the two groups' embeddings are never independently learned. We will measure whether residual branch misalignment still appears.

Method

An encoder $\Phi$ maps a patient's covariates, including a set of ontology codes, into the Poincaré ball. The Poincaré ball is the unit ball with a metric that blows up near its edge. Separate output heads $h_0, h_1$ predict outcomes for the untreated and treated case. For a boundary direction $p$ (a unit vector), the Busemann function is

$$B_p(z) = \log \frac{\|p - z\|^2}{1 - \|z\|^2}.$$

It becomes very negative as $z$ moves deep into the branch pointing toward $p$. Clipping at $-\tau$ keeps the information "how far into branch $p$, up to depth $\tau$" and discards finer depth. The balancing penalty is

$$D(\Phi) = \max_{p_1,\dots,p_m} \frac{1}{m}\sum_{j=1}^{m} \int_0^{\infty} w(\tau)\, W_1\!\big(\max(B_{p_j}(Z_1), -\tau),\ \max(B_{p_j}(Z_0), -\tau)\big)\, d\tau.$$

Here $Z_1$ and $Z_0$ are the treated and control embeddings, $W_1$ is the one-dimensional Wasserstein distance (computed by sorting), $w$ is a decreasing weight, and the maximum is taken by an adversary over $m$ directions. In practice the integral over $\tau$ is evaluated on a small grid. The training loss is factual prediction error plus $\alpha D(\Phi)$ plus the Gromov-Wasserstein distortion term. Optimization uses Riemannian Adam. We start embeddings near the origin and clip norms below 1 to avoid the numerical blow-up near the boundary.

The theoretical piece adapts the bound of Shalit et al. Their bound holds when the per-unit counterfactual loss, viewed as a function of the representation, lies in the test-function family. Our family is clipped Busemann functions, discounted by $w$. Lying in this family amounts to the loss varying with deep coordinates only weakly relative to the weight $w$. This is the hyperbolic analog of the spiked assumption in Spiked-CFR. Under it, the bound is tighter than a full-Wasserstein bound, because deep fine-grained variation no longer has to be removed. We will state the assumption plainly as the price of avoiding over-balancing.

Research Program

We will build three things. The first is the estimator itself. The second is a semi-synthetic hierarchical benchmark, which TAHyper and the gap analysis note is missing beyond social graphs. The third is diagnostics that show where in the tree the method chose to balance.

In the benchmark, units are assigned sets of leaf nodes from a real taxonomy. The WordNet noun hierarchy used by Alvarez-Melis et al. is the default; an ICD-style code tree can be used where available. Treatment depends on ancestors at a depth $d_c$, and outcomes and effect modification depend on leaves. Crucially, $d_c$ varies across top-level branches, so that one branch is confounded at depth 1 and another at depth 3. A dial controls how strongly prognostic leaves correlate with the confounding ancestors, which sets the severity of over-balancing.

Baselines

The naive reference point is TARNet with the same two-headed architecture and no balancing penalty, trained on flat multi-hot code features. It shows how much balancing helps at all.

The standard balancing reference is Euclidean CFR with Wasserstein balancing as in Shalit et al.. On flat benchmarks the strongest reported numbers are from SCRNet: PEHE of 0.651 on IHDP (versus a previous best of 0.654) and policy risk of 0.215 on Jobs. PEHE is the root-mean-squared error of the estimated individual effect. On IHDP, beating SCRNet is not the goal. Matching it within run-to-run noise counts as passing the no-harm test.

The strongest competitor on hierarchical data is Spiked-CFR, because it already avoids over-balancing by adversarially balancing only a worst-case low-dimensional subspace. Its paper reports the lowest RMSE-ATE on its Reddit benchmarks, but the file gives no absolute value. We will run it on the same flat code features, with the subspace dimension tuned over the same grid size as our number of directions and depth grid.

The strongest hyperbolic competitor is a TAHyper-style model: a hyperbolic encoder with an ordinary Wasserstein penalty computed on tangent-space coordinates. We adapt it to code hierarchies by replacing the social-graph network with the same set encoder we use. The file reports TAHyper only as more than 80% lower ATE error than the next baseline on BlogCatalog. No absolute number was found on Lacuna for BlogCatalog or Flickr.

The ablation that isolates our key ingredient is our full model with constant weight $w$ and no clipping. That model is ordinary horospherical sliced-Wasserstein balancing, so comparing against it tests depth discounting alone. A second ablation removes the adversary and uses random directions.

All methods get identical data splits, the same encoder capacity, and the same hyperparameter-search budget of 50 trials per method. Selection uses a held-out factual-loss criterion that does not peek at counterfactuals. Results are reported over 20 or more data-generating seeds, using PEHE and ATE error, in line with the warnings in Really Doing Great at Estimating CATE?. Beating a baseline means lower mean PEHE with non-overlapping 95% seed intervals on the hierarchical benchmark, and no significant loss on IHDP and Jobs.

Why not just…?

Why not just roll codes up to a fixed ontology level and run Euclidean CFR on the coarse codes? This is the most serious threat. If confounding sat at one known depth everywhere, roll-up plus SCRNet-style selective balancing would likely tie our method at much lower cost. We therefore make varying confounding depth a controlled factor of the benchmark. We will run roll-up at every level, choosing the best level by the same validation rule as our method. If roll-up matches us when depth varies across branches, the hyperbolic machinery is not earning its keep, and we will report that.

Why not just use Spiked-CFR on flat embeddings? A flat low-dimensional subspace can capture "is in branch A" but not depth graded by branch without spending many dimensions. Spiked-CFR also targets text embeddings, not taxonomies. This remains an empirical question, and the head-to-head comparison at matched budget settles it.

Why not just keep the hyperbolic encoder and balance with ordinary or tangent-space Wasserstein, as TAHyper does? That still balances everything, so it should over-balance as the dial for prognostic-confounder correlation rises. The constant-weight ablation and the TAHyper-style baseline isolate this. The prediction is that their gap to our method grows with that dial and vanishes when the dial is zero.

Why not just make the Euclidean latent space bigger? Spiked-CFR shows that empirical Wasserstein estimates degrade with dimension. We include CFR at latent sizes 32 to 512 to check this directly in our setting rather than assume it.

Decisive Checks

The idea succeeds if three things hold on the hierarchical benchmark. First, our PEHE advantage over the constant-weight ablation and over the TAHyper-style model grows with the prognostic-confounder correlation. Second, it beats the best fixed roll-up level specifically in varying-depth conditions. Third, the adversary's chosen directions and its effective clipping depth recover the true confounding branch and depth, which we measure as the depth at which balanced discrepancy drops relative to the known $d_c$. On IHDP, Jobs and News, which have flat covariates, it must match CFR and SCRNet. We will also measure branch alignment between treated and control embeddings within each subtree, to confirm that the permutation failure from Alvarez-Melis et al. does not appear under a shared encoder. If roll-up ties us under varying depth, or our method hurts on IHDP, the claim is refuted.