Papers
Topics
Authors
Recent
Search
2000 character limit reached

Multi-Population-aware MMD (MMD-MP)

Updated 11 January 2026
  • The paper introduces MMD-MP, which omits the intra-machine similarity term to reduce variance in statistical tests for detecting heterogeneous machine-generated texts.
  • It leverages deep kernel training with robust variance estimation, achieving significant improvements in test power and AUROC over standard MMD methods.
  • MMD-MP is applicable at both paragraph and sentence levels, enabling reliable and transferable detection across various large language models and decoding strategies.

Multi-Population-aware Maximum Mean Discrepancy (MMD-MP) is an optimization method for distributional two-sample tests that addresses the challenge of detecting machine-generated texts originating from diverse LLMs. By modeling population structure among generated texts, MMD-MP produces a highly stable and powerful statistical test, significantly improving over standard MMD-based approaches when the “machine” class is itself comprised of heterogeneous subpopulations. The method is particularly effective for distinguishing between human- and machine-generated texts when the latter are drawn from multiple LLMs or decoding strategies (Zhang et al., 2024).

1. Fundamentals of Maximum Mean Discrepancy

Maximum Mean Discrepancy (MMD) quantifies the difference between two distributions PP and QQ over a domain X\mathcal{X} by embedding them in a reproducing-kernel Hilbert space (RKHS) with kernel kk. The squared MMD is

MMD2(P,Q;k)=μPμQHk2=Ex,xP[k(x,x)]+Ey,yQ[k(y,y)]2ExP,yQ[k(x,y)].\mathrm{MMD}^2(P, Q; k) = \left\| \mu_P - \mu_Q \right\|_{\mathcal{H}_k}^2 = \mathbb{E}_{x, x' \sim P} [k(x, x')] + \mathbb{E}_{y, y' \sim Q} [k(y, y')] - 2\mathbb{E}_{x \sim P, y \sim Q} [k(x, y)].

With samples {xi}i=1nPn\{x_i\}_{i=1}^n \sim P^n, {yj}j=1nQn\{y_j\}_{j=1}^n \sim Q^n, the unbiased U-statistic estimate is

MMD^u2=1n(n1)ijHij, Hij=k(xi,xj)+k(yi,yj)k(xi,yj)k(xj,yi).\widehat{\mathrm{MMD}}^2_u = \frac{1}{n(n-1)} \sum_{i \ne j} H_{ij}, \ H_{ij} = k(x_i, x_j) + k(y_i, y_j) - k(x_i, y_j) - k(x_j, y_i).

MMD has desirable theoretical properties for non-parametric hypothesis testing and is widely used for two-sample problems in text and vision domains.

2. Variance Inflation due to Multiple Populations

When employing a deep kernel kωk_\omega (parameterized, e.g., via a neural network atop a pretrained encoder such as RoBERTa) for MMD-based detection, one optimizes a test-power proxy,

J(P,Q;kω)MMD2(P,Q;kω)σH1,J(P, Q; k_\omega) \approx \frac{\mathrm{MMD}^2(P, Q; k_\omega)}{\sigma_{\mathfrak{H}_1}},

where σH12\sigma_{\mathfrak{H}_1}^2 is the asymptotic variance under the alternative. In the context of machine-generated texts, the “machine” sample SQS_Q may comprise outputs from a variety of LLMs and sampling settings, rendering QQ a mixture of subpopulations. This population heterogeneity causes the intra-class term Ey,yQ[k(y,y)]\mathbb{E}_{y, y' \sim Q}[k(y, y')] to be unstable and difficult to optimize. Empirically, this leads to increased sample variance in the MMD statistic during kernel learning; as shown in synthetic and real data (e.g., Figure 1 in the paper), this instability can impair the reliability of hypothesis tests. Detailed decomposition attributes the variance escalation mainly to Var[k(y,y)]\operatorname{Var}[k(y, y')] from subpopulation mixing (Zhang et al., 2024).

3. The Multi-Population-Aware Objective (MMD-MP)

Removal of the Intra-Machine Term

MMD-MP introduces the Multi-Population Proxy (MPP), which omits the problematic Ey,y[k(y,y)]\mathbb{E}_{y, y'}[k(y, y')] term:

MPP(P,Q;k)=Ex,xP[k(x,x)]2ExP,yQ[k(x,y)].\mathrm{MPP}(P, Q; k) = \mathbb{E}_{x, x' \sim P}[k(x, x')] - 2\mathbb{E}_{x \sim P, y \sim Q}[k(x, y)].

The unbiased U-statistic estimator for equal sample sizes nn is

MPP^u=1n(n1)ijHij,Hij=k(xi,xj)k(xi,yj)k(xj,yi).\widehat{\mathrm{MPP}}_u = \frac{1}{n(n-1)} \sum_{i \ne j} H^*_{ij}, \qquad H^*_{ij} = k(x_i, x_j) - k(x_i, y_j) - k(x_j, y_i).

By bypassing the generator–generator similarity term, MMD-MP directly targets human–machine discrepancies.

Variance Estimation and Optimization

Under the alternative, the asymptotic distribution is

n(MPP^uMPP)dN(0,σH12),\sqrt{n} \left( \widehat{\mathrm{MPP}}_u - \mathrm{MPP} \right) \xrightarrow{d} \mathcal{N}(0, \sigma_{\mathfrak{H}_1^*}^2),

where

σH12=4(E[H12H13]E[H12]2).\sigma_{\mathfrak{H}_1^*}^2 = 4 \left( \mathbb{E}[H^*_{12} H^*_{13}] - \mathbb{E}[H^*_{12}]^2 \right).

The objective optimized is

JMP(P,Q;kω)=MPP^u(SP,SQ;kω)σ^H12(SP,SQ;kω)+λ,J_{\rm MP}(P, Q; k_\omega) = \frac{\widehat{\mathrm{MPP}}_u(S_P, S_Q; k_\omega)}{\sqrt{\widehat{\sigma}_{\mathfrak{H}_1^*}^2(S_P, S_Q; k_\omega) + \lambda}},

where λ\lambda is a small ridge parameter for numerical stability. This construction yields lower variance and increased stability during kernel training, particularly in multi-generator contexts.

4. Algorithmic Structure

Training the Deep Kernel

  • Initialize with human samples SPtrS_P^{tr}, machine samples SQtrS_Q^{tr}, fixed encoder f^\hat{f}, kernel parameters ω\omega, hyperparameters λ\lambda, η\eta, and TmaxT_{\max}.
  • For each iteration: build kωk_\omega, compute MPP^u\widehat{\mathrm{MPP}}_u and variance σ^H12\widehat{\sigma}_{\mathfrak{H}_1^*}^2, update ω\omega to maximize JMPJ_{\rm MP} via Adam.
  • Output is an optimized deep kernel kωk_\omega.

Paragraph-Level Detection

  • Given test sets SPteS_P^{te} and SQteS_Q^{te}, compute MMD^u2\widehat{\mathrm{MMD}}_u^2.
  • Generate the null via permutation, calculate the pp-value as the fraction of permuted MMDs exceeding the observed value.
  • Suitable for batch paragraph-based detection scenarios.

Sentence-Level Detection

  • Fix a reference set of human sentences SreS^{re}.
  • For each candidate x~\tilde{x}, compute the “biased” MMD estimate MMD^b2(Sre,{x~})\widehat{\mathrm{MMD}}_b^2(S^{re}, \{\tilde{x}\}).
  • Use the resulting scores to evaluate AUROC for distinguishing single machine-generated versus human sentences.

5. Theoretical Guarantees

  • The estimator MPP^u\widehat{\mathrm{MPP}}_u is asymptotically normal:

n(MPP^uMPP)N(0,σH12).\sqrt{n} (\widehat{\mathrm{MPP}}_u - \mathrm{MPP}) \to \mathcal{N}(0, \sigma_{\mathfrak{H}_1^*}^2).

  • For large nn, test power satisfies

PowerΦ(n(MPP+R(Q))σH1rnσH1),\mathrm{Power} \approx \Phi\left( \frac{\sqrt{n} ( \mathrm{MPP} + R(Q))}{\sigma_{\mathfrak{H}_1^*}} - \frac{r}{\sqrt{n} \sigma_{\mathfrak{H}_1^*}} \right),

showing that maximizing MPP/σH1\mathrm{MPP}/\sigma_{\mathfrak{H}_1^*} aligns with statistical power maximization.

  • Uniform convergence (Theorem 1) produces

supω:σω2s2J^J=O(n1/3),\sup_{\omega: \sigma_{\omega}^2 \geq s^2} |\hat{J} - J| = O(n^{-1/3}),

under standard kernel regularity assumptions, confirming consistency for the learning objective.

6. Empirical Evaluation

Data and Benchmarks

  • Paragraph detection: HC3 (Q&A, ChatGPT vs. human), XSum (news).
  • Sentence detection: same sources.
  • Machine-generated spans include GPT-2 small/medium, GPT-3 small (∼550M), GPT-Neo small/large, GPT-j-6B, ChatGPT (GPT-3.5), GPT4All-j.

Baselines

Method Detection Type Kernel Type
MMD-O Paragraph/Sentence RBF kernel
MMD-D Paragraph/Sentence Deep kernel
C2ST-S/L Paragraph/Sentence Classifier two-sample
DetectGPT/OpenAI-D/CE-Clf Single-instance Direct/Classifier features

Metrics

  • Paragraph-level: test power at α = 0.05.
  • Sentence-level: AUROC.

Performance Summary

  • On synthetic 4-Gaussian mixtures, MMD-MP outperforms MMD-D by up to +9 points in test power as sample variance grows.
  • On HC3 (3100 paras), MMD-MP achieves 93.2% power vs. 91.8% for MMD-D; similar gains observed on GPT3-S, Neo-S, and mixed settings.
  • For HC3 (1000 paras), average +2–6 points improvement over MMD-D across both single- and multi-generator configurations.
  • In unbalanced settings (2000 human vs. 400 machine): +7–14 point test power and +4–9 point AUROC improvement over MMD-D.
  • For sentence-level detection, MMD-MP surpasses DetectGPT, ChatGPT-D, and the CE-classifier by 1–2 points AUROC on ChatGPT, and by 5–15 points AUSROC on more challenging models.
  • Transfer experiments (trained on ChatGPT+GPT-2, tested on GPT-Neo-L, GPT-j, or GPT4All-j) show gains of +23–28 points test power and +3–5 points AUROC over MMD-D.
  • t-SNE visualizations demonstrate that MMD-MP produces more clustered human texts and decorrelated machine-generated clusters, validating reduced multi-population variance.

7. Practical Implementation and Significance

MMD-MP is deployable across both batch (paragraph-level) and real-time (sentence-level) machine-generated text detection scenarios. The method first compiles datasets representing both human and potentially multi-population machine-generated text. The deep kernel is trained via the MMD-MP criterion, omitting the intra-machine similarity term to control variance. Detection applies the 2-sample permutation framework for group content, or the single-instance “biased” MMD estimate for individual sentences. MMD-MP demonstrates consistent advantages in statistical power, stability, and transferability across unseen LLMs, establishing its efficacy as a robust kernel optimization method specifically designed for the multi-distributional landscape of modern text generation (Zhang et al., 2024).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Multi-Population-aware MMD (MMD-MP).