A join is a set of manuscript fragments identified as originally emanating from the same manuscript. We study manuscript join retrieval: Given a query image of a fragment, retrieve other fragments originating from the same physical manuscript. We propose Bag of Bags (BoB), an image-level representation that replaces the global-level visual codebook of classical Bag of Words (BoW) with a fragment-specific vocabulary of local visual words. Our pipeline trains a sparse convolutional autoencoder on binarized fragment patches, encodes connected components from each page, clusters the resulting embeddings with per-image k-means, and compares images using set-to-set distances between their local vocabularies. Evaluated on fragments from the Cairo Genizah, the best BoB variant (viz. Chamfer) achieves Hit@1 of 0.78 and MRR of 0.84, compared to 0.74 and 0.80, respectively, for the strongest BoW baseline (BoW-RawPatches-χ2), a 6.1% relative improvement in top-1 accuracy. We furthermore study a mass-weighted BoB-OT variant that incorporates cluster population into prototype matching and present a formal approximation guarantee bounding its deviation from full component-level optimal transport. A two-stage pipeline using a BoW shortlist followed by BoB-OT reranking provides a practical compromise between retrieval strength and computational cost, supporting applicability to larger manuscript collections. The code and dataset are available at https://github.com/TAU-CH/midrash_bob.
Figures & tables
Figure 1: Representative join groups from the Cairo Genizah benchmark. Each row shows fragments originating from the same physical manuscript, held among different institutions worldwide. (The blue backgrounds were designed for easy algorithmic segmentation.)
Figure 2: Overview of the proposed pipeline.
Family
Method
Hit@1
mAP@1
Hit@5
mAP@5
Hit@10
mAP@10
MRR
MacroF1@1
Pooling
MeanPool-Cosine
0.545
0.545
0.773
0.469
0.841
0.475
0.642
0.384
MaxPool-L2
0.307
0.307
0.534
0.288
0.648
0.300
0.424
0.187
BoW-centroids
L2
0.545
0.545
0.682
0.506
0.784
0.516
0.619
0.397
Cosine
0.534
0.534
0.739
0.509
0.841
0.520
0.617
0.354
χ2
0.511
0.511
0.716
0.510
0.830
0.525
0.622
0.352
Hellinger
0.500
0.500
0.716
0.505
0.830
0.519
0.616
0.344
Table 1: Full retrieval comparison on the Genizah join-retrieval benchmark. Methods are grouped into pooling baselines, shared-vocabulary BoW baselines (BoW-RawPatches: global codebook over raw component embeddings; BoW-centroids: global codebook over page-level BoB prototypes), and page-adaptive BoB distances. Higher is better for all metrics. Boldface indicates the best value per column.
Method
Intra
Inter
Gap
KS
AUC
Cohen’s d
BoW-Cosine
0.347
0.617
0.270
0.641
0.899
1.897
BoB-Hungarian-L2
1.735
2.078
0.343
0.665
0.902
1.831
Table 2: Distance-separation statistics for intra-cluster vs. inter-cluster pairs. Larger mean gap, KS statistic, and AUC separation indicate stronger distributional separation.
K
Hit@1
mAP@1
Hit@5
mAP@5
MRR
MF1@1
8
0.648
0.648
0.818
0.600
0.739
0.541
16
0.705
0.705
0.841
0.650
0.767
0.569
20
0.705
0.705
0.864
0.665
0.771
0.580
32
0.773
0.773
0.864
0.689
0.813
0.647
64
0.705
0.705
0.830
0.658
0.770
0.599
Table 3: Ablation on local vocabulary size K for BoB-Hungarian-L2 ( d=128 , sparsity enabled). (MF1 = MacroF1)
d
Hit@1
mAP@1
Hit@5
mAP@5
MRR
MF1@1
64
0.705
0.705
0.807
0.642
0.756
0.578
128
0.773
0.773
0.864
0.689
0.813
0.647
256
0.648
0.648
0.807
0.604
0.719
0.546
Table 4: Ablation on latent dimension d (K=32, sparsity enabled).
Sparsity
Hit@1
mAP@1
Hit@5
mAP@5
MRR
MF1@1
On
0.773
0.773
0.864
0.689
0.813
0.647
Off
0.761
0.761
0.841
0.672
0.805
0.595
Table 5: Ablation on ℓ1 sparsity regularization for BoB-Hungarian-L2 ( K=32 , d=128 ).
Method
Hit@1
mAP@1
Hit@5
mAP@5
MRR
MF1@1
Preserved
0.739
0.739
0.841
0.671
0.789
0.592
Stretched
0.716
0.716
0.830
0.652
0.778
0.603
Table 6: Ablation on component patch normalization for BoB-Hungarian-L2. Preserved : aspect-ratio-preserving scale-and-pad. Stretched : direct isotropic resize to 64×64 .
Method
ms/query
Scales w/ N
BoW-Cosine (precomputed)
0.006
No
BoB-Hungarian (precomputed)
0.006
No
BoB-Hungarian (on-the-fly)
10.30
Yes
BoW-Cosine → BoB-OT ( M =30)
11.33
No
Table 7: Query-time runtime profiling. Precomputed lookup is free for all methods; on-the-fly assignment costs scale with K .
Dense image retrieval is accurate but offers limited interpretability and attribution, and it can be compute-intensive at scale. We present BM25-V, which applies Okapi BM25 scoring to sparse visual-word activations from a Sparse Auto-Encoder (SAE) on Vision Transformer patch features. Across a large gallery, visual-word document frequencies are highly imbalanced and follow a Zipfian-like distribution, making BM25's inverse document frequency (IDF) weighting well suited for suppressing ubiquitous, low-information words and emphasizing rare, discriminative ones. BM25-V retrieves high-recall candidates via sparse inverted-index operations and serves as an efficient first-stage retriever for dense reranking. Across seven benchmarks, BM25-V achieves Recall@200 ≥ 0.993, enabling a two-stage pipeline that reranks only K=200 candidates per query and recovers near-dense accuracy within 0.2% on average. An SAE trained once on ImageNet-1K transfers zero-shot to seven fine-grained benchmarks without fine-tuning, and BM25-V retrieval decisions are attributable to specific visual words with quantified IDF contributions.
Retrieval-augmented generation (RAG) is a common way to ground language models in external documents and up-to-date information. Classical retrieval systems relied on lexical methods such as BM25, which rank documents by term overlap with corpus-level weighting. End-to-end multimodal retrievers trained on large query-document datasets claim substantial improvements over these approaches, especially for multilingual documents with complex visual layouts. We demonstrate that better document representation is the primary driver of benchmark improvements. By systematically varying transcription and preprocessing methods while holding the retrieval mechanism fixed, we demonstrate that BM25 can recover large gaps on multilingual and visual benchmarks. Our findings call for decomposed evaluation benchmarks that separately measure transcription and retrieval capabilities, enabling the field to correctly attribute progress and focus effort where it matters.
Martin Asenov, Kenza Benkirane, Dan Goldwater +1
Parexel AI Labs London, United Kingdom · Parexel AI Labs San Francisco, United-States
Vision Language Models have achieved near-human performance on single-document Visual Question Answering, yet their effectiveness degrades significantly when retrieving information from large collections of visually homogeneous documents. Existing multi-document benchmarks aggregate diverse document types, creating artificial separation in embedding space that does not reflect enterprise document repositories where thousands of records share identical visual templates. We identify this as embedding collapse and introduce Invoice Haystack, a benchmark with 1,500 anonymized invoice images paired with 200 discriminative question-answer pairs, specifically designed to stress-test retrieval under strong visual homogeneity. Invoice Haystack exhibits a mean pairwise cosine similarity of 0.73, compared to 0.38 (DocHaystack) and 0.31 (InfoHaystack) in existing benchmarks, posing a fundamentally more challenging retrieval problem. Addressing the identified challenge, we propose VL-RAG, a hybrid retrieval-augmented generation framework that jointly leverages text and visual embeddings to harness the complementary strengths of both modalities, followed by a VLM-based verification filter for precise document identification. VL-RAG achieves 60.0% Recall@1 on Invoice Haystack-500, outperforming existing state-of-the-art method by up to an absolute 13.5 percentage points. It further improves retrieval considerably on DocHaystack-1000 (77.1% vs.\ 75.2%) and InfoHaystack-1000 (84.5% vs.\ 80.0%), establishing the proposed dual-stream fusion as a consistently superior retrieval strategy across both homogeneous and heterogeneous document collections.