# Log-optimal two-sample testing by betting

arXiv: https://arxiv.org/abs/2611.19062 · HTML: https://mlsanity.com/paper/2611.19062/

## Key facts

- No citing papers in the map yet (data through 24 Nov 2026).
- Builds on 11 of its 32 references that are in the map.
- Submitted 14 Nov 2026.

## Builds on (most cited first, 11 of 11)

- [Online Learning: A Modern Introduction Using Convex Optimization](https://mlsanity.com/paper/1912.13213/) (2019)
- [Game-theoretic statistics and safe anytime-valid inference](https://mlsanity.com/paper/2210.01948/) (2022)
- [Universal Inference](https://mlsanity.com/paper/1912.11436/) (2019)
- [Nonparametric Two-Sample Testing by Betting](https://mlsanity.com/paper/2112.09162/) (2021)
- [Sequential Predictive Two-Sample and Independence Testing](https://mlsanity.com/paper/2305.00143/) (2023)
- [Sequential Nonparametric Testing with the Law of the Iterated Logarithm](https://mlsanity.com/paper/1506.03486/) (2015)
- [Instance-Log-Optimality of Portfolio-Based E-Processes and their Sequential Hypothesis Tests](https://mlsanity.com/paper/2504.02818/) (2025)
- [E-Valuating Classifier Two-Sample Tests](https://mlsanity.com/paper/2210.13027/) (2022)
- [Asymptotically Optimal One- and Two-Sample Testing with Kernels](https://mlsanity.com/paper/1908.10037/) (2019)
- [Generic E-Variables for Exact Sequential k-Sample Tests that allow for Optional Stopping](https://mlsanity.com/paper/2106.02693/) (2021)
- [Optimal Anytime-Valid Tests for Composite Nulls](https://mlsanity.com/paper/2512.20039/) (2025)

## Abstract (arXiv)

For each standard Borel observation space, we construct a single anytime-valid two-sample procedure that is asymptotically log-optimal for every pair of unknown probability laws and every limiting ratio of diverging sample sizes, including zero and infinity. For independent balanced pairs, the optimal log-wealth rate is 2JS(P,Q), where JS is the Jensen--Shannon divergence. Unequal sizes yield weighted Jensen--Shannon information and the one-sample limit log W(n1,n2)/n2→KL(Q|P) when n1/n2→∞. Refining finite partitions and logarithmic-loss learning with measurable characteristic kernels provide universal constructions. Our main contribution is the generality of our construction, and its connections to classical batch efficiency notions. Practical implementations allow continuous classifier fine-tuning, as demonstrated on finite alphabets, Gaussian data, and handwritten digits.
