Abstract
The need to compactly and robustly represent item-attribute relations arises in many important tasks, such as faceted browsing and recommendation systems. While vector embeddings work well for single-attribute queries, they struggle with compositional queries involving logical operations like "AND" and "NOT." This paper proposes replacing vectors with box embeddings—region-based representations that function as learnable Venn diagrams. We introduce a new benchmark for compositional queries and demonstrate that box embeddings provide substantial advantages over vectors, particularly for complex retrieval sets.
Introduction: The Problem with Points
In modern recommendation and search systems, items and attributes are typically represented as vector embeddings—points in a high-dimensional space. A high dot-product between an item vector and an attribute vector indicates a match. While effective for simple queries (e.g., "find comedies"), this approach falters when faced with compositional queries like "British comedies that are NOT romances."
Traditional vectors lack clear boundaries. To perform a "NOT" operation, a system must define where a concept ends. Vector arithmetic (adding or subtracting points) is a loose heuristic that fails to capture the strict set-theoretic logic required for complex filtering.
Methods: Thinking in Boxes
To address these limitations, we propose Box Embeddings:
- Representation: Every item and attribute is a $d$-dimensional hyper-rectangle (a "box").
- Geometric Logic: Intersection ("AND") is represented by geometric overlap. Negation ("NOT") is handled via the Inclusion-Exclusion principle, calculating the volume of one box that does not overlap with another.
- Learning with GumbelBoxes: To make these regions learnable via gradient descent, we use GumbelBoxes. These employ a probabilistic "soft" boundary to smooth sharp edges during training, allowing the model to adjust box positions and sizes to fit the data.
- Loss Function: The model maximizes "containment" probability, ensuring the box for a specific item (e.g., Toy Story) fits within the boxes of its attributes (e.g., "Animation").
Datasets and Query Types
We introduced the genre2movies benchmark to evaluate compositional retrieval. It combines noisy user tags from MovieLens with high-quality hierarchical genre data from Wikidata. The benchmark evaluates five query types, ranging from simple singletons to complex triple differences.
Key Results
Our experiments compared Box Embeddings against standard Vector Embeddings using both Probabilistic and Algebraic heuristics.
- Simple Queries: For single-attribute queries (P@1), both vectors and boxes performed similarly, achieving approximately 36.8%.
- Complex Queries: Boxes showed a significant advantage as logical operators were introduced. For Intersections, boxes achieved 32.9% P@1, outperforming the best vector method (24.1%). For Differences (using "NOT"), the gap widened: 48.4% P@1 for boxes versus 33.0% for vectors.
- Scalability: Box embeddings maintained higher accuracy as the retrieval set size increased (e.g., P@50), making them more practical for real-world browsing.
Discussion and Future Work
The primary advantage of box embeddings lies in their ability to define boundaries. While vectors excel at finding the "most relevant" items, boxes accurately define the entire set of items matching a concept, which is essential for exclusion logic. Furthermore, the geometric structure of boxes allows them to "correct" noisy training data by naturally pulling items into relevant regions based on related terms.
Future work includes incorporating user preferences into the box space for personalized complex searches and exploring non-axis-aligned shapes for specific relationship types.
Summary updated