SuperGlue

Sarlin 2020 · Paper

One-line summary — Graph Neural Network feature matcher that uses self- and cross-attention plus differentiable Sinkhorn optimal transport (with a dustbin for unmatched points) to replace brittle nearest-neighbor matching.

Problem

Classical feature matching is a pipeline of hand-designed heuristics: nearest-neighbor search in descriptor space, ratio test, mutual check, then RANSAC to clean up. Each descriptor is compared independently — no reasoning about the other keypoints, the scene’s geometry, or which points are simply not visible in the other image. Under strong viewpoint change, repetitive structure, or partial overlap, this collapses. SuperGlue reframes matching itself as a learnable optimization problem: jointly find correspondences and reject non-matchable points, exploiting two physical constraints — a keypoint has at most one correspondence, and some keypoints are unmatched due to occlusion or detector failure.

Method & architecture

Given images A,BA, B with MM and NN local features (position pi:=(x,y,c)i\mathbf{p}_i := (x, y, c)_i with detection confidence cc, and descriptor diRD\mathbf{d}_i \in \mathbb{R}^D, e.g. SuperPoint or SIFT), SuperGlue predicts a partial soft assignment P[0,1]M×N\mathbf{P} \in [0,1]^{M \times N} with P1N1M\mathbf{P}\mathbf{1}_N \leq \mathbf{1}_M and P1M1N\mathbf{P}^\top \mathbf{1}_M \leq \mathbf{1}_N. Two blocks:

1. Attentional Graph Neural Network. A keypoint encoder embeds position into the descriptor so appearance and layout are reasoned about jointly:

(0)xi=di+MLPenc(pi){}^{(0)}\mathbf{x}_i = \mathbf{d}_i + \mathrm{MLP}_{\mathrm{enc}}(\mathbf{p}_i)

All keypoints of both images form one complete multiplex graph with self edges (within an image) and cross edges (across images). A residual message-passing update runs for LL layers, alternating self and cross edges:

(+1)xiA=()xiA+MLP([()xiAmEi]){}^{(\ell+1)}\mathbf{x}_i^A = {}^{(\ell)}\mathbf{x}_i^A + \mathrm{MLP}\big(\big[{}^{(\ell)}\mathbf{x}_i^A \,\Vert\, \mathbf{m}_{\mathcal{E}\rightarrow i}\big]\big)

The message is attentional aggregation, mEi=jαijvj\mathbf{m}_{\mathcal{E}\rightarrow i} = \sum_{j} \alpha_{ij} \mathbf{v}_j with weights αij=Softmaxj(qikj)\alpha_{ij} = \mathrm{Softmax}_j(\mathbf{q}_i^\top \mathbf{k}_j) over the edge set — self-attention lets a keypoint attend to salient points in its own image, cross-attention to candidate matches in the other image. Final matching descriptors are linear projections fiA=W(L)xiA+b\mathbf{f}_i^A = \mathbf{W}\,{}^{(L)}\mathbf{x}_i^A + \mathbf{b}.

2. Optimal matching layer. Pairwise scores are inner products Si,j=fiA,fjB\mathbf{S}_{i,j} = \langle \mathbf{f}_i^A, \mathbf{f}_j^B \rangle. The score matrix is augmented with a dustbin row and column filled with a single learnable scalar zz, so occluded/undetected points are explicitly assigned. The entropy-regularized optimal transport problem is solved with TT differentiable Sinkhorn iterations (iterative row/column normalization of exp(Sˉ)\exp(\bar{\mathbf{S}})), yielding Pˉ\bar{\mathbf{P}}; dropping the dustbins recovers P\mathbf{P}.

Supervision. Negative log-likelihood over ground-truth matches M\mathcal{M} (from poses + depth or homographies) and unmatched sets I,J\mathcal{I}, \mathcal{J}:

Loss=(i,j)MlogPˉi,jiIlogPˉi,N+1jJlogPˉM+1,j\mathrm{Loss} = -\sum_{(i,j)\in\mathcal{M}} \log \bar{\mathbf{P}}_{i,j} - \sum_{i\in\mathcal{I}} \log \bar{\mathbf{P}}_{i,N+1} - \sum_{j\in\mathcal{J}} \log \bar{\mathbf{P}}_{M+1,j}

Details: D=256D = 256, L=9L = 9 layers of 4-head attention, T=100T = 100 Sinkhorn iterations, 12M parameters; a forward pass averages 69 ms (15 FPS) per indoor pair on a GTX 1080 GPU. Match confidence threshold 0.2 at test time.

Results

Why it matters for SLAM

SuperGlue changed the front-end recipe for hard association problems: SuperPoint + SuperGlue became the dominant baseline for visual localization, wide-baseline loop closure, and mapping via the hloc pipeline. For SLAM specifically, it made relocalization work across day/night and strong viewpoint changes where descriptor-distance matching collapses. The paper itself frames this learnable middle-end as “a major milestone towards end-to-end deep SLAM”. Its cost — full attention over all keypoints every frame — motivated LightGlue, the efficient successor now standard in real-time settings.