LightGlue

Lindenberger 2023 · Paper

One-line summary — Redesigned SuperGlue that is substantially faster through adaptive depth and width: easy image pairs exit the network early, and confidently matched or rejected keypoints are pruned from further computation.

Problem

SuperGlue established learned sparse matching as the state of the art, but it spends a fixed compute budget: every keypoint passes through every layer regardless of how easy the image pair is, and its Sinkhorn optimal-transport head is expensive and notoriously difficult to train — follow-ups failed to reach the original model’s performance. LightGlue revisits SuperGlue’s design decisions one by one, derives simple but effective improvements, and makes inference adaptive to the difficulty of each pair.

Method & architecture

Given local features (normalized position pi[0,1]2\mathbf{p}_i \in [0,1]^2, descriptor diRd\mathbf{d}_i \in \mathbb{R}^d, d=256d{=}256) from images AA and BB, LightGlue stacks L=9L = 9 identical layers, each one self-attention + one cross-attention unit (4 heads) updating per-point states xi\mathbf{x}_i (initialized to di\mathbf{d}_i):

xiIxiI+MLP([xiImiIS])\mathbf{x}^{I}_{i} \leftarrow \mathbf{x}^{I}_{i} + \mathrm{MLP}\big(\big[\mathbf{x}^{I}_{i} \,\Vert\, \mathbf{m}^{I\leftarrow S}_{i}\big]\big)

where miIS\mathbf{m}^{I\leftarrow S}_i is an attention-weighted average of states in the source image SS.

Pij=σiAσjBSoftmaxkA(Skj)iSoftmaxkB(Sik)j\mathbf{P}_{ij} = \sigma_i^A\, \sigma_j^B\, \mathrm{Softmax}_{k \in \mathcal{A}}(\mathbf{S}_{kj})_i\, \mathrm{Softmax}_{k \in \mathcal{B}}(\mathbf{S}_{ik})_j

Correspondences are pairs where Pij\mathbf{P}_{ij} exceeds a threshold and is maximal along its row and column — a fusion of mutual-NN search and a learned inlier classifier, far cheaper than optimal transport.

Results

Why it matters for SLAM

SuperGlue proved learned matching is more robust than nearest-neighbor + ratio test, but its fixed compute budget made it awkward for real-time SLAM. LightGlue’s insight — spend compute proportional to problem difficulty, cheap on high-overlap tracking frames and deep on wide-baseline loop closures — made learned matching practical in latency-sensitive pipelines, and it replaced SuperGlue as the default matcher in the hloc localization toolbox. If you are building a modern feature-based SLAM or relocalization pipeline today, SuperPoint (or DISK/SIFT) + LightGlue is the standard starting point.