SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.07636 · NeurIPS · 2021

Meta Two-Sample Testing: Learning Kernels for Testing with Limited Data

Danica Sutherland, Feng Liu, Wenkai Xu, Jie Lu

arXiv · PDF · Open in the Atlas

Code that ran

3 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 2 failures of our instrument; 2 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2106.07636.json · badge: /api/ran/2106.07636.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
fengliu90/MetaTesting marked official in Papers with Code
Papers with Code archive
3 ran · 2 no recorded run
FunctionStatusWhere it lives
Learner Ran
ran on a synthesized input · constructed an object; no result was computed
fengliu90/MetaTesting/MetaTST.py
code served (permissive licence) · get_code("e03c2077ec04aa3a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Learner: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

# Build a minimal config for the Learner
# Each entry is (name, param) where param depends on the layer type
config = [
    ('conv2d', [16, 3, 3, 3, 1, 1]),      # [out_ch, in_ch, k_h, k_w, stride, padding]
    ('bn', [16]),                           # [num_features]
    ('relu', []),                           # activation, no params
    ('linear', [10, 16]),                   # [out_features, in_features]
]

ARGS = {
    'config': config
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Learner — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Learner output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MMDu Ran
ran; our contract draft was wrong, not the code
fengliu90/MetaTesting/MetaTST.py
code served (permissive licence) · get_code("2260b5465b7cf689")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Create small tensors for testing
# Fea: combined feature tensor with samples from two distributions
# Shape: (4, 3) - 2 samples from X, 2 samples from Y, 3 features
Fea = torch.randn(4, 3)

# Fea_org: original feature tensor (same shape as Fea)
Fea_org = torch.randn(4, 3)

# len_s: number of samples in the first distribution (X)
# This splits Fea into X (first 2 rows) and Y (last 2 rows)
len_s = 2

# sigma: bandwidth parameter for the RBF kernel
sigma = 1.0

# sigma0: bandwidth parameter for the original space kernel
sigma0 = 0.1

# epsilon: small constant for smoothing
epsilon = 1e-10

# is_smooth: whether to use smooth kernel combination
is_smooth = True

# is_var_computed: whether to compute variance
is_var_computed = True

# use_1sample_U: whether to use 1-sample U-statistic for xy term
use_1sample_U = True

ARGS = {
    'Fea': Fea,
    'len_s': len_s,
    'Fea_org': Fea_org,
    'sigma': sigma,
    'sigma0': sigma0,
    'epsilon': epsilon,
    'is_smooth': is_smooth,
    'is_var_computed': is_var_computed,
    'use_1sample_U': use_1sample_U
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
MatConvert Ran
ran; our contract draft was wrong, not the code
fengliu90/MetaTesting/MetaTST.py
code served (permissive licence) · get_code("d80fe88c6dce6a75")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Create a small numpy array to convert
x = np.random.randn(2, 4).astype(np.float32)

# Use CPU device instead of CUDA
device = torch.device('cpu')

# Define dtype
dtype = torch.float

ARGS = {
    'x': x,
    'device': device,
    'dtype': dtype
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Meta Not yet run
unverified (harvested, no recorded run)
fengliu90/MetaTesting/MetaTST.py
code served (permissive licence) · get_code("74fa9416562d911e")
How it ran

no invocation recorded.

h1_mean_var_gram Not yet run
unverified (harvested, no recorded run)
fengliu90/MetaTesting/MetaTST.py
code served (permissive licence) · get_code("511ae80b14ef8561")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 3 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
MatConvert
brick of this paper's assembly: helper
2 other papers
2 later
2306.08777 (2023-06)
MMD-FUSE: Learning and Combining Kernels for Two-Sample Testing Without Data Splitting
2507.12843 (2025-07)
Are Two Datasets Close Enough With Statistical Significance? A Kernel Distributional Closeness Testing Approach
h1_mean_var_gram
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2506.05047 (2025-06)
Reliably Detecting Model Failures in Deployment Without Labels

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Modern kernel-based two-sample tests have shown great success in distinguishing complex, high-dimensional distributions by learning appropriate kernels (or, as a special case, classifiers). Previous work, however, has assumed that many samples are observed from both of the distributions being distinguished. In realistic scenarios with very limited numbers of data samples, it can be challenging to identify a kernel powerful enough to distinguish complex distributions. We address this issue by introducing the problem of meta two-sample testing (M2ST), which aims to exploit (abundant) auxiliary data on related tasks to find an algorithm that can quickly identify a powerful test on new target tasks. We propose two specific algorithms for this task: a generic scheme which improves over baselines, and a more tailored approach which performs even better. We provide both theoretical justification and empirical evidence that our proposed meta-testing schemes outperform learning kernel-based tests directly from scarce observations, and identify when such schemes will be successful.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2106.07636")
get_code_for_paper("2106.07636")
have("2106.07636")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2106.07636.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2106.07636.svg)](https://syntology.ai/paper/2106.07636)

Connect an agent — have() is free.