Microbiome and single-cell profiles are compositions: vectors of relative abundances that sum to one, measured by counting a finite number of sequencing reads. When a classifier must learn a new disease or cell type from five or ten labelled examples, two kinds of noise get mixed together. One is real biological variation within the class. The other is counting noise: a sample sequenced at low depth, or a taxon observed zero times, tells us very little about the true proportion. Current few-shot methods that represent each class as a probability distribution learn per-sample uncertainty with a neural network. Current compositional methods remove zeros with an arbitrary "pseudocount", a small constant added before taking logarithms. Neither uses the fact that the counting process itself states how uncertain each coordinate of each sample is.
We propose a prototype classifier for compositional data that gets each sample's uncertainty from its counts, and gets each class's spread from the taxonomy tree. Every sample becomes a Gaussian over its true log-ratio coordinates, obtained from a multinomial likelihood rather than a pseudocount. Zeros and shallow samples therefore become wide, low-weight coordinates instead of fabricated values. The coordinates are tree-structured log-ratio contrasts, meaning comparisons between sibling branches of a taxonomy. In that basis a class covariance with only one variance per tree contrast is a plausible few-shot model, and the variances can be shared across tasks and shrunk by tree depth. The bet is specific. In low-sample, low-depth regimes, weighting each support sample by its count-derived precision, separately for each tree contrast, should beat both pseudocount Gaussian prototypes and learned-variance prototypes. The gain should grow as sequencing depth falls.
Core Claim
The obvious combination of the two directions is "Gaussian prototypes in isometric log-ratio space". Isometric log-ratio coordinates are an orthonormal coordinate system for the simplex that turns proportions into unconstrained real vectors. That combination is not really new. A Gaussian in these coordinates is a logistic-normal distribution on the simplex, and these coordinates are a rotation of centered log-ratio coordinates. So "pseudocount, then centered log-ratio, then Gaussian prototypes", the reviewer's first suggested baseline, already is that model up to a change of basis. Putting prototypes on the simplex gains nothing by itself.
We claim that two other ingredients carry the gain. The first is a measurement model that turns counts into per-sample, per-coordinate posterior uncertainty, which then sets the support-set weighting. The second is a covariance structure aligned with a biological hierarchy, which makes class spread estimable from a handful of samples. We test each with an ablation that removes it.
Model
We start from a sample with counts $n_i \in \mathbb{N}^D$ over $D$ taxa or genes and total depth $N_i$. We model the counts as multinomial draws from a latent composition whose tree log-ratio coordinates are $\eta_i \in \mathbb{R}^{D-1}$. The coordinates come from the PolyILR basis of Tree-Structured Orthonormal Decomposition of the Aitchison Simplex. That paper builds an orthonormal log-ratio basis for any non-binary tree, such as a taxonomy or cell ontology, using Helmert contrasts at each parent node. We reuse its basis as-is.
A Laplace approximation of the posterior over $\eta_i$, taken around its most likely value under a weak prior, gives a mean $m_i$ and a precision matrix $P_i$. We take the diagonal of $P_i$ in the PolyILR basis, $\pi_{ij}$ for contrast $j$. This is the same "find the most likely value, then approximate the posterior spread" strategy that Scalable Inference for Bayesian Multinomial Logistic-Normal Dynamic Linear Models uses to avoid Markov chain Monte Carlo sampling in time series. We apply it per sample, in a classification setting.
A contrast whose subtrees received almost no reads has a small $\pi_{ij}$. A deeply sequenced contrast has a large one.
Each class $c$ has a mean $\mu_c$ and a variance $s_{cj}^2$ per contrast. Each variance is a shared, depth-shrunk base variance (meta-learned across training tasks) times a class-level scale. Given $k$ support samples, the posterior over $\mu_{cj}$ is a closed-form precision-weighted average:
$$\hat\mu_{cj} = \frac{\sum_{i=1}^{k} w_{ij}\, m_{ij}}{\tau_j^{-2} + \sum_{i=1}^{k} w_{ij}}, \qquad w_{ij} = \frac{1}{s_{cj}^2 + \pi_{ij}^{-1}},$$
Here $\tau_j^2$ is a prior variance that shrinks toward a meta-learned global center. A query $q$ is scored by its marginal log-likelihood under each class, summed over contrasts:
$$\log p(m_q \mid c) = \sum_j \log \mathcal{N}\!\left(m_{qj};\ \hat\mu_{cj},\ s_{cj}^2 + \pi_{qj}^{-1} + v_{cj}\right),$$
where $v_{cj}$ is the posterior variance of $\hat\mu_{cj}$.
The weight $w_{ij}$ plays the same role as the variance-weighted support aggregation of Variational Few-Shot Learning. That paper predicts a diagonal Gaussian per image with a network and down-weights high-variance shots. Our difference is that $\pi_{ij}$ is computed from the counts rather than learned. It is also resolved per tree contrast, so a sample can be trusted at the phylum level and ignored at the genus level.
The parameter count matters. A diagonal covariance in the PolyILR basis is a non-diagonal, hierarchy-structured covariance in raw log-ratio space with only $D-1$ parameters. That addresses the ill-posed few-shot covariance problem without assuming independent taxa.
Research Program
We build the estimator above in two forms. The first is a shallow form with no learned encoder: Laplace posteriors plus closed-form prototypes, with only the shared per-contrast variances and shrinkage meta-learned over episodes. The second is an optional form in which a small learned linear map acts on the contrast coordinates before prototyping, while the count-derived precisions are carried through it.
Episodes are drawn from many disease and cohort pairs in curatedMetagenomicData v3 for microbiomes, and from DISCO cell types for single cells, with the Cell Ontology as the tree.
We analyze three questions. The first is whether the benefit tracks counting noise, tested by subsampling reads to controlled depths. The second is whether it depends on the correct tree, tested by swapping in degree-matched random trees with the same number of contrasts. The third is whether it is calibrated, measured with Brier score and expected calibration error alongside accuracy and AUC.
PolyILR's own known weakness is that it assumes a fixed, correct tree. We do not try to fix this. We measure how much our method degrades under tree corruption, by pruning or misplacing a fraction of nodes.
Baselines
The naive reference point is a deterministic prototype classifier on pseudocount centered log-ratios: add 0.5 to every count, take centered log-ratios, average each class's support samples, and classify the query by nearest mean. Any method that cannot beat this has no business being more complicated.
The direct probabilistic competitor is Variational Few-Shot Learning applied to the same pseudocount centered log-ratio input. That method predicts a diagonal Gaussian per sample with a learned network and aggregates shots by variance weighting. It is the strongest existing probabilistic prototype method in the file, reporting 61.23% versus roughly 49% for Prototypical Networks on 5-way 1-shot miniImageNet. It could in principle learn the heteroscedasticity we derive from counts, which makes it the right test of whether the measurement model adds anything. We give it the same episodes, the same meta-training cohorts, and a hyperparameter search budget matched to ours in number of trials. We feed it sequencing depth as an extra input, so it is not handicapped by lacking information we use.
The geometry competitor follows InfoGlobe and Reproducing Kernels and New Approaches in Compositional Data Analysis. Both map compositions to the sphere with a square root and so need no pseudocount. We run prototypes with angular (cosine) distance on square-root-transformed proportions, with the same episodes and tuning budget.
For the full-data setting we report BCGLMM from Bayesian compositional generalized linear mixed models for disease prediction using microbiome data. It is a Bayesian regression with sum-to-zero coefficients and a phylogeny-aware prior, and it reports a cross-validated AUC of 0.702 on American Gut inflammatory bowel disease prediction. Our method is not designed to win at full data. Matching that figure within its uncertainty when given all labels would show we lose nothing, and the meaningful comparison is the few-shot curve below it.
For leave-one-country-out colorectal cancer detection on the seven-country cohort of Multi-cohort metagenomics reveals strain functional heterogeneity and demonstrates fecal microbial load correction improves colorectal cancer diagnostic models, no reported result was found on Lacuna for the per-country AUC. We therefore rerun an L1-regularized logistic regression on genus-level centered log-ratios as the reference. That study found genus and species markers generalize best, so this is the fair strong default. For few-shot cell-type annotation on DISCO, no reported result was found on Lacuna. All baselines there are rerun.
Two ablations isolate the key ingredients. In "posterior mean, uniform weights", each sample is replaced by its Laplace posterior mean (a principled smoothing of zeros) but all shots are averaged equally. This separates better zero handling from precision weighting. In "random tree", the PolyILR basis is built on a degree-matched random tree. This separates the hierarchy from simply having some orthonormal log-ratio basis.
Beating a baseline means a paired improvement in 5-way and binary few-shot AUC across at least 600 episodes, with a confidence interval excluding zero, at k of 5 or less. It also means calibration no worse than the baseline's.
Why not just…?
Why not just add a pseudocount and run Gaussian prototypes in log-ratio space? This is the baseline the proposal is built to beat, and the argument for it is strong because it is mathematically the same family of class distributions as ours. Where it differs is that it treats a zero in a 2,000-read sample and a zero in a 200,000-read sample as equally informative. Tree-Structured Orthonormal Decomposition of the Aitchison Simplex already names pseudocounts as an ad-hoc distortion, and InfoGlobe shows log-based single-cell representations preserving true distances poorly (Spearman 0.36 for scVI versus 0.88 for Fisher-Rao geometry). Neither result is a few-shot classification result, though. The depth-subsampling experiment settles it: if our margin over this baseline does not widen as depth falls, the measurement model is not doing the work.
Why not just smooth the zeros properly and skip the weighting? A posterior-mean estimate under a multinomial model is a better pseudocount, and it might capture most of the gain. This is a real threat. The "posterior mean, uniform weights" ablation tests it directly. If the ablation matches the full model, we report that the contribution is principled smoothing, and the per-contrast weighting claim fails.
Why not just let a network learn the per-sample variance, as variational few-shot learning does? With depth provided as an input, a network could learn heteroscedastic noise. It must do so from the meta-training cohorts, however. Counting noise follows a known law that transfers to unseen cohorts and depths without learning, whereas a learned variance must extrapolate. We expect our advantage to be largest on held-out countries with depth distributions unlike training. If the learned version ties us there, the analytic route has no practical edge.
Why not just use the square-root sphere and avoid log-ratios altogether? Reproducing Kernels and New Approaches in Compositional Data Analysis shows the sphere handles boundary zeros natively. But that construction offers no per-sample uncertainty and no tree-aligned coordinates. It is run as a baseline. If it wins, the conclusion is that geometry matters more than uncertainty, which is a useful negative result.
Why not just use plain softmax networks, given that Narayanan et al. found they can beat log-ratio layers? That finding concerns end-to-end networks with ample data. With five labelled samples per class a deep classifier has little to fit. We include a fine-tuned multilayer perceptron with a softmax output on centered log-ratio inputs in the few-shot runs to confirm this rather than assume it.
Proposed Experiments
The main experiment is few-shot disease classification in cMD3. We meta-train on disease and cohort pairs, then evaluate on held-out diseases at k of 1, 5 and 10. A second experiment is the seven-country colorectal cancer cohort under leave-one-country-out adaptation, with k target-country labels. A third is few-shot cell-type annotation on DISCO, using the Cell Ontology as the tree. As a full-data sanity check, we compare against BCGLMM's 0.702 AUC on American Gut inflammatory bowel disease prediction.
Three checks decide the outcome. The first is depth subsampling, at 1k, 5k, 20k and full reads. The predicted signature is a gap over the pseudocount baseline that grows monotonically as depth shrinks. The second is the random-tree ablation, where the true taxonomy should beat degree-matched random trees in few-shot AUC, with the gap growing as k falls and covariance estimation gets harder. The third is the uniform-weight ablation, which must trail the full model for the precision-weighting claim to stand.
We also check calibration on held-out countries, where count-derived variance should produce lower expected calibration error than learned variance. Finally, a synthetic sanity check uses compositions drawn from a known logistic-normal class model and then multinomially sampled. There the method's per-contrast weights should match the oracle weights, and the accuracy gap to the oracle should shrink with k.
References
- Tree-Structured Orthonormal Decomposition of the Aitchison Simplex
- Scalable Inference for Bayesian Multinomial Logistic-Normal Dynamic Linear Models
- Variational Few-Shot Learning
- InfoGlobe: Local-and-Global Information-Preserving Statistical Manifold Learning for Single-Cell Transcriptomics
- Reproducing Kernels and New Approaches in Compositional Data Analysis
- Bayesian compositional generalized linear mixed models for disease prediction using microbiome data
- Multi-cohort metagenomics reveals strain functional heterogeneity and demonstrates fecal microbial load correction improves colorectal cancer diagnostic models
- Adaptation of Compositional Data Analysis in Deep Learning to Predict Pasture Biomass Proportions