Problem
Canva's in-house search engine needs keywords on every template to surface it. Newer marketplace creators do not know which keywords work, and the keywords must exist in many languages. A classifier with one output per keyword cannot cover new keywords or languages, and one-hot labels hide that "shark" and "sharks" are related.
Example from the article: in the post's figure, the template text "The cat sat on the mat" is labeled with the keywords "cat" and "mat", while "dog", "shark" and "bat" from other templates in the batch are not.
Solution in brief
Two multilingual sentence transformers start from the same weights. One embeds template title and text, the other embeds a keyword, and their similarity matrix is trained as multi-label logits. Training uses single-language batches, randomly mixed across languages, and an asymmetric loss that down-weights the many negative pairs. At inference the keyword vectors are precomputed.
Questions this case answers
- How to assign free-form tags from an open vocabulary to text items in many languages when a fixed-class classifier cannot cover new tags or languages
- How to train a multi-label matching model when negative pairs vastly outnumber positives and a tag missing from an item is not a true negative
- How to suggest search keywords for new templates in many languages without a fixed keyword list?
- How to train a keyword model when negatives vastly outnumber positives and labels come from creators of mixed quality?
Tools and methods
- Siamese (twin) sentence transformers — embed templates and keywords in one space, so keywords can be matched by similarity instead of a fixed output layer.
- Sentence Transformers (multilingual) — pre-trained multilingual encoders to start from; they are already accurate before training.
- Contrastive, CLIP-style training — pulls relevant template-keyword pairs together and pushes irrelevant ones apart.
- Asymmetric loss (focal-loss variant) — keeps the abundant negative pairs from dominating training.
- PyTorch — the loss is implemented as a module.
Google or a one-time email code. No password.