Abstract
Estimating mutual information (MI) from samples is central to many scientific fields, yet modern neural estimators fall short when data is scarce and must be fit anew for every distribution. We present ALICE, a foundation model that removes per-distribution training while achieving competitive accuracy. Trained exclusively on synthetic distributions, ALICE acts as an in-context estimator of rectified-flow velocity fields: conditioned on samples of an unseen distribution, it estimates that distribution's velocity field, and MI follows from a fixed identity that integrates the squared difference between the joint and conditional fields. Validated on a standard benchmark and applied to biology, genetics, and neuroscience data it has never seen, a single model closes the gap with estimators trained separately for each distribution, across data dimensionalities and sample sizes.
Method
Mutual information from velocity fields
For \(X\in\mathbb{R}^{d_x}\) and \(Y\in\mathbb{R}^{d_y}\), mutual information is the KL divergence between the joint law and the product of its marginals,
Let \(z_0=(x_0,y_0)\sim p_{XY}\) be a clean joint sample and \(\epsilon\) an independent standard Gaussian perturbation. The rectified-flow interpolant \(z_t=(1-t)\,z_0+t\,\epsilon\), \(t\in[0,1]\), has velocity field
With \(\vel_t(x\mid y_0)\) and \(\vel_t(y\mid x_0)\) the velocity fields of the conditionals \(p_{X\mid Y=y_0}\) and \(p_{Y\mid X=x_0}\), and \(u|_X\), \(u|_Y\) the block selections of a vector, MI is a time integral of squared velocity differences:
The in-context velocity field
Evaluating this identity normally requires training one model per distribution. ALICE instead amortizes velocity-field estimation: a single Transformer maps a clean context and a query to a velocity,
where \(\ctx\) holds \(n\) clean samples from the unseen distribution and the mask \(m\in\{0,1\}^d\) marks the coordinates that are diffused. The context determines which field the model represents; the query gives where it is evaluated. Training uses a masked flow-matching objective on synthetic distributions and no MI labels.
Monte Carlo estimator
Each draw \(i\) samples a clean point \(z_0^{(i)}\), a time \(t_i\sim\cU[0,1]\), and a perturbation \(\epsilon^{(i)}\) shared by three masked queries, with \(m_{XY}=(\indone_X,\indone_Y)\), \(m_X=(\indone_X,\indzero_Y)\), and \(m_Y=(\indzero_X,\indone_Y)\):
The Monte Carlo estimator with \(N_{\mathrm{MC}}\) draws is
Everything that depends only on \(\ctx\) is computed once and reused across queries.
Quickstart
Install with uv, load a checkpoint, and estimate the MI of joint samples whose columns are split between \(X\) and \(Y\).
git clone https://github.com/eurecom-probai/alice.git
cd alice
uv sync --locked
import torch
from alice import estimate_mi_fast, load_model
model = load_model("eurecom-probai/alice-1.0-base", device="cpu")
# 1024 joint samples of a correlated Gaussian pair; I(X;Y) = -0.5 * log(1 - 0.7**2)
rho = 0.7
x = torch.randn(1024, 1)
y = rho * x + (1 - rho**2) ** 0.5 * torch.randn(1024, 1)
mi, std_err = estimate_mi_fast(
model,
torch.cat((x, y), dim=1),
slice(0, 1), # columns of X
slice(1, 2), # columns of Y
return_std=True,
)
print(f"{mi:.3f} +/- {std_err:.3f} nats")
Checkpoints load custom model code with trust_remote_code=True; review the
source and pin a revision.
Models
Two ALICE 1.0 checkpoints are available on the Hugging Face Hub under the PolyForm Noncommercial License 1.0.0.
| Checkpoint | Parameters | Width | Layers | Heads | Weights |
|---|---|---|---|---|---|
| alice-1.0-small | 19.3M | 384 | 5 | 8 | float32 |
| alice-1.0-base | 85.2M | 768 | 6 | 12 | float32 |
Interactive demo
The Hugging Face Space runs ALICE 1.0 Small on correlated Gaussian pairs and compares its estimate with the analytic value.
BibTeX
@misc{franzese2026alice,
author = {Franzese, Giulio and Rossi, Simone and Michiardi, Pietro},
title = {{ALICE}: In-context, Zero-shot, Mutual Information Estimation},
year = {2026},
eprint = {2609.34962},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
url = {https://arxiv.org/abs/2609.34962},
}