Problem
Gousto has rich recipe data: ingredients, nutrition, cooking steps and human-labelled attributes such as cuisine, dish type and protein type. Many of these columns are unstructured or have very high cardinality (cuisine alone has about 43 values and is still growing). One-hot encoding gives sparse data. Grouping cuisines into coarser classes throws away information. Mean encoding must be redone for every algorithm. The five embeddings already in the recommender are trained on past orders, so they describe what is bought together (a burger and a curry look similar, two curries do not), not what a recipe is.
Example from the article: users buy a burger and a curry together but never two curries in one order, so two curries look "different".
Solution in brief
Train a recipe embedding from the recipe's ingredient set with a Set Transformer, which ignores ingredient order and models interactions between ingredients. Train it with several classification heads at once (protein, cuisine and others), then keep the shared layers as the embedding generator. Any downstream model, including the recommender, can then use it.
Questions this case answers
- How to learn a reusable item representation from an unordered set of components when the available categorical attributes are too high-cardinality for one-hot encoding and co-purchase embeddings blur item similarity
- How to reduce the training cost of a recommender by feeding it item embeddings pre-trained on item content instead of interaction data
- How to represent items that have high-cardinality or unstructured attributes without redoing feature engineering for every model?
- How to build item embeddings that describe what an item is rather than what is bought together?
Tools and methods
- Set Transformer — encodes an unordered ingredient set into one vector with self-attention and attention pooling.
- Multi-task learning — one network predicts several recipe attributes, so the embedding captures all of them.
- Word2Vec + TF-IDF — the baseline: ingredient vectors averaged with TF-IDF weights.
- GloVe — pre-trained word vectors, the weakest baseline.
Google or a one-time email code. No password.