A knowledge-graph embedding model places every entity at a point in vector space and represents each relation as an operator, then scores whether a triple (head, relation, tail) is true by how close the operator maps head to tail.
TransE: score(h,r,t) = ‖ h + r − t ‖
relation r is one translation vector, shared by every
triple of that type — "walk from head, land near tail".
RotatE: score(h,r,t) = ‖ Rot(h, θr) − t ‖
relation r is a rotation by angle θr about the origin —
it can only turn h, never stretch or shrink it.
This toy graph has 3 continents, 6 countries and 6 capital cities, laid out on this 2D map. part_of triples (country→continent) and capital_of triples (city→country) both move outward to a larger-magnitude point — exactly the kind of hierarchical relation translation handles well and pure rotation cannot, because rotation preserves the head's distance from the origin. Watch the rank and score jump when you switch models on the same query: that gap is the real reason production systems pick a relation family (TransE, RotatE, ComplEx, DistMult…) to match the relation patterns in their data.
Honest limits. The entity positions are hand-placed (not trained), and the two relation operators are fitted in closed form from the 12 triples: TransE uses the mean difference vector, RotatE the circular-mean rotation angle about the vertical axis. Real RotatE rotates complex-valued coordinates of a learned embedding; here it is a geometric stand-in. The checks below the controls recompute every prediction independently and verify that a known 40 degree rotation is recovered.
- ◀ Head / Head ▶ — cycle the query's head entity.
- Relation — toggle between
capital_of and part_of.
- TransE / RotatE — switch the scoring model; the ghost marker and arrow show where each model predicts the tail.
- Margin ε — any entity scoring under this distance from the prediction is highlighted as a plausible candidate.
- Drag the map to pan, scroll (or pinch) to zoom.