Abstract
At Pinterest, we utilize image embeddings throughout our search and recommendation systems to help our users navigate through visual content by powering experiences like browsing of related content and searching for exact products for shopping. In this work we describe a multi-task deep metric learning system to learn a single unified image embedding which can be used to power our multiple visual search products. The solution we present not only allows us to train for multiple application objectives in a single deep neural network architecture, but takes advantage of correlated information in the combination of all training data from each application to generate a unified embedding that outperforms all specialized embeddings previously deployed for each product. We discuss the challenges of handling images from different domains such as camera photos, high quality web images, and clean product catalog images. We also detail how to jointly train for multiple product objectives and how to leverage both engagement data and human labeled data. In addition, our trained embeddings can also be binarized for efficient storage and retrieval without compromising precision and recall. Through comprehensive evaluations on offline metrics, user studies, and online A/B experiments, we demonstrate that our proposed unified embedding improves both relevance and engagement of our visual search products for both browsing and searching purposes when compared to existing specialized embeddings. Finally, the deployment of the unified embedding at Pinterest has drastically reduced the operation and engineering cost of maintaining multiple embeddings while improving quality.
Introduction
Pinterest is a visual discovery engine where billions of "Pins"—images representing ideas, products, and inspirations—are saved and organized by users. To help users navigate this vast visual landscape, Pinterest relies heavily on visual search. Whether a user is looking for visually similar home decor, identifying a pair of shoes from a real-world photo, or trying to buy the exact coffee table seen in a curated interior design shot, the underlying technology must understand the visual content of images at a deep level.
Historically, these different user needs were served by specialized models. However, maintaining a fragmented ecosystem of embeddings presented significant engineering challenges and missed opportunities for cross-task learning. This paper details the transition to a unified embedding architecture that powers all of Pinterest's visual search products.
The Challenge: Embedding Fragmentation
Before the unified approach, Pinterest maintained three distinct embedding pipelines:
- Flashlight: Focused on browsing related web images based on visual similarity.
- Lens: Designed to match real-world camera photos to web pins, requiring the model to bridge the "domain shift" between amateur photography and professional web content.
- Shop-the-Look: Aimed at finding exact product matches for items within a scene, such as a specific lamp in a living room.
This fragmentation led to "back-fill" problems: whenever a model was updated, billions of images across the entire Pinterest catalog had to be re-indexed, a process that is both time-consuming and computationally expensive. Furthermore, these specialized models were siloed; the rich "exact match" data used for shopping could not benefit the general visual similarity models used for browsing.
A Unified Multi-Task Learning Architecture
To solve these issues, the researchers developed a multi-task deep metric learning framework. Instead of the traditional triplet loss—which compares anchors, positives, and negatives and is notoriously difficult to scale—they framed visual search as a large-scale multi-task classification problem.
Shared Backbone and Multi-task Heads
The architecture uses a SE-ResNext101 backbone as a shared feature extractor. From this backbone, the network branches into multiple "heads," each dedicated to a specific objective:
- Category Classification: Predicting broad product categories.
- Instance Matching: Identifying specific, unique products for Shop-the-Look.
- Semantic Similarity: Learning from user engagement data (clicks and saves).
Scalable Training with Proxy-based Classification
Handling millions of distinct product classes required a novel approach to training. The team implemented a subsampling module that maintains a "proxy bank" of class weights in CPU memory. For each training batch, only a relevant subset of these proxies is moved to the GPU, allowing the model to scale to "web-scale" datasets without exceeding hardware limits.
Efficient Retrieval via Binarization
To ensure real-time performance across billions of images, the model includes a binarization layer. This layer learns to compress high-dimensional floating-point embeddings into compact binary strings. This reduces storage requirements and enables extremely fast retrieval using bitwise operations, with negligible impact on precision.
Data Heterogeneity and Cross-Pollination
The unified model was trained on a diverse mix of datasets, including Flashlight (~800k images), Lens (~540k images), and Shop-the-Look (~340k images). By training on these datasets simultaneously, the model benefited from "cross-pollination." The rigorous instance-level labels from the shopping data helped the model learn finer-grained visual features that improved general similarity searches in the Flashlight product.
Results and Impact
The unified embedding outperformed specialized models in both offline benchmarks and real-world user tests. In offline evaluations, the unified model showed dramatic improvements; for instance, Shop-the-Look Precision@1 jumped from 33.0 to 52.8. In human evaluation studies for the Lens product, the unified embedding achieved a +110% increase in Precision@5 over the previous specialized system.
Online A/B testing confirmed these results with significant lifts in user engagement, including a 26.7% increase in Lens Repins and a 24.3% increase in Lens Clickthroughs. Beyond performance, the unified approach drastically reduced operational overhead. The engineering team now maintains a single training pipeline and a single set of embeddings, eliminating the need for multiple expensive back-fills.
Conclusion
The transition to a unified embedding at Pinterest demonstrates that multi-task learning can do more than just simplify engineering—it can actually improve model quality by leveraging diverse data sources. By combining engagement data with human-labeled instance data in a scalable classification framework, Pinterest has created a robust visual search engine that understands everything from broad visual concepts to exact product matches.
Summary updated