Problem
Teams at a platform with many entity types (users, communities, games) each need features for their own classifiers, ranking and recommendation models. If each team ingests and trains on the raw data itself, overhead multiplies. The graph has billions of entities and tens of billions of relationships. Discord wanted one shared representation that any model owner can use off the shelf.
Example from the article: a user ID is linked to the server ("guild") the user belongs to; the same pipeline embeds games, used for game discovery experiments and Quests targeting.
Solution in brief
Treat the social graph as a set of head-relation-tail triples and pre-train one embedding per entity with contrastive learning. Observed edges are positives; negatives come from randomly corrupting positives during training; a triplet margin loss pulls related entities together. Quality is checked by link prediction, and the vectors are published for batch and online use.
Questions this case answers
- How to learn general-purpose vector representations of many entity types from a relationship graph with billions of edges, so downstream teams skip feature engineering
- How to train and check graph embeddings when only observed edges exist and negatives must be generated
- How to build reusable embeddings of users, communities and games from a social graph without hand-made features?
- How to train entity embeddings on a graph with billions of nodes using only positive edges?
Tools and methods
- Knowledge-graph embeddings (DERE, Discord's Entity-Relationship Embeddings) — one vector per entity ID, with a per-relation transformation.
- Contrastive learning with triplet margin loss — pushes true edges to score higher than corrupted ones.
- Link prediction metrics — top-1/10/50 hit rate, AUC, mean reciprocal rank (MRR) for model quality.
- UMAP — 2D/3D projection to inspect learned structure.
- BigQuery and Google Cloud Storage — batch distribution of vectors; an online service for live lookups.
Google or a one-time email code. No password.