arXiv:2609.34962 ยท 2026

ALICE
In-context, Zero-shot, Mutual Information Estimation

Giulio Franzese*, Simone Rossi*, Pietro Michiardi*

EURECOM, Sophia Antipolis, France

* Equal contribution

Paper Code Models Demo BibTeX
ALICE banner: a Transformer reads context samples and returns a mutual-information estimate
ALICE, the Adaptive Latent In-Context Estimator: one model, trained once on synthetic distributions, estimates the mutual information of an unseen distribution from its samples.

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,

\[ \MI(X;Y)=\KL{p_{XY}}{p_X\otimes p_Y}. \]

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

\[ \vel_t(z)=\Ex\!\left[\,Z_0-\epsilon \mid Z_t=z\,\right]. \]

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:

\[ \MI(X;Y)=\int_0^{1}\frac{1-t}{t}\; \Ex_{x_0,\,y_0,\,\epsilon}\!\left[ \Norm{\vel_t(z_t)|_X-\vel_t(x_t\mid y_0)}^2 +\Norm{\vel_t(z_t)|_Y-\vel_t(y_t\mid x_0)}^2 \right]\d{t}. \]

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,

\[ (\ctx,\,z_t,\,t,\,m)\;\longmapsto\;\vmodel(z_t,t,m;\ctx), \qquad \ctx=\bigl\{z^{(k)}\bigr\}_{k=1}^{n}, \]

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)\):

\[ \begin{aligned} \widehat v^{(i)} &= \vmodel\bigl(z_{t_i}^{(i)},\,t_i,\,m_{XY};\,\ctx\bigr),\\[0.4em] \widehat v_X^{(i)} &= \vmodel\bigl((x_{t_i}^{(i)},\,y_0^{(i)}),\,t_i,\,m_X;\,\ctx\bigr),\\[0.4em] \widehat v_Y^{(i)} &= \vmodel\bigl((x_0^{(i)},\,y_{t_i}^{(i)}),\,t_i,\,m_Y;\,\ctx\bigr). \end{aligned} \]

The Monte Carlo estimator with \(N_{\mathrm{MC}}\) draws is

\[ \widehat{\MI}(X;Y)=\frac{1}{N_{\mathrm{MC}}}\sum_{i=1}^{N_{\mathrm{MC}}}\frac{1-t_i}{t_i} \left[ \Norm{\bigl(\widehat v^{(i)}-\widehat v_X^{(i)}\bigr)\big|_X}^2 +\Norm{\bigl(\widehat v^{(i)}-\widehat v_Y^{(i)}\bigr)\big|_Y}^2 \right]. \]

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.

CheckpointParametersWidthLayersHeadsWeights
alice-1.0-small19.3M38458float32
alice-1.0-base85.2M768612float32

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},
}