arXiv:2610.13176cs.CVOct 2026

Manuscript Offprint

arXiv:2610.13176

Fix the Match, Not the Solver: STITCH -- a Self-Supervised Compatibility Measure for Eroded Visual Puzzles

Nadav Alali, Ohad Ben-Shahar

Abstract

Unlike the clean and pixel-aligned complete pieces of standard jigsaw benchmarks, real-world puzzle fragments lose their boundary regions to erosion, destroying the signal that classical compatibility measures (CMs) rely on. We first re-establish, via oracle experiments, that the CM, not the solver, is the performance bottleneck: with a perfect CM, even a simple greedy solver achieves perfect reconstruction. This motivates STITCH, a self-supervised CM that sidesteps missing boundaries by comparing frozen ViT patch tokens from piece interiors via a lightweight cross-attention head (~249 K trainable parameters), trained without manual annotation. Plugged into unchanged compatibility-based solvers, STITCH reaches .992/.954 Abs/Perf on JPwLEG-5 (+.629 Perf over the best prior method), nearly saturating the benchmark. On a new ImageNet 7×7 benchmark, it outperforms all alternatives, including inpaint-then-match pipelines built on modern generative models. Importantly, performance remains robust across erosion levels and generalizes to puzzles with over 40% missing pieces without retraining. Trained on the recent GAP datasets of irregular, heavily eroded fragments, the same CM recipe enables compatibility-based solvers to surpass recent learning-based solvers on GAP-3 and GAP-5. Since this leap in performance is achieved by a pluggable CM module, the takeaway is clear: fix the match, not the solver.

1 Introduction

When humans solve jigsaw puzzles, they often match pieces by visual information along shared boundaries (Fissler et al. 2018), and algorithmic reassembly has long adopted the same principle for applications such as reconstructing archaeological finds, shredded documents, and deteriorated photographs (Tsesmelis et al. 2024; Richter et al. 2012; Sizikova and Funkhouser 2017). Two solver families dominate. The first are compatibility-based solvers, which take a compatibility measure (CM) as a modular input and employ of various ways (greedy, genetic, LP-based, relaxation labeling (Pomeranz, Shemesh, and Ben-Shahar 2011; Sholomon, David, and Netanyahu 2013; Yu, Russell, and Agapito 2016; Vardi et al. 2023)) to search over the space of placements. The second family includes learning-based solvers (Paumard, Picard, and Tabia 2020; Kim, Cho, and Nam 2025; Liu et al. 2024; Scarpellini et al. 2024; Elkin, Shahar, and Ben-Shahar 2025), that learn matching and placements jointly. Evaluation of all solvers has always relied on various benchmarks, which over time have shifted steadily toward greater realism, from clean, pixel-aligned complete tiles to puzzles with eroded boundaries (Song et al. 2023a) and, most recently, irregular archaeology-inspired fragments (Shahar, Elkin, and Ben-Shahar 2026).

In this work, we further push forward the dominant line of research on square jigsaw puzzles that are based on partitioning an image into an N×NN \times N grid of square pieces that are then shuffled, where the goal is correct reassembly of the original image. When considering eroded puzzles with erosion level e, the puzzle generation process also strips the outermost e pixels from every side of every piece. Naturally, larger e degrades the boundary signals and eventually destroys them altogether. We make the common assumption that piece orientations are known, but unlike recent works, we also evaluate our solutions on the harder, unknown-orientation case (Gallagher 2012). Moreover, employing the recent GAP datasets (Shahar, Elkin, and Ben-Shahar 2026), we consider the even more challenging case of square puzzles with irregular fragments whose shapes are learned from real archaeological ones.

A CM is a function that scores a pair of pieces and their relative spatial relation by their likelihood of being direct neighbors (formalized in Sec. 3). CMs are a key explicit component in compatibility-based solvers, and are implicit in learning-based solvers. We say the CM is the bottleneck of a puzzle-solving pipeline if replacing it with a perfect compatibility oracle, while keeping the solver fixed, suffices for near-perfect reconstruction.

For over a decade, the community’s response to erosion has largely been better solvers (Sholomon, David, and Netanyahu 2013; Yu, Russell, and Agapito 2016; Paumard, Picard, and Tabia 2020). Yet solvers still perform far worse on eroded benchmarks than on clean-edge ones, and learning-based solvers entangle matching with placement, obscuring where their gains come from. Learned CMs do improve compatibility-based solvers under mild erosion (Bridger, Danon, and Tal 2020; Rika et al. 2022b,a), but they rely on boundary strips and degrade quickly as gaps widen. Crucially, no prior work attempted to isolate the CM’s contribution from the solving algorithm itself (in particular, by ablating the CM and replacing it with a perfect "oracle" CM). At the same time, no single CM, including recent measures for irregular fragments (Shahar, Elkin, and Ben-Shahar

2025), has been evaluated simultaneously under challenging conditions like deep erosion, missing pieces, and/or irregular geometry. These gaps thus leave open a very fundamental question: is the limiting factor the solving itself, or is it the compatibility signal that drives it?

We provide a decisive answer. Replacing a solver’s CM with an oracle compatibility (1 for true neighbors, 0 otherwise) yields perfect reconstructions for every solver we test on a standard eroded benchmark, even the simplest greedy strategy (Fig. 4). Failures on eroded puzzles are thus failures of matching, not search. Rather than designing another solver, we therefore seek to fix the match.

Our contributions are:

  1. An oracle analysis establishing the CM, not the solver, as the performance bottleneck on eroded puzzles.

  2. Introduction of STITCH (Self-supervised Token InTerior Cross-attention Head), a very light (~249 K-parameter) cross-attention head.

  3. Introduction of ImageNet 7×77 \times 7, a new benchmark of larger, more combinatorially challenging eroded puzzles, spanning erosion levels e∈{0,…,6}e \in \{0, \ldots, 6\} px and over 40% of pieces missing, settings that break all current learning-based solvers.

  4. SOTA performance of STITCH when plugged into every compatibility-based solver we tested. It nearly saturates JPwLEG-3/5, it outperforms all alternative CMs on ImageNet 7×77 \times 7 (including inpaint-then-match pipelines), and it generalizes to over 40% missing pieces without retraining.

  5. Evidence that STITCH’s concept extends to fragments with strongly irregular erosion. Trained on GAP (Shahar, Elkin, and Ben-Shahar 2026), STITCH allows “classical” compatibility-based solvers to surpass recent deep learning-based ones (including unknown-orientation scenarios).

  6. A conceptual shift: from ever more complex solvers to better compatibility signals.

References (53)