Neural Feature Learning

Analyze how neural networks learn features using NFM and EGOP spectral methods.

75|7|Updated May 2, 2026
One-click install
npx skills add https://github.com/zjunlp/Mechanist --skill neural-feature-learning-zjunlp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Neural Feature Learning
Source: https://github.com/zjunlp/Mechanist/tree/main/skills/mechanism-skills/neural-feature-learning
Command: npx skills add https://github.com/zjunlp/Mechanist --skill neural-feature-learning-zjunlp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, torchvision, numpy, scipy, h5py, functorch, hickle, tqdm, and includes scripts (resource) and references (resource) components.

What problem does it solve? Understanding how a trained neural network discovers useful representations from data is difficult because raw weight matrices are hard to interpret. This Skill opens that black box by deriving the directions along which each layer's input geometry is reshaped during training, using the Neural Feature Matrix (NFM) and its empirical alignment with the Expected Gradient Outer Product (EGOP). ## Core Features & Use Cases - Deep Neural Feature Ansatz (DNFA) verification: Read the directions a network has learned to use directly from the top eigenvectors of its per-layer NFM, and verify them against EGOP measured at that layer's input. - Recursive Feature Machines (RFM): Iteratively refit a Mahalanobis kernel using the EGOP to recover neural-network-style features without backpropagation through model weights. - Infinite-width regime analysis (Tensor Programs IV): Distinguish NNGP, NTK, and muP regimes and pick initialization scales and learning rates so finite-width networks actually learn features. - Convolutional extension (ConvRFM/CNFA): Compute patch-wise input gradients and patch-level EGOP to derive VGG-style filter hierarchies from EGOP iterations alone. - Use Case: Train a fully connected network on CIFAR-10, then compute per-layer NFM eigenspectra and EGOP to verify that the network's learned feature directions match the kernel-regime prediction from the Deep Neural Feature Ansatz paper (arXiv:2212.13881). ## Quick Start Ask the assistant to verify the Deep Neural Feature Ansatz on a fully connected network trained on CIFAR-10 by computing the NFM and EGOP at each layer.

Frequently Asked Questions about Neural Feature Learning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify the Deep Neural Feature Ansatz on a trained network?

Train a fully connected network and save both the trained weights and initialization, then compute the NFM (weight matrix times its transpose) and the EGOP at each layer's input. The ansatz holds when the top eigenvectors of the NFM align with those of the EGOP.

What is the difference between NTK, NNGP, and muP regimes?

In the infinite-width limit, the parameterization determines the regime: NNGP gives Gaussian-process inference at initialization, NTK gives lazy kernel regression with frozen features, and muP (maximal-update parameterization) enables genuine feature learning. Tensor Programs IV specifies the initialization scales and learning rates for each.

How do Recursive Feature Machines learn features without backpropagation?

RFM wraps a Mahalanobis kernel around kernel ridge regression: fit the kernel, re-estimate the feature matrix as the empirical EGOP of the fitted predictor, and iterate. The fixed point reproduces neural-network-like feature learning using only per-sample input gradients.

Does the NFM-EGOP alignment hold for convolutional networks?

Yes, via the Convolutional Neural Feature Ansatz, which computes patch-wise input gradients and aggregates them into a patch-level EGOP. Deep ConvRFM produces VGG-style filters from EGOP iterations, though the alignment remains an empirical ansatz rather than a universal guarantee.

What are the limitations of EGOP-based feature analysis?

EGOP estimation is expensive on high-resolution inputs because every per-sample input gradient accumulates into a dense matrix growing quadratically with input dimension. Results are also dataset- and layer-specific, and infinite-width predictions describe finite-width training only approximately.