Patch-Alignment Loss (PAL) is a family of objectives that aligns local patches or tokens to capture fine-grained representations essential for dense tasks.
It encompasses diverse formulations—from text-conditioned pooling in vision–language models to symmetric InfoNCE in vision–tactile matching and quadratic alignment in geometric registration.
PAL improves performance metrics (e.g., zero-shot segmentation mIoU and image classification accuracy) by emphasizing localized feature consistency and flexible cross-modal supervision.
Patch-Alignment Loss (PAL) denotes a family of objectives that align representations at the level of patches, local crops, spatial tokens, or overlapping local views rather than only at the image, caption, or scene level. In recent arXiv literature, the term spans several distinct constructions: a CLIP-derived patch-attended compatibility for open-vocabulary segmentation, a cosine-distance loss over cross-attention-weighted real and synthetic patch descriptors for Bengali captioning, a symmetric InfoNCE objective for vision–tactile local matching, and a $2$-norm rigid-alignment error for overlapping geometric patches (Mukhoti et al., 2022, Anonto et al., 22 Sep 2025, Li et al., 10 Jun 2026, Kohli et al., 2023). This suggests that PAL is not a single canonical loss, but a recurring design principle in which locality is made explicit in the alignment objective.
1. Scope of the term
The phrase “Patch-Alignment Loss” is used across multiple research areas, but the aligned objects and the optimization targets differ substantially.
A common misconception is that PAL always denotes a contrastive loss. That is inaccurate. In the Bengali-captioning setting, PAL is defined as 1−cos(r,r~) after text-conditioned pooling; in rigid alignment it is the quadratic error ∑(i,j)∈E∥RiYij−RjYji∥F2; and in vision–tactile learning it is a symmetric InfoNCE over paired local embeddings (Anonto et al., 22 Sep 2025, Kohli et al., 2023, Li et al., 10 Jun 2026). Another misconception is that patch alignment necessarily requires dense supervision. The CLIP-based segmentation formulation explicitly enables open-vocabulary zero-shot segmentation “without requiring any segmentation annotations during training,” while the captioning and vision–tactile variants use other forms of locality-aware supervision (Mukhoti et al., 2022, Anonto et al., 22 Sep 2025).
2. Patch alignment in CLIP-style vision–LLMs
In "Open Vocabulary Semantic Segmentation with Patch Aligned Contrastive Learning" (Mukhoti et al., 2022), the patch-alignment mechanism is introduced as Patch Aligned Contrastive Learning (PACL), a modification of CLIP’s compatibility function. Standard CLIP uses normalized image and text embeddings,
freezes f^v and the text encoder ft, and trains only a small vision embedder
e^v:RDv→RD.
For each patch 1−cos(r,r~)0, it computes unnormalized patch–text similarities
1−cos(r,r~)1
then softmax-normalizes them across patches to obtain
1−cos(r,r~)2
These weights define a text-conditioned patch aggregate,
1−cos(r,r~)3
and the scalar compatibility becomes
1−cos(r,r~)4
Replacing 1−cos(r,r~)5 by 1−cos(r,r~)6 in InfoNCE yields 1−cos(r,r~)7.
The architectural point is that patch weights 1−cos(r,r~)8 act as a cross-modal attention mechanism over vision patches, while the text side remains a single CLS embedding. The paper states that only 1−cos(r,r~)9 is trained; the vision encoder ∑(i,j)∈E∥RiYij−RjYji∥F20, text encoder ∑(i,j)∈E∥RiYij−RjYji∥F21, and text embedder ∑(i,j)∈E∥RiYij−RjYji∥F22 remain frozen. The formulation is compatible with CLIP ViT-B/16 and ViT-L/14, and even with a DINO-trained ViT vision encoder. A “stride trick” at inference reduces patch stride, for example from ∑(i,j)∈E∥RiYij−RjYji∥F23 to ∑(i,j)∈E∥RiYij−RjYji∥F24, to obtain a finer patch grid without retraining.
The central empirical claim is that aligning patches rather than only CLS tokens unlocks open-vocabulary zero-shot segmentation. On Pascal VOC, per-patch zero-shot classification accuracy rises from ∑(i,j)∈E∥RiYij−RjYji∥F25 to above ∑(i,j)∈E∥RiYij−RjYji∥F26 after PACL training; the detailed figures are ∑(i,j)∈E∥RiYij−RjYji∥F27 for CLIP ViT-B/16 and ∑(i,j)∈E∥RiYij−RjYji∥F28 for CLIP ViT-L/14. Zero-shot semantic segmentation mIoU reaches ∑(i,j)∈E∥RiYij−RjYji∥F29 on Pascal VOC-20, vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),0 on Pascal Context-59, vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),1 on COCO-Stuff-171, and vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),2 on ADE20K-150, with no masks or pixel labels used at train time. The same patch-alignment mechanism also improves zero-shot image classification, including ImageNet top-1 from vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),3 for ViT-B/16 and from vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),4 for ViT-L/14.
3. Cross-attention-guided PAL for Bengali captioning
In "Align Where the Words Look: Cross-Attention-Guided Patch Alignment with Contrastive and Transport Regularization for Bengali Captioning" (Anonto et al., 22 Sep 2025), PAL is defined on matched triplets vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),5, where vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),6 is a real image, vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),7 is a synthetic counterpart generated from the same Bengali caption vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),8, and a frozen MaxViT encoder provides a feature map vi=∥ev(fv(xi))∥ev(fv(xi)),ti=∥et(ft(yi))∥et(ft(yi)),9 with ϕCLIP(xi,yj)=vi⊤tj,0 spatial locations. After reshaping and projecting,
ϕCLIP(xi,yj)=vi⊤tj,1
and similarly for ϕCLIP(xi,yj)=vi⊤tj,2.
The distinctive component is that decoder cross-attention determines which patches matter. During autoregressive decoding with mBART-50, cross-attention mapsϕCLIP(xi,yj)=vi⊤tj,3 are averaged across the last ϕCLIP(xi,yj)=vi⊤tj,4 layers and over heads,
ϕCLIP(xi,yj)=vi⊤tj,5
then summed over time and passed through TopKSoftmax,
ϕCLIP(xi,yj)=vi⊤tj,6
TopKSoftmax retains only the minimal set of indices whose cumulative pre-softmax mass is ϕCLIP(xi,yj)=vi⊤tj,7, then renormalizes. Using these weights, the model forms pooled, text-conditioned descriptors
Here CE trains the decoder on real captions, InfoNCE enforces global real–synthetic separation, and Sinkhorn-based OT encourages balanced fine-grained patch correspondence. The paper specifies default hyperparameters LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].1, LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].2, LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].3, attention temperature LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].4, top-mass LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].5, last-LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].6 layers, InfoNCE temperature LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].7, OT regularizer LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].8, and LCLIP=−2k1i=1∑k[log∑j=1kexp(ϕ(xi,yj)/τ)exp(ϕ(xi,yi)/τ)+log∑j=1kexp(ϕ(xj,yi)/τ)exp(ϕ(xi,yi)/τ)].9 Sinkhorn iterations. Gradients flow only through the linear+LN projection and mBART-50; MaxViT remains frozen.
The empirical ablations isolate PAL’s role. On Flickr30k-1k, CE (Real only) yields BLEU-4 f^v:RC×H×W→RT×Dv,0, METEORf^v:RC×H×W→RT×Dv,1, and BERT-F1 f^v:RC×H×W→RT×Dv,2; CE + InfoNCE + OT yields f^v:RC×H×W→RT×Dv,3, f^v:RC×H×W→RT×Dv,4, and f^v:RC×H×W→RT×Dv,5; PAL (only) yields f^v:RC×H×W→RT×Dv,6, f^v:RC×H×W→RT×Dv,7, and f^v:RC×H×W→RT×Dv,8; and PAL + InfoNCE + OT reaches f^v:RC×H×W→RT×Dv,9, f^v0, and f^v1. On MSCOCO-1k, the full pipeline reports BLEU-4 f^v2, METEOR f^v3, and BERTScore-F1 f^v4. Grounding analysis shows the real–synthetic centroid distance of attended-patch embeddings falling from f^v5 and MMD-RBF from f^v6, while background patches remain dispersed. This supports the paper’s claim that PAL is the core driver of text-conditioned grounding.
4. Vision–tactile PAL and local cross-modal alignment
In "Tac-DINO: Learning Vision-Tactile Features with Patch Alignment" (Li et al., 10 Jun 2026), PAL is a symmetric InfoNCE objective over paired local vision and tactile patches. The data unit is a contact-aligned pair: f^v7 is a local RGB crop around the contact pixel f^v8, and f^v9 is the corresponding tactile image recorded by the GelSight Mini. A ViT-Large from DINOv2 encodes each modality,
ft0
with ft1, producing embeddings ft2 and ft3. Cosine similarity is
ft4
The loss is
ft5
where
ft6
and
ft7
Typical implementation uses ft8. This loss is combined with DINOv2-style self-distillation on global crops,
ft9
with e^v:RDv→RD.0. Reported optimization settings include batch size per GPU e^v:RDv→RD.1 on e^v:RDv→RD.2 GPUs for effective batch e^v:RDv→RD.3, learning rate e^v:RDv→RD.4 with e^v:RDv→RD.5-epoch linear warmup and cosine decay over e^v:RDv→RD.6 total epochs, weight decaye^v:RDv→RD.7, gradient clipping e^v:RDv→RD.8, and AdamW.
The formulation depends on the Touch3D dataset’s per-contact supervision. The dataset contains e^v:RDv→RD.9 unique real-world objects across 1−cos(r,r~)00 household/office categories, 1−cos(r,r~)01 discrete tactile contacts, average 1−cos(r,r~)02 contacts per object, high-resolution 1−cos(r,r~)03D meshes with 1−cos(r,r~)04 mm point resolution, RGB 1−cos(r,r~)05 and depth of the global scene, multi-view renderings for contact-pixel annotation, and 1−cos(r,r~)06 material labels, with each object having up to 1−cos(r,r~)07 materials. The patch-sampling pipeline labels the contact location on a high-resolution scan, renders multi-view RGB to identify visible views, randomly samples contact indices during training, loads 1−cos(r,r~)08, generates 1−cos(r,r~)09, encodes 1−cos(r,r~)10, and computes 1−cos(r,r~)11 over the minibatch.
On the Vis-Tac Holographic Matching Benchmark, PAL yields substantial local-to-global retrieval gains. For tactile-side retrieval, Patch Tac gives 1−cos(r,r~)12 top-1, Patch Tac + PAL gives 1−cos(r,r~)13, Patch Tac + DSCMR gives 1−cos(r,r~)14, and Patch Tac + DAR gives 1−cos(r,r~)15. For vision-side retrieval, Patch Vis gives 1−cos(r,r~)16, Patch Vis + PAL gives 1−cos(r,r~)17, and Patch Vis + DAR gives 1−cos(r,r~)18. Vision–tactile early fusion improves from 1−cos(r,r~)19 without PAL to 1−cos(r,r~)20 with PAL. The paper further states that, on the held-out OBJECTFOLDER REAL test set, similar relative gains are observed at 1−cos(r,r~)21–1−cos(r,r~)22 percentage points over baselines, PAL improves material mAP by 1−cos(r,r~)23 percentage points, and reduces Chamfer Distance marginally in geometry matching. The ablations also report that 1−cos(r,r~)24 is best over a sweep of 1−cos(r,r~)25–1−cos(r,r~)26, that 1−cos(r,r~)27 is a plateau point with slight overfitting above 1−cos(r,r~)28, and that patch-level alignment yields 1−cos(r,r~)29–1−cos(r,r~)30 percentage points over entire-image contrastive alignment.
5. PAL in rigid alignment and patch-based geometry
In "Non-degenerate Rigid Alignment in a Patch Framework" (Kohli et al., 2023), PAL is not a neural representation loss but a geometric objective over overlapping local views of a point cloud. Let 1−cos(r,r~)31 be the patch-overlap graph with 1−cos(r,r~)32. For each overlap 1−cos(r,r~)33, let 1−cos(r,r~)34 and 1−cos(r,r~)35 be the centered local coordinates of the 1−cos(r,r~)36 shared points in patches 1−cos(r,r~)37 and 1−cos(r,r~)38, and let 1−cos(r,r~)39 be the orthonormal map assigned to patch 1−cos(r,r~)40. The Patch-Alignment Loss is
1−cos(r,r~)41
This is the canonical 1−cos(r,r~)42-norm-based alignment error.
The paper rewrites the loss as a quadratic form. Stacking the rotations into
1−cos(r,r~)43
and defining a sparse patch-incidence block matrix 1−cos(r,r~)44, one obtains
1−cos(r,r~)45
The alignment matrix 1−cos(r,r~)46 has blocks
1−cos(r,r~)47
and 1−cos(r,r~)48.
The central theoretical notion is non-degeneracy of a perfect alignment. Because 1−cos(r,r~)49 for any global 1−cos(r,r~)50, a zero-loss solution always has a 1−cos(r,r~)51-dimensional global-rotation symmetry. A perfect alignment is non-degenerate when the Hessian restricted to the tangent of 1−cos(r,r~)52 is positive definite on the complement of those symmetry directions. Equivalently, for 1−cos(r,r~)53 evaluated at 1−cos(r,r~)54, the kernel must be exactly
1−cos(r,r~)55
and all remaining eigenvalues must be strictly positive.
Because 1−cos(r,r~)56 is explicit, the paper gives a polynomial-time non-degeneracy test based on the eigenvalues of 1−cos(r,r~)57. If 1−cos(r,r~)58 and
1−cos(r,r~)59
then the alignment is declared non-degenerate when 1−cos(r,r~)60 above tolerance and the first 1−cos(r,r~)61 eigenvalues are zero within tolerance. The reported dense eigendecomposition cost is 1−cos(r,r~)62, with sparse methods potentially faster.
The optimization analysis is formulated on the manifold
1−cos(r,r~)63
For
1−cos(r,r~)64
the Euclidean gradient is 1−cos(r,r~)65, and the Riemannian gradient is
1−cos(r,r~)66
with blockwise tangent projection and a blockwise QR-based retraction. If 1−cos(r,r~)67 is a non-degenerate critical point, then in a small neighborhood of 1−cos(r,r~)68 the function satisfies a Riemannian strong-convexity condition. With 1−cos(r,r~)69 the smallest nonzero eigenvalue of 1−cos(r,r~)70 and 1−cos(r,r~)71 a Lipschitz constant for the gradient, any fixed stepsize 1−cos(r,r~)72 yields local linear convergence,
1−cos(r,r~)73
The paper also gives a noise-stability statement. If the perturbation of the alignment matrix obeys
1−cos(r,r~)74
then the noisy problem remains non-degenerate, the global minimizer1−cos(r,r~)75 obeys
1−cos(r,r~)76
for an absolute constant 1−cos(r,r~)77, and Riemannian gradient descent initialized near 1−cos(r,r~)78 converges linearly to 1−cos(r,r~)79. In the noiseless case, the paper further shows that non-degenerate perfect alignment is equivalent to infinitesimal rigidity of the patch-overlap graph for generic point positions, with rank
1−cos(r,r~)80
and that global rigidity yields uniqueness up to a single global orthogonal map.
6. Comparative interpretation
Across these formulations, PAL always elevates local structure to the level of the training objective, but the mechanism by which locality is specified differs. In PACL, the relevant patches are induced by similarities between patch embeddings and a text CLS token (Mukhoti et al., 2022). In Bengali captioning, locality is defined by decoder cross-attention, averaged across layers and heads and pruned by TopKSoftmax (Anonto et al., 22 Sep 2025). In vision–tactile learning, locality is provided by per-contact annotations that bind a tactile reading to a specific vision crop (Li et al., 10 Jun 2026). In rigid alignment, locality is encoded by the overlap graph and shared coordinates between patches (Kohli et al., 2023).
This suggests three broad PAL archetypes. The first is text-conditioned pooling, in which a patch-weighted descriptor is built before computing similarity, as in PACL and Bengali captioning. The second is pairwise local contrastive matching, in which paired patches directly enter a symmetric InfoNCE loss, as in the vision–tactile formulation. The third is quadratic consistency over overlaps, in which patch alignment is a rigid-registration objective rather than a representation-learning loss.
The main significance of this family of objectives is methodological rather than notational. Patch alignment repeatedly appears when global embeddings are too coarse for the target task: CLIP CLS alignment is insufficient for dense semantic segmentation; caption-level fluency does not ensure that a Bengali decoder attends to the correct objects; whole-image vision–tactile matching ignores the locality of contact; and rigid patch registration requires overlap-wise consistency rather than only global fit. A plausible implication is that PAL-like objectives become most useful when the supervision signal is semantically or physically local even if the downstream prediction is global.
A second implication is that PAL does not prescribe a single supervision regime. One formulation achieves zero-shot segmentation without segmentation labels, another exploits real–synthetic pairs plus caption supervision, another uses contact-level pairing from a dedicated dataset, and another is entirely geometric. Accordingly, “PAL” is best treated as a patch-level alignment paradigm whose exact mathematical form depends on the structure of correspondence available in the problem.