Ultralytics YOLO27: Join the waitlist.
License YOLO
Back to Ultralytics Glossary

Neural Tangent Kernel (NTK)

Neural tangent kernel (NTK) measures how network predictions respond to parameter changes, connecting neural network training with kernel methods.

The neural tangent kernel (NTK) is a similarity function that measures how two inputs' neural network outputs respond to the same small changes in model parameters. Inputs have strongly coupled predictions when their parameter gradients align. This connects neural network training to kernel methods, which learn through pairwise similarities between examples.

Arthur Jacot, Franck Gabriel, and Clément Hongler introduced the term in 2018 in Neural Tangent Kernel: Convergence and Generalization in Neural Networks, establishing a mathematical framework for analyzing how predictions evolve during training.

How the Neural Tangent Kernel Works#

For a scalar-output neural network, compute the output's derivative with respect to every trainable parameter. These derivatives form a gradient vector describing the prediction's sensitivity to the model weights. The NTK between two inputs is the dot product of their gradient vectors.

Across a dataset, these pairwise values form a kernel matrix, also called a Gram matrix. Its diagonal measures each prediction's sensitivity to parameter changes; off-diagonal entries describe coupling between different examples. For multiple outputs, each input pair produces a block containing the interactions between output coordinates, as used in empirical NTK computation.

During gradient descent, the kernel determines how reducing one example's prediction error changes predictions elsewhere. The relevant gradients are derivatives of network outputs; backpropagation supplies the differentiation machinery. The loss function then determines the direction and strength of the error-correcting updates.

Infinite Width, Convergence, and Generalization#

A network's width is its number of hidden units, or channels in a convolutional layer. Under NTK parameterization and suitable initialization and training assumptions, increasing hidden-layer widths toward infinity produces a deterministic limiting kernel that remains constant during training. A finite network's empirical NTK is evaluated at its actual parameters and can change as training progresses.

In the constant-kernel regime, training follows the network's first-order approximation around initialization. This is a linearized network: its predictions depend linearly on parameter changes while retaining nonlinear dependence on inputs. The related term lazy training describes a regime where tangent features change little. Feature learning involves those features evolving substantially during optimization.

For squared-error loss under constant-kernel gradient flow—the continuous-time limit of small gradient steps—errors decrease fastest along kernel eigenvectors with larger eigenvalues. Eigenvectors identify patterns across examples, and eigenvalues determine their learning speeds. This explains why early stopping acts as regularization: it limits fitting of slowly learned components, including components associated with noise and overfitting. Predictions on unseen inputs depend on their kernel similarities to the training data.

NTK methods support kernel regression and the analysis of image classification. The convolutional NTK (CNTK) extends the construction to convolutional neural networks. Sanjeev Arora and colleagues used exact CNTK computation for classification on CIFAR-10, providing a kernel-based counterpart to training finite convolutional networks.

The neural network Gaussian process (NNGP) kernel describes covariance between randomly initialized network outputs in the infinite-width limit. The NTK describes gradient-driven training dynamics. Similarly, linear probing trains a linear classifier on frozen representations; NTK linearization uses derivatives with respect to the selected trainable parameters as its features.

Parameter selection therefore changes the tangent kernel governing training. In Ultralytics YOLO26 fine-tuning, the freeze argument holds selected layers fixed, so their parameters contribute no update directions to the effective training kernel.

Computing an Empirical NTK#

This PyTorch example computes the kernel for two handwritten digit images from scikit-learn's bundled digits dataset. Install the dependencies with pip install torch scikit-learn.

import torch
from sklearn.datasets import load_digits
from torch import nn

torch.manual_seed(0)
digits = load_digits()
inputs = torch.tensor(digits.data[:2], dtype=torch.float32) / 16
model = nn.Sequential(nn.Linear(64, 8), nn.Tanh(), nn.Linear(8, 1))
parameters = tuple(model.parameters())
outputs = model(inputs)

# Each Jacobian row contains one output's parameter derivatives.
rows = []
for output in outputs[:, 0]:
    gradients = torch.autograd.grad(output, parameters, retain_graph=True)
    rows.append(torch.cat([gradient.flatten() for gradient in gradients]))
jacobian = torch.stack(rows)
kernel = jacobian @ jacobian.T
print(kernel)

The printed 2 x 2 matrix contains the two self-sensitivities and their cross-example coupling. Its construction as jacobian @ jacobian.T makes the scalar-output empirical NTK symmetric and positive semidefinite, with rank bounded by both the number of examples and the number of trainable parameters.

Explore solutions

Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more
Computer vision in sports

Computer vision in sports

Discover how Ultralytics YOLO powers sports vision with player and ball tracking, performance analytics, coaching insights, and athlete rehabilitation.
Learn more
Computer vision for aerial imagery

Computer vision for aerial imagery

Transform drone and aerial imagery into real-time insights for agriculture, aquaculture, environmental monitoring, conservation, and geospatial analysis with Ultralytics YOLO.
Learn more
Computer vision in aerospace

Computer vision in aerospace

Bring vision AI to aerial monitoring with Ultralytics YOLO models. Power drones, aerospace workflows, environmental conservation & geospatial industries with computer vision solutions.
Learn more
Computer vision in security

Computer vision in security

Protect every site with Ultralytics YOLO models. Vision AI powers perimeter monitoring, threat detection, license-plate recognition, and workplace safety.
Learn more
Computer vision in robotics

Computer vision in robotics

Power smarter machines with Ultralytics YOLO models. Vision AI in robotics drives autonomous navigation, perception, object tracking, and real-time control.
Learn more
Computer vision in logistics

Computer vision in logistics

Streamline logistics with Ultralytics YOLO models. Vision AI enables package inspection, sorting, vehicle tracking, and real-time warehouse safety monitoring.
Learn more
Computer vision in retail

Computer vision in retail

Reimagine retail with Ultralytics YOLO models. Vision AI powers inventory tracking, shelf monitoring, queue management, and smarter customer insights.
Learn more
Computer vision in healthcare

Computer vision in healthcare

Build healthcare solutions with Ultralytics YOLO models. Vision AI in healthcare powers faster medical imaging, smarter diagnostics, and patient monitoring.
Learn more
Computer vision in manufacturing

Computer vision in manufacturing

Optimize manufacturing with Ultralytics YOLO models. Vision AI drives quality control, defect detection, PPE compliance, and assembly line automation.
Learn more
Computer vision in automotive

Computer vision in automotive

Apply computer vision in automotive with Ultralytics YOLO models. Vision AI elevates road safety, driver assistance, and vehicle automation for smarter roads.
Learn more
Computer vision in agriculture

Computer vision in agriculture

Bring vision AI to smart agriculture with Ultralytics YOLO models. Power crop monitoring, livestock tracking, and precision farming for higher, smarter yields.
Learn more

Let's build the future of AI together!

Begin your journey with the future of machine learning