Many tables have a column with thousands of distinct values, such as hospital IDs, diagnosis codes or property hosts. Autoencoders, networks that compress each row into a few numbers and then rebuild the row from them, can now handle such columns without blowing up in size. What they cannot do is say what the category did. A clinician compressing inpatient records wants to know three things: how much of a patient's cost is attributable to which hospital they went to, how much to the patient's underlying state, and for which hospitals the relationship between severity and cost is different. Today's best high-cardinality autoencoders mix all three inside an opaque decoder.
We propose a decoder that separates them by construction. The reconstruction is written as a sum of four parts: a constant, an effect of the compressed patient state, a per-category offset, and a low-rank interaction between the two. The key move is to factor the interaction as a latent-dependent part times a per-category loading. With that factorization, the conditions that make such a decomposition unique (each part averages to zero over the others) reduce to two simple centering operations. One centers over the latent prior. The other is a frequency-weighted centering over categories. Both can be imposed exactly by subtraction at every step instead of being chased with a penalty. Shrinkage priors on the per-category terms pull rare categories toward "no special effect," so the explanation for a value seen twice is honest rather than memorized.
Core Claim
The claim is that a rank-$r$ factorized decoder with exact centering and shrinkage gives per-category main effects and interaction loadings with three properties. They are stable across reruns. They recover ground truth on synthetic data, even for rare categories. And they cost little reconstruction quality relative to unconstrained high-cardinality autoencoders. The rank $r$ is an explicit knob along the accuracy-interpretability curve. At $r=0$ the model reduces to an additive random-intercept autoencoder; as $r$ grows the decoder approaches a black box. The note's contribution is to measure that curve on real high-cardinality data, and to show where on it the explanations stop being trustworthy.
Concretely, for a row with continuous latent $z$ and category level $k$, the decoder output is
$$\hat{x}(z,k) = f_0 + f_z(z) + b_k + G(z)\,a_k,$$
where $f_0$ is a constant vector over output columns, $f_z$ is a neural network, $b_k$ is a per-level offset vector, $G(z)$ is a neural network returning a $D\times r$ matrix ($D$ output dimensions, $r$ interaction rank), and $a_k \in \mathbb{R}^r$ is a per-level loading. We impose
$$\mathbb{E}_{p(z)}[f_z(z)] = 0,\quad \mathbb{E}_{p(z)}[G(z)] = 0,\quad \sum_k \pi_k b_k = 0,\quad \sum_k \pi_k a_k = 0,$$
where $p(z)$ is the latent prior and $\pi_k$ the empirical frequency of level $k$. Because the interaction is a product, these four conditions imply that it averages to zero over $z$ for every $k$ and over $k$ for every $z$. Those are exactly the functional ANOVA identifiability conditions. The $b_k$ and $a_k$ receive Gaussian priors with learned variances, giving mixed-model shrinkage. Categorical output columns are reconstructed in embedding space, so the same decomposition applies to them as vectors.
Where This Sits
Three papers motivate the design and also constrain it.
Neural Decomposition structures a variational autoencoder's decoder as a functional ANOVA sum of latent, covariate and interaction networks. It enforces the zero-integral conditions with a Lagrangian optimizer, the Modified Differential Multiplier Method. That paper supplies our target decomposition. But it was built for binary or low-dimensional covariates. Its constraint over the covariate requires integrating across the covariate domain, which for $10^4$ sparse, unevenly observed levels is neither cheap nor stable. Our factorization replaces that integral with a weighted mean of $K$ loading vectors.
LMMVAE adds random effects to the decoder, $x_{ij} = f(u_{ij}) + b_j + \epsilon_{ij}$, and scales to over 10,000 identities. It is precisely our $r=0$ special case. It therefore already gives additive, shrunken category offsets, but it has no interaction term. Whether that missing term matters is the first empirical question here.
CardiCat shows that shared, variance-regularized encoder and decoder embeddings fix the collapse of rare categories and the parameter blow-up of one-hot VAEs. We reuse its embedding-space loss for categorical outputs, but its decoder offers no decomposition at all.
On the supervised side, NAMformer documents the "leakage" problem in models with one interpretable path and one black-box path: the black-box path absorbs the interpretable signal unless it is suppressed with feature dropout. Our exact centering is a structural answer to the same problem in the generative setting, because the interaction term cannot represent anything with a nonzero mean over either argument. NATT routes all categorical features through one Transformer, which is exactly the lumping we avoid. Exact Functional ANOVA for categorical inputs gives closed-form decompositions under dependence but only for purely categorical inputs. It is post hoc and cannot handle a continuous latent. We do not compete with it on its home ground.
Finally, two papers on shrinkage tell us rare levels must be handled with care. Regularized target encoding shows mixed-model shrinkage beats unregularized encodings across 24 OpenML datasets. LMMNN shows mixed-model losses beat plain embeddings in deep networks. Both support shrinking the long tail rather than fitting it freely.
Research Program
We will build the model as a variational autoencoder. Its encoder sees the row, including the category's CardiCat-style embedding. Its decoder is the four-part sum above.
The centering is done by projection at every forward pass. The category-side conditions are exact: subtract the $\pi$-weighted mean of $b$ and of $a$. The latent-side conditions are approximate, because the prior mean of $f_z$ and $G$ is estimated from a fixed bank of prior samples refreshed each epoch. We report the residual constraint violation as a measured quantity rather than assuming it away.
Per-level parameters $b_k$ and $a_k$ get hierarchical Gaussian priors. Their variances are learned with the evidence lower bound, the standard VAE training objective. At inference we report posterior means and standard deviations, so every category effect comes with an uncertainty. Several high-cardinality columns enter as separate additive offsets, each with its own low-rank interaction with $z$. Interactions between two high-cardinality columns are out of scope.
The analysis outputs are three. The first is a variance attribution per output column (latent, category, interaction). The second is a ranked list of levels by interaction-loading norm, each with uncertainty. The third is, for top levels, plots of how the latent-to-output curve bends for that level.
Baselines
The naive reference point is a standard variational autoencoder with one-hot categorical columns, plus a variant that drops the high-cardinality column entirely. Dropping the column tells us how much that column contributes to reconstruction at all; if the model cannot beat dropping it, nothing else matters.
The strongest existing reconstruction method is CardiCat. The best reported figure in the file is CardiCat's marginal reconstruction score of 0.80 on MIMIC-III, against 0.68 for a standard VAE. CardiCat also cuts parameters on Medicare from 226k to 75k. We will run the authors' configuration with the same latent size, embedding size, epochs and hyperparameter search budget as our model. Matching CardiCat's marginal score to within 0.02 while adding decomposed outputs counts as success; exceeding it is not required.
The strongest structured competitor is LMMVAE, which is also our $r=0$ ablation. The file gives no reported numbers for its reconstruction errors on Rossmann, Spotify or UK Biobank, so we will rerun it ourselves on identical splits. Beating it means a statistically significant reduction in held-out negative log-likelihood at some $r>0$, on the same compute.
Two ablations isolate the key ingredient. One is Neural Decomposition adapted to discrete covariates: the same decoder networks, but constraints enforced by its Lagrangian penalty with a minibatch estimate of the category average instead of exact projection. The other removes the shrinkage priors on $b_k$ and $a_k$. Each ablation is judged on rare-level effect recovery and stability, not just likelihood.
For supervised utility we include out-of-fold mixed-model target encoding with gradient boosting from Pargent et al. as an accuracy ceiling. On Airbnb the most relevant reported number is LMMNN's test mean squared error of 0.142, versus 0.158 for plain embeddings (LMMNN). We do not expect to beat that, because our model is not trained for the target. Its role is to quantify the accuracy gap.
Why not just…?
Why not just use LMMVAE, which already gives additive category offsets? This is the most serious threat. If interactions between category and latent state are weak in real tables, rank zero is the right answer and our extra machinery is unnecessary. The rank sweep settles it directly. If held-out likelihood and the CardiCat marginal score do not improve for any $r>0$ on MIMIC-III, Medicare or Rossmann, we will report that additive offsets suffice. That is itself a useful negative result about where interpretability is free. We expect the opposite on clinical data, where hospitals plausibly differ in how severity maps to cost, but the experiment decides.
Why not just train CardiCat and decompose its decoder afterwards? One can always compute a functional ANOVA of a trained decoder by sampling $z$ from the prior and averaging per level. That post-hoc decomposition is unique, so identifiability alone is not our argument. Our argument concerns rare levels and compactness. A post-hoc per-level average inherits whatever the unregularized decoder does on a level seen twice, and it has no uncertainty. A post-hoc interaction is a full function of $(z,k)$ rather than an $r$-vector per level. We will run this baseline on every dataset with identical sampling budgets. If its per-level effects are as stable across seeds and as accurate on synthetic data as ours, the contribution narrows to the rank knob and the uncertainty estimates, and we will say so.
Why not just use target encoding, gradient boosting and TreeSHAP? For a single supervised target this is probably the most accurate pipeline. Pargent et al. show it ranks first across 24 datasets. But it produces no compressed representation and no generator. It also explains only one column. And the exact categorical ANOVA paper shows that approximate attributions can credit the wrong features under dependence: on Poker Hand they credited suits instead of ranks. We position it as the supervised accuracy ceiling, not a rival in our setting, and report the gap honestly.
Why not just apply PCA and fit a linear model on the components? Components mix all columns, so effects are not attributable to any category. One-hot high-cardinality data also violates the low-rank structure PCA relies on, which is the point LMMVAE makes against PCA on correlated data. PCA enters only as a weak reference line.
Proposed Experiments
The decisive test is synthetic. We will generate tables from the model class with Zipf-distributed level frequencies over $K \in \{10^3, 10^4, 10^5\}$, a known latent dimension, known offsets, and planted rank-$r^*$ interactions on a subset of levels. Recovery error of $b_k$ and $a_k$ is reported per frequency bin. The success criterion has three parts. Rare-level estimates must shrink toward zero rather than scatter. Planted interacting levels must rank in the top by loading norm. And our model must beat both the post-hoc-decomposed CardiCat and the Lagrangian-constraint ablation on rare bins.
On real data we use the datasets the cited work used, so splits and preprocessing can follow the originals: MIMIC-III and Medicare from CardiCat, Rossmann, Spotify and UK Biobank from LMMVAE, and Airbnb with 40,000 host IDs from LMMNN. For each we sweep $r$ from 0 to 16. We report held-out negative log-likelihood, the CardiCat marginal reconstruction score, parameter count, and the fraction of output variance attributed to the interaction term. We also report two diagnostics of the explanations. One is the Spearman correlation of per-level effect rankings across five seeds and across bootstrap resamples. The other is the residual centering violation.
The headline figure is the trade-off curve: reconstruction quality against explanation stability as $r$ varies, with CardiCat and LMMVAE as fixed points. The proposal succeeds if some $r>0$ sits strictly above LMMVAE in reconstruction quality and strictly above post-hoc-decomposed CardiCat in stability. It fails informatively if the curve shows no such point.
References
- Neural Decomposition: Functional ANOVA with Variational Autoencoders
- Integrating Random Effects in Variational Autoencoders for Dimensionality Reduction of Correlated Data
- CardiCat: a Variational Autoencoder for High-Cardinality Tabular Data
- Beyond Black-Box Predictions: Identifying Marginal Feature Effects in Tabular Transformer Networks
- Interpretable Additive Tabular Transformer Networks
- Exact Functional ANOVA Decomposition for Categorical Inputs Models
- Regularized target encoding outperforms traditional methods in supervised machine learning with high cardinality features
- Using Random Effects to Account for High-Cardinality Categorical Features and Repeated Measures in Deep Neural Networks