Compositional Queries

Queries that combine multiple attributes with logical operators — AND, OR, NOT — rather than asking about a single condition. Example: “comedies AND British BUT NOT romances”. They are the everyday shape of faceted browsing and structured recommendation, where users stack and negate filters.

Why They’re Hard for Vector Embeddings

Dot-product vector embeddings score one item against one query direction. They have no native notion of set membership, so AND/OR/NOT don’t compose cleanly — combining or negating attributes in vector space is an approximation that degrades as more conditions are added, and especially at larger retrieval-set sizes.

The Set-Theoretic / Box Approach

Set-Theoretic Embeddings — and concretely box embeddings (“learnable Venn diagrams”) — map the logical operators onto region operations:

Query operatorSet / region operation
ANDintersection (overlap volume)
ORunion
NOTcomplement

This makes compositional matching a geometric, first-class operation. See Answering Compositional Queries with Set-Theoretic Embeddings for evidence that boxes beat vectors on exactly these queries.

Articles