Knowledge Graphs for Product Recommendations
As we explored the potential of leveraging knowledge graphs in various applications, we found another use case of real-world usage that we are all very familiar with: e-commerce!
In the vast and ever-evolving world of e-commerce, delivering personalized and relevant product recommendations to customers is a crucial challenge. While traditional recommendation systems often rely on historical purchase data and collaborative filtering, they can struggle to capture the nuanced, commonsense knowledge that underpins many of our everyday purchasing decisions.
Amazon COSMO Framework
That's where Amazon's COSMO framework comes into play. COSMO, or the "Common Sense Knowledge Generation and Serving System," is a groundbreaking approach to building commonsense knowledge graphs that can dramatically improve the performance of product recommendation engines.
At the heart of COSMO is the recognition that commonsense reasoning is essential for understanding the context and relevance of customer queries. If a customer searches for "shoes for pregnant women," for example, a recommendation system powered by COSMO would understand the implicit need for slip-resistant, comfortable footwear, rather than simply suggesting the most popular or highest-rated shoes.
To build this commonsense knowledge, COSMO leverages a recursive process that combines large language models (LLMs), human annotation, and machine learning. The system starts by mining customer behavior data, including query-purchase pairs and co-purchase patterns, to uncover the underlying relationships between products and the contexts in which they are used.
An LLM is then tasked with describing these relationships using a set of predefined categories, such as "used for," "capable of," "is a," and "cause." The resulting candidate relationships are filtered using a series of heuristics to remove low-quality or redundant entries, and a subset is sent to human annotators for evaluation based on plausibility and typicality.
Armed with the annotated data, COSMO trains a machine learning-based classifier to assign scores to the remaining relationship candidates, keeping only those that meet a certain threshold. These high-quality relationships are then encoded as instructions for the LLM, which is prompted to generate additional explanations and insights.
The final result is a comprehensive knowledge graph that captures the commonsense connections between products, their functions, audiences, and usage contexts. This graph can then be seamlessly integrated into product recommendation models, providing a powerful boost to their performance.
Performance
To evaluate the impact of COSMO, the researchers conducted a series of experiments using the Shopping Queries Data Set, a benchmark dataset created for the KDD Cup 2022 competition. They compared the performance of three recommendation models: a bi-encoder, a cross-encoder, and a cross-encoder enhanced with COSMO's commonsense knowledge.
Keep reading with a 7-day free trial
Subscribe to The MLnotes Newsletter to keep reading this post and get 7 days of free access to the full post archives.