Abstract
Modern neural encoders offer unprecedented text-image retrieval (TIR) accuracy, but their high computational cost impedes an adoption to large-scale image searches. To lower this cost, model cascades use an expensive encoder to refine the ranking of a cheap encoder. However, existing cascading algorithms focus on cross-encoders, which jointly process text-image pairs, but do not consider cascades of bi-encoders, which separately process texts and images. We introduce the small-world search scenario as a realistic setting where bi-encoder cascades can reduce costs. We then propose a cascading algorithm that leverages the small-world search scenario to reduce lifetime image encoding costs of a TIR system. Our experiments show cost reductions by up to 6x.
Introduction
Text-Image Retrieval (TIR) has been revolutionized by models like CLIP, which utilize Bi-Encoders (BEs) to map images and text into a shared latent space. While BEs are efficient because image embeddings can be pre-computed at "build time," the sheer scale of modern datasets makes this upfront cost prohibitive. Using a state-of-the-art, massive encoder (like ViT-G or ConvNeXt-XXL) to process billions of images is incredibly expensive and often unnecessary.
Existing "cascading" solutions usually focus on Cross-Encoders (CEs), which are more accurate but require processing image-text pairs together at runtime, making them too slow for massive searches. This paper identifies a gap: how can we use a hierarchy of Bi-Encoders to reduce the lifetime cost (build time + runtime) of a search system without sacrificing the quality of the results?
The Bi-Encoder Cascade Approach
The authors propose a Cascaded Search algorithm based on two key pillars: the "Small-World" assumption and a multi-level caching hierarchy.
The Small-World Scenario
The core insight is the formalization of the "small-world" observation: in real-world search engines, a small fraction of the document corpus (e.g., $p = 10\%$) accounts for the vast majority of search results. Most images in a database are "dark"—they are never seen by a user. By focusing computational resources on the "light" images that are actually retrieved, the system avoids wasting high-end GPU cycles on irrelevant data.
The Multi-Level Cascade
As shown in the architecture diagram below, the system splits the encoding process into two phases:
- Build Time: All images in the database are encoded once using a very "cheap" (small/fast) encoder ($I_s$).
- Runtime: When a query arrives, the system ranks all images using the cheap embeddings. It then takes the top-$m$ candidates and re-encodes them using a "large" (expensive/accurate) encoder ($I_l$).
Crucially, these expensive embeddings are cached. If a future query retrieves the same image, the system doesn't re-encode it. To prevent a massive latency spike for the very first queries (when the cache is empty), the authors introduce 3-level cascades (Small $\rightarrow$ Medium $\rightarrow$ Large). The middle tier acts as a buffer, reducing the number of images the "Large" model has to process initially.
Experimental Evaluation
The researchers evaluated their approach using two standard benchmarks: Flickr30k (31,000 images) and MSCOCO (5,000 validation set). They measured Recall@k to assess accuracy and calculated computational costs in terms of Multiply-Accumulate (MAC) operations to determine the "lifetime cost" ($F_{life}$) and latency ($F_{latency}$).
Key Results
The experiments demonstrated that the cascading strategy is highly effective across different architectures, including Vision Transformers (ViT), ConvNeXt, and BLIP.
- Efficiency: The algorithm achieved up to a 6x reduction in lifetime image encoding costs compared to using a standalone large encoder.
- Accuracy: In many configurations, such as the [L, XXL] ConvNeXt cascade, there was zero reduction in search quality (Recall@1, 5, and 10) compared to the expensive baseline.
- Latency Mitigation: 3-level cascades (e.g., [Base, Large, XXL]) reduced early-query latency by 1.75x to 2x compared to 2-level cascades, making the system more responsive during the initial "cache-filling" phase.
Discussion and Limitations
While the results are promising, the effectiveness of this approach depends heavily on the parameter $p$ (the percentage of the world that is "small"). If a search use-case involves a perfectly uniform distribution where every image is equally likely to be retrieved, the savings diminish. Furthermore, as databases grow to billions of images, even comparing cheap vectors becomes a bottleneck. Future work may involve combining this method with Approximate Nearest Neighbor (ANN) search or vector compression to maintain efficiency at extreme scales.
Summary updated