A reference implementation of
Mike Nguyen and Nicole Mücke. Random Features for Operator-Valued Kernels: Bridging Kernel Methods and Neural Operators. Proceedings of the 29th International Conference on Artificial Intelligence and Statistics (AISTATS), PMLR 300:1495–1503, 2026. arXiv:2603.00971
This package implements theory developed by those authors. No claim of originality is made
for any of the theorems. What is offered here is a transparent, tested implementation of
the estimator and the parameter prescriptions, together with a set of reproducible numerical
checks whose outcomes — including the places where a measurement does not match a naive
reading of the theory — are written to results/ and summarized honestly below.
The implementation is written from scratch in NumPy and SciPy. It does not wrap, vendor, or depend on any existing random-feature codebase.
Re-run anytime with the scripts under scripts/. Latest laptop run:
| Experiment | Headline |
|---|---|
Wall-time vs exact OVK-KRR (spectral, quick) |
~27.7× median faster at matched excess risk (range ~25–126×); exact still wins on risk at matched (n) |
Wall-time (poisson NTK, quick) |
~3.6× median at matched risk (range ~1.6–44×) — speedup shrinks when feature dim is large |
| Feature threshold (Fig.1 / App. A.3, quick) | (M\sim\sqrt{n},p) hit the plateau in 7/8 cases; worst excess over plateau +8.7% |
Artifacts: results/walltime_*.json, results/feature_threshold*.csv, results/feature_threshold_heatmap.png.
See also docs/WHY_THIS_PAIR.md for how this pairs with SpecInv — and why neither repo is a Nature breakthrough by itself.
The setting is regression from an input space
Assumption 2.1 (integral representation). The kernel is a mixture of rank-one operator-valued features,
Drawing
The estimator (2.11). With
where
Assumptions 3.2 and 3.3. The source condition
Theorem 3.4. If the filter has qualification
provided
So random features attain the same minimax rate as the exact kernel method. In the
well-specified capacity-independent case
A fuller derivation of how each object maps onto code is in
docs/mathematical-summary.md.
python -m pip install -e ".[dev]"Requires Python ≥ 3.10, NumPy and SciPy. Everything here runs on a laptop in minutes; there is no GPU code and no deep learning framework.
Learn the Darcy solution operator with operator-valued NTK random features and Brakhage's
kerop demo darcy --n-train 800 --n-points 33 --filter nu_method --nu 2KerOp demo: the darcy solution operator
--------------------------------------------------------------
grid points n_x (= d_v) 33
feature dimension d_tilde 8
summands p = 1 + d_tilde 9
training pairs n 800
random features M 255
coefficient dimension pM 2295
filter NuMethod(lam=1.00169e-05, iterations=316, step=1, nu=2)
excess risk ||G_rho - S_M F|| 0.000109
relative to ||G_rho|| 0.137%
Other entry points:
kerop demo poisson --filter landweber # gradient descent with early stopping
kerop filters # measured constants and qualification of each family
kerop theory --r 0.5 --b 1.0 --n 10000 # what Theorem 3.4 prescribes
kerop export-filter-contract # forward spectrum for SpecInv (docs/FILTER_CONTRACT.md)In Python:
import numpy as np
from kerop.data.pde import PoissonDataset
from kerop.estimators import VectorValuedRFRegressor
from kerop.features import OperatorNTKFeatures
from kerop.filters import NuMethod
from kerop.metrics import excess_risk
dataset = PoissonDataset(n_points=33)
rng = np.random.default_rng(0)
train, test = dataset.sample(800, rng), dataset.sample(400, rng)
features = OperatorNTKFeatures(
dataset.feature_dim, dataset.n_points, n_features=256, rng=rng,
output_scale=dataset.output_scale(),
)
estimator = VectorValuedRFRegressor(
features, filter_obj=NuMethod.from_iterations(200, nu=2.0)
).fit(dataset.lift(train.fields), train.outputs)
print(excess_risk(estimator.predict(dataset.lift(test.fields)), test.targets))python scripts/run_all.py # everything, a few minutes
python scripts/run_all.py --quick # smoke test, well under a minuteEach script writes a JSON record (settings, provenance, every measurement) and flat CSVs to
results/, and scripts/collect_summary.py distills them into results/summary.json and
results/summary.md, stating each falsifiable claim and whether the measurement supports
it. Individual experiments:
| Script | Question |
|---|---|
run_filter_diagnostics.py |
Do the filters satisfy Definition 2.2, and what is their qualification? |
run_rate_experiment.py |
Does the excess risk decay at the exponent |
run_feature_threshold.py |
Does |
run_walltime_benchmark.py |
Is it faster than exact operator-valued kernel regression? |
See docs/reproducing.md for the experimental protocol, including
what is held fixed and why.
Run python scripts/run_all.py to populate this section; the committed results/ directory
holds the output of the run described in results/summary.json.
| Module | Contents |
|---|---|
kerop.filters |
Tikhonov, iterated Tikhonov, Landweber (gradient descent), spectral cut-off, heavy-ball, Brakhage's |
kerop.features |
Vector-valued random feature maps satisfying Assumption 2.1: importance-sampled Mercer features, the scalar and operator-valued NTK features of a shallow network and neural operator, and separable random Fourier features. |
kerop.kernels |
The exact operator-valued kernels those maps approximate, with the NTK limits in closed form via the arc-cosine kernels. |
kerop.estimators |
The random feature estimator (2.11), with both the |
kerop.theory |
Theorem 3.4 and Corollary 3.5 as executable prescriptions: |
kerop.data |
A synthetic instance with prescribed |
kerop.experiments |
The four experiment drivers. |
kerop.filter_contract |
Versioned npz/JSON export of the forward spectrum SpecInv loads. |
The two estimators share the filter implementations verbatim, so a comparison between them isolates the effect of the random feature approximation and nothing else.
This is a reference implementation of published theory, not a validation of it, and several things deserve to be stated plainly.
What the rate experiment can and cannot show. Theorem 3.4 is an asymptotic upper bound
with unspecified constants. Over a bounded range of
The synthetic instance has finite rank. The Mercer expansion is truncated at SpectralOperatorModel.usable_lambda_window makes that window explicit.
The regularization constant is calibrated. Theorem 3.4 fixes the exponent of
At matched sample size, exact kernel regression is more accurate. Theorem 3.4 preserves
the rate, not the constant: the random feature approximation contributes an error of order
SUSY is replaced. Appendix A.3 uses a Gaussian design at
Not implemented. The following are in the paper's scope but not here.
-
Actual neural operator training. Corollary 3.5 concerns a shallow neural operator trained
by gradient descent, whose excess risk decomposes into a finite-width term and the random
feature term. Only the second is implemented; the first,
$|G_{\theta_t}-F^M_t|=O(\log n/M_n)$ , is quoted from Nguyen & Mücke (2024) and not measured.kerop.theory.neural_operator_widthencodes the prescription but nothing trains a network. This is the largest gap. -
Second-stage sampling. Appendix A.2 requires
$n_\mathcal{X}$ collocation points drawn i.i.d. from$\mu$ with$n_\mathcal{X}\gtrsim B_T^2T^{2r}\log^2T$ . Here the collocation grid is fixed and uniform, and its effect on the rate is not studied. -
The confidence structure. The
$\log^3(2/\delta)$ and$\log^{3r+1}(1/\delta)$ factors are implemented inkerop.theorybut the experiments report means over repeats rather than high-probability bounds, so the$\delta$ -dependence is untested. -
Misspecified regime below $2r+b\le1$. Excluded by assumption, and rejected with an
explicit error by
kerop.theory.check_assumptions. -
Two-dimensional PDEs. The Poisson and Darcy operators are one-dimensional, chosen so the
solution operator is available to machine precision and the exact
$nd_v\times nd_v$ Gram matrix stays within laptop memory.
Heavy-ball is a partial case. With momentum
python -m pytest tests/ -q # ~170 tests, about 30 seconds
ruff check src tests scripts
ruff format --check src tests scripts
mypyCI runs the tests on Python 3.10–3.12, the linter, the type checker, and the experiment suite in quick mode, uploading its output as an artifact.
If you use this code, please cite the paper it implements:
@inproceedings{nguyen2026random,
title = {Random Features for Operator-Valued Kernels:
Bridging Kernel Methods and Neural Operators},
author = {Nguyen, Mike and M{\"u}cke, Nicole},
booktitle = {Proceedings of the 29th International Conference on Artificial
Intelligence and Statistics},
series = {Proceedings of Machine Learning Research},
volume = {300},
pages = {1495--1503},
year = {2026},
publisher = {PMLR},
eprint = {2603.00971},
archivePrefix = {arXiv},
primaryClass = {stat.ML}
}Background references for the machinery used here: Caponnetto & De Vito (2007) and Blanchard & Mücke (2017) for spectral regularization rates; Gerfo et al. (2008) and Engl, Hanke & Neubauer (1996, ch. 6) for the filter families and their qualifications; Rudi & Rosasco (2016) and Lanthaler & Nelsen (2023) for random features in the scalar and vector-valued kernel ridge regression cases; Pagliana & Rosasco (2019) for accelerated methods; Nguyen & Mücke (2024) for the neural operator rates that Corollary 3.5 builds on; Cho & Saul (2009) for the arc-cosine kernels used in the closed-form NTK.
MIT, see LICENSE.