Papers
Topics
Authors
Recent
Search
2000 character limit reached

Recursive Feature Machine (RFM)

Updated 16 July 2026
  • Recursive Feature Machine (RFM) is a kernel method that recursively updates its metric using the Average Gradient Outer Product (AGOP) to uncover task-relevant directions.
  • It bridges fixed-kernel approaches and neural networks by combining kernel regression with an iterative feature-learning mechanism that reshapes similarity relations during training.
  • Variants of RFM improve robustness, scalability, and interpretability, though theoretical challenges and efficient kernel computations remain active research areas.

Recursive Feature Machine (RFM) denotes a class of kernel methods in which the feature geometry is not fixed in advance, but is updated recursively from the model’s own input sensitivities. In the RFM literature, the central object is the average gradient outer product (AGOP), a positive semidefinite matrix built from predictor gradients; its eigenspaces define task-relevant directions, and the learned matrix MM is then used as a Mahalanobis-type metric inside the kernel. RFMs are therefore positioned between fixed-kernel methods and neural networks: they retain kernel-regression structure, but acquire an explicit iterative feature-learning mechanism that reshapes similarity relations during training (Mallinar et al., 2024, Radhakrishnan et al., 2024, Beaglehole et al., 12 Aug 2025).

1. Core mechanism and algorithmic structure

An RFM alternates between predictor fitting and metric update. For a predictor f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c, the AGOP is defined in this literature as

AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.

This matrix summarizes directions in input space along which the current predictor varies most strongly. Large diagonal entries indicate coordinatewise sensitivity, while leading eigendirections identify low-dimensional structure used by the model (Mallinar et al., 2024).

In the standard kernel-RFM formulation, one starts from a positive definite or positive semidefinite matrix M0M_0, fits a kernel predictor under the current metric, computes AGOP, and replaces the metric by a matrix function of AGOP. A representative iteration used in the literature is

f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,

followed by

Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,

with s>0s>0, often s=12s=\tfrac12. The predictor remains a kernel expansion, but the kernel geometry changes because MtM_t changes (Mallinar et al., 2024).

This learned matrix can be read as a supervised metric. In the Laplace form used in several papers,

K(x,x)=exp ⁣(γ(xx)TM(xx)),K(x,x')=\exp\!\left(-\gamma\sqrt{(x-x')^TM(x-x')}\right),

so recursive updates change which directions dominate pairwise similarity. The literature also uses Mahalanobis Gaussian and quadratic kernels. A fixed kernel baseline is often defined as the same kernel with f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c0 recursive updates; in one empirical study, the “baseline” is precisely the Laplacian kernel at iteration f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c1 (Shen et al., 2024, Gupta et al., 2023).

A recurring interpretation is that RFM supplies kernel machines with an explicit feature-learning step analogous, in a limited sense, to hidden-layer adaptation in neural networks. Several papers connect this to the Neural Feature Ansatz, under which AGOP is correlated with matrices of the form f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c2 in trained feedforward networks (Pasternak, 1 Jul 2026).

2. Linear RFM, spectral regularization, and the IRLS connection

The most developed theory in the supplied literature concerns the linear specialization, lin-RFM, for sparse linear regression and low-rank matrix recovery. In matrix sensing or completion, with observations f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c3, lin-RFM trains a minimum-Frobenius-norm linear predictor in transformed coordinates and updates the transform via AGOP. In this regime, AGOP becomes exactly a Gram matrix: if f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c4, then f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c5 (Radhakrishnan et al., 2024).

The lin-RFM update can be written as

f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c6

and

f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c7

After reparameterization by f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c8, fixed points of the iteration are first-order critical points of a constrained spectral optimization problem

f:RdRcf:\mathbb{R}^d\to\mathbb{R}^c9

where AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.0 is induced by the matrix function AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.1 (Radhakrishnan et al., 2024).

This yields an explicit bridge to classical iterative reweighting. For AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.2, lin-RFM is a reparameterization of IRLS with

AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.3

At AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.4, the induced penalty corresponds to nuclear-norm or AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.5-type behavior; at AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.6, the fixed-point objective becomes log-determinant-like; for AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.7, the method becomes even more aggressively rank promoting. The paper’s central claim is that feature learning in this linear RFM sense generalizes well-studied IRLS dynamics rather than constituting a wholly separate mechanism (Radhakrishnan et al., 2024).

The same work also proves an exact Neural Feature Ansatz statement for deep linear networks under balanced initialization and continuous-time gradient flow, and uses it to motivate “deep lin-RFM,” in which multiple AGOP-inspired matrices emulate the implicit bias of deeper linear architectures. On the computational side, it gives an SVD-free implementation for the AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.8 case and reports scaling to matrices with millions of missing entries; on a AGOP(f;{x(j)}j=1n)=1nj=1nf(x(j))x(f(x(j))x)Rd×d.\mathrm{AGOP}(f;\{x^{(j)}\}_{j=1}^n) = \frac1n\sum_{j=1}^n \frac{\partial f(x^{(j)})}{\partial x} \left(\frac{\partial f(x^{(j)})}{\partial x}\right)^\top \in\mathbb{R}^{d\times d}.9 rank-M0M_00 completion task with M0M_01 observations, the implementation reached M0M_02 test error in M0M_03 seconds, compared with M0M_04 seconds and M0M_05 seconds for the cited deep linear baselines (Radhakrishnan et al., 2024).

3. Generalization phenomena: grokking, symmetry, and feature scaling

A major strand of RFM research uses the method as a controlled model of feature learning itself. On modular arithmetic, RFM exhibits grokking: every iteration performs exact kernel interpolation, so training loss is identically zero and training accuracy is M0M_06, yet test accuracy remains near zero for many iterations before rapidly jumping to M0M_07. In the reported M0M_08 experiments trained for M0M_09 iterations, test metrics stay almost unchanged for roughly f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,0 iterations, test loss begins improving around iteration f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,1, and perfect test accuracy follows a few iterations later. The proposed explanation is not optimization progress, but gradual feature learning via AGOP (Mallinar et al., 2024).

The learned matrices in these algebraic tasks acquire highly structured forms. For modular addition and subtraction, the final f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,2 is reported to be block-circulant,

f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,3

with circulant off-diagonal block f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,4; multiplication and division reveal the same structure after discrete-log reindexing. The paper further presents theoretical evidence that such block-circulant features implement the Fourier Multiplication Algorithm, previously proposed as the generalizing solution learned by neural networks on the same tasks (Mallinar et al., 2024).

A related group-theoretic study sharpens this picture. On algebraic tasks with one-hot encoded inputs, RFM reportedly generalizes only when the training set breaks a nontrivial symmetry of the target. For modular addition with f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,5, holding out all fixed points under a reflection subgroup yields essentially f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,6 test accuracy even though the training fraction is around f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,7. By contrast, starting from that non-generalizing split, moving one random point from train to test can restore f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,8 held-out accuracy for the Gaussian kernel on addition, whereas removing symmetric reflection pairs does not help. The authors interpret the learned AGOP as encoding permutation representations of subgroup elements, so that successful RFM generalization becomes a form of symmetry recovery rather than mere interpolation (Bernal et al., 31 Mar 2026).

A third empirical phenomenon concerns ambient dimension. In a synthetic regression study, RFMs were evaluated while appending irrelevant Gaussian coordinates to data whose target depends only on the first few inputs. The reported RFM test MSE follows a decrease–increase–decrease pattern: a sharp decrease up to about f(t)(x)=k(x,X;Mt)α,α=k(X,X;Mt)1y,f^{(t)}(x)=k(x,X;M_t)\alpha,\qquad \alpha = k(X,X;M_t)^{-1}y,9, an increase until around Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,0, and then a shallower decrease from there to Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,1. The same qualitative pattern appears across dataset sizes, label-noise levels, and a second target function, while the fixed Laplacian-kernel baseline exhibits earlier turning points around Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,2 and Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,3. The authors explicitly state that the similarity to double descent is phenomenological rather than established; no interpolation-threshold theorem is given (Gupta et al., 2023).

4. Robustness and scalability extensions

Several later works modify the basic recursion to address regimes in which standard RFMs underperform. The most explicit such variant is K-Inverse-RFM, introduced for modular arithmetic, GCD, and related mathematical tasks under label corruption, imbalance, and compact Chinese Remainder Theorem (CRT) encodings. Its recursion alters three components at once: label projection,

Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,4

ridge-regularized kernel regression,

Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,5

and an inverse-loss-weighted moving average of recent AGOP matrices,

Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,6

The emphasized case Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,7 motivates the name “K-Inverse.” The thesis argues that standard RFMs are limited by weak multiclass feature sharing, and that projecting labels through powers of the kernel matrix makes classes interact in a shared kernel-feature coordinate system (Pasternak, 1 Jul 2026).

Empirically, K-Inverse-RFM is reported to bridge an average of Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,8 of the gap between standard RFM and neural networks on noisy modular addition and multiplication, to improve over standard RFM by as much as Mt+1=[AGOP(f(t))]s,M_{t+1}=\bigl[\mathrm{AGOP}(f^{(t)})\bigr]^s,9 percentage points in test accuracy, and to remain comparable to feedforward neural networks up to about s>0s>00 label noise. On imbalanced data, it is reported to yield a s>0s>01 absolute jump in test accuracy over standard RFM at divisible-by-3 input weight s>0s>02, and on CRT inputs it outperforms both standard RFM and neural networks in s>0s>03 of s>0s>04 encoding-task pairs (Pasternak, 1 Jul 2026).

For large-scale tabular learning, xRFM localizes RFM through a supervised tree. Internal nodes fit lightweight RFM-style split models, compute AGOP, extract a top eigenvector s>0s>05, and split samples at the median of s>0s>06; each leaf then trains a local RFM on at most s>0s>07 samples. The paper states training complexity s>0s>08 and inference complexity s>0s>09 for fixed leaf size. On the TALENT benchmark, xRFM is reported to achieve the best performance across s=12s=\tfrac120 regression datasets and to be competitive to the best methods across s=12s=\tfrac121 classification datasets while outperforming GBDTs overall; it is also reported to outperform standard RFM and kernel ridge regression on TALENT regression with Wilcoxon s=12s=\tfrac122 (Beaglehole et al., 12 Aug 2025).

5. Interpretability and application domains

Because the learned matrix s=12s=\tfrac123 is explicit, RFM research repeatedly treats it as both a training mechanism and an interpretation object. In quantitative structure–property relationship modeling, RFM was applied to solubility prediction with MACCS keys, Morgan fingerprints, and a custom hybrid fingerprint (HF). The paper defines a local score

s=12s=\tfrac124

and a global score by dataset averaging. It reports that Matérn and Laplace kernels performed best among the tested kernel families; on AqSolDB with MACCS, the reported test RMSEs were s=12s=\tfrac125 for Matérn, s=12s=\tfrac126 for Laplace, s=12s=\tfrac127 for Rational Quadratic, and s=12s=\tfrac128 for Gaussian. The same study claims robust local and global explanations, substantial top-s=12s=\tfrac129 overlap with permutation importance and SHAP on ESOL and FreeSolv, and stability after removing redundant features from the custom fingerprint representation (Shen et al., 2024).

RFM has also been used as a probe for hidden states of frozen generative models. In MusicRFM, layerwise RFMs are trained on mean-pooled MusicGen-large hidden states for symbolic music concepts, AGOP eigendecomposition produces orthogonal concept directions, and the top eigenvector at selected layers is injected back into the residual stream during autoregressive decoding. The steering rule is additive,

MtM_t0

with optional layer weighting, time-varying schedules, and Bernoulli gating. In the main note-control result, target-note accuracy is reported to increase from MtM_t1 to MtM_t2, while text-prompt adherence remains within approximately MtM_t3 of the unsteered baseline over much of the tested range (Zhao et al., 21 Oct 2025).

A closely related activation-space application identifies refusal subspaces in aligned LLMs. An RFM-AGOP procedure with probe-informed initialization,

MtM_t4

and exponential moving-average AGOP updates is used to recover a multi-dimensional refusal subspace from harmful-versus-harmless residual activations. The paper reports that the subspace can be identified in seconds, that larger models require multiple directions rather than a single linear refusal vector, and that for Qwen 3 8B at least three directions are needed to exceed MtM_t5 attack success rate under ablation (Winninger, 2 Jul 2026).

6. Limits, unresolved questions, and acronym ambiguity

Despite the breadth of applications, the supplied literature repeatedly emphasizes incomplete theory. The feature-scaling study does not derive a mechanism for its decrease–increase–decrease curve and does not provide diagnostics such as AGOP spectra or learned-metric condition numbers; the resemblance to double descent is explicitly described as suggestive rather than established (Gupta et al., 2023). The K-Inverse-RFM thesis argues that standard AGOP is only a linear input reweighting and leaves open whether stronger AGOP variants are needed for broader corrupted-data robustness (Pasternak, 1 Jul 2026). Steering papers likewise report strong empirical utility while stating that the relationship between RFM-derived subspaces and alternatives such as refusal cones or sparse autoencoder features remains unclear (Winninger, 2 Jul 2026).

Kernel scaling remains a general practical constraint. Standard RFM repeatedly rebuilds kernel matrices and recomputes AGOP, so large-MtM_t6 workloads motivate either structural modifications such as xRFM or task-specific adaptations. This suggests that future RFM research will likely continue to divide between theory of AGOP-driven geometry learning and systems work on local, sparse, or approximate implementations (Beaglehole et al., 12 Aug 2025).

The acronym itself is also ambiguous outside this literature. In scientific computing, “RFM” can mean Random Feature Method, a collocation least-squares solver for PDEs that is unrelated to Recursive Feature Machines (2207.13380). In robotics, “RFM-SLAM” denotes Relative Feature Measurements-based SLAM, where “RFM” refers to relative feature measurements rather than feature-learning kernels (Agarwal et al., 2016). Within machine learning, however, Recursive Feature Machine has acquired a specific technical meaning: a kernel machine whose metric is recursively updated from AGOP so that representation learning is performed explicitly, analyzably, and, in many applications, interpretably.

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 Recursive Feature Machine (RFM).