Learning Backward Compatible Embeddings

Weihua Hu, Rajas Bansal, Kaidi Cao, Nikhil Rao, Karthik Subbian, Jure Leskovec

In large-scale industrial ecosystems, such as those at Amazon or Pinterest, embedding models serve as the foundational infrastructure for a wide array of downstream applications. However, updating these models often triggers a "versioning crisis." When a central embedding team releases a more accurate "Version 2.0," the new vector space typically breaks any downstream models trained on "Version 1.0." This forces organizations into a difficult choice: maintain costly legacy infrastructure indefinitely or mandate synchronized retraining across dozens of independent consumer teams.

This paper introduces BC-Aligner, a framework designed to resolve this friction by enabling backward compatibility through lightweight, "on-the-fly" transformations that map new vectors back to historical versions.

The Challenge of Model Evolution

The core problem lies in the distinction between intended tasks and unintended tasks. An embedding team might train a model specifically for product recommendation (the intended task). However, dozens of other teams may consume those same embeddings for unrelated purposes, such as fraud detection or sales forecasting (unintended tasks).

Because a new model version produces vectors in a different mathematical space, the consumer teams' models suddenly fail upon the update. Currently, the industry standard involves either keeping every old model version running—which is prohibitively expensive—or forcing a logistical nightmare of simultaneous retraining across the entire organization.

The BC-Aligner Framework

BC-Aligner adopts a "Keep-Latest" strategy. Instead of storing every historical model, the system only maintains the newest model and a series of lightweight backward transformations ($B_k$).

Key Methodological Components

  • Linear Transformations: To ensure transformations are fast enough for real-time production use, the authors utilize simple linear matrices to map the new embedding space back to the previous one ($z_k \approx B_k(z_{k-1})$).
  • Joint Training: Unlike "post-hoc" methods that attempt to align embeddings after a model is already trained, BC-Aligner trains the new embedding model and the transformation matrix simultaneously. This ensures the new model learns a space that is both high-performing and inherently translatable back to the legacy version.
  • Multi-step Alignment Loss: This is the paper’s primary innovation. When transformations are chained over several generations (e.g., mapping $v4 \rightarrow v3 \rightarrow v2 \rightarrow v1 \rightarrow v0$), small errors can snowball. BC-Aligner employs a novel loss function that explicitly suppresses this "error amplification," ensuring that even after many updates, the latest embeddings can still be mapped back to the original $v0$ space with high precision.

Experimental Evaluation

The researchers evaluated BC-Aligner using the Amazon Product Reviews dataset, focusing on the Musical Instruments, Video Games, and Grocery categories. They treated user-item link prediction as the intended task and established a benchmark of five unintended tasks to simulate downstream consumers, including user activity prediction, edge rating prediction, and item rating statistics.

Key Results and Insights

  • The Expressiveness Trade-off: The authors found that forcing a new model to produce embeddings identical to the old ones (a "NoTrans" approach) severely limits the model's ability to learn. By using a transformation matrix, the model gains the "freedom" to explore a better mathematical space while remaining compatible.
  • Minimal Performance Degradation: BC-Aligner achieved only a ~3% drop in intended task performance compared to a model with no compatibility constraints.
  • Near-Perfect Compatibility: For downstream consumer tasks, the performance drop was negligible (~0.5%) compared to the "gold standard" of keeping all old models alive.
  • Long-term Stability: While competing methods saw error rates skyrocket after four or five model updates, BC-Aligner’s alignment error grew sub-linearly, proving its robustness over multiple generations of model evolution.
  • Inductive Capability: Because the transformations are learned functions, they can be applied to brand-new items or users that were not present in the system when the original $v0$ model was trained.

Conclusion and Future Work

BC-Aligner provides a scalable path for industrial embedding evolution by treating backward compatibility as a first-class citizen during the training process. While the current work focuses on linear transformations for efficiency, future research may explore non-linear transformations (such as small neural networks) to further improve alignment. Additionally, while tested on recommender systems, the framework holds potential for application in computer vision and natural language processing, where embedding versioning remains a significant hurdle.

Summary updated

BibTeX
@inproceedings{hu2022learning,
  author = {Weihua Hu and Rajas Bansal and Kaidi Cao and Nikhil Rao and Karthik Subbian and Jure Leskovec},
  title = {{Learning Backward Compatible Embeddings}},
  booktitle = {ACM SIGKDD Conference on Knowledge Discovery and Data Mining},
  year = {2022},
}
Figure