Translational Models: TransE and Its Family
📍 Where we are: Part I · Knowledge Graph Embeddings — Chapter 2. Link Prediction built the scoreboard: a score function, the filtered ranking protocol, and the frozen-random baseline that any model must beat. This chapter builds the first model that actually plays.
The previous chapter ended with a challenge in numbers: random geometry earns a filtered Mean Reciprocal Rank (MRR) of 0.1062 on our six ranking queries, so any model worth the name must beat that. This chapter answers with the simplest geometric hypothesis anyone has proposed for a knowledge graph, and one of the most influential [1]. Give every entity a point in a vector space. Give every relation a single fixed arrow, a translation. Declare a triple plausible exactly when the head's point, pushed along the relation's arrow, lands near the tail's point. That is the whole model. It has no hidden layers, no nonlinearity, and on our academic world only 288 numbers to learn, and yet training it multiplies the baseline MRR by seven. Because it is so small, we can afford total honesty: every gradient derived by hand and checked against the committed code, every training number quoted from a real run, and the model's signature failure first derived on paper and then pointed to in the output table, where it visibly happens to two students named carol and dave.
Imagine a city map where every person, paper, and university is a pin, and every kind of relationship is a fixed compass instruction, the same for everyone: "advises" might mean walk 300 meters northeast. To check a claimed fact, you stand on the head's pin, follow the relation's instruction, and see whose pin you are now closest to. If "start at alice, walk advises" drops you on bob, then "alice advises bob" is plausible. Training is the process of shuffling the pins and tuning the compass instructions until the known facts all work out as short walks. The catch is built into the metaphor: one fixed instruction gives one landing spot per starting pin, so if bob advises two students, both of their pins are dragged toward the same patch of pavement.
What this chapter covers
- The modeling bet, decoded before any math: what "a relation is a displacement of vector space" can express (chains and compositions) and what it structurally cannot (a 1-to-many relation forces its tails together, derived with the triangle inequality).
- The formal setup: embeddings in , the score , the margin ranking loss with , and uniform negative sampling that resamples known-true corruptions, quoted from
transe.py. - Every gradient by hand: derived from the chain rule on , then all six partial derivatives of the hinge, the zero-norm guard, and the stochastic gradient descent update, each matched to a line range of
loss_and_grads. - The constraint that stops cheating: why entities are renormalized to the unit sphere after every epoch: without it, inflating all norms drives the loss to zero while learning nothing.
- The committed run as a worked trace: the loss at epochs 1/10/100/500/1000, trained versus baseline evaluation (0.7778 versus 0.1062), and the top of the ranking table for the query (bob, advises, ?), every number real.
- The failure, measured on our own graph: carol and dave compete for the single target point , and the ranking table shows exactly who wins and by how much.
- The family as fixes: TransH, TransR, and RotatE, each a one-idea repair of a limitation of pure translation, with all four score functions in one table.
The bet: a relation is a displacement
Every model in this volume begins with a bet about what a relation is, geometrically. TransE's bet is the boldest because it is the smallest: a relation is a displacement, one fixed vector added to wherever you start [1]. Before any symbol appears, decode what that commits us to. In our graph the relation advises will be one arrow, learned once, and that single arrow must simultaneously carry alice to bob, bob to carol, and carol to erin, because all three facts are in the training set. The relation is not a lookup table of who advises whom; it is a rule of motion that every advising pair must obey at once.
That commitment buys real expressive power. A displacement composes: if you can walk advises and then walk advises again, the two arrows add, and the composite arrow is a candidate geometry for Volume 2's derived grandAdvisor role. Chains of 1-to-1 facts are the model's home territory: a chain of people, each advising the next, embeds as a sequence of points marching along one arrow.
The same commitment forbids other things, and we can prove one immediately, using nothing but subtraction. Suppose the model fits two facts exactly: bob advises carol and bob advises dave, so
The left sides are the same vector, therefore the right sides are equal: . Exact fit forces the two advisees onto the same point, erasing everything that distinguishes them. The approximate version is just as damning and follows from the triangle inequality (the fact that a detour is never shorter than the straight path, , where is the length of a vector : the square root of the sum of its squared coordinates). Write the two residuals, the leftover error vectors of the two facts, and suppose training has made both short, with lengths at most some small :
The first step inserts (which is zero, so nothing changed) and regroups. Look at the two grouped terms before invoking the inequality. The second, , is exactly the (bob, advises, dave) residual, with length at most by assumption. The first, , is the negation of the (bob, advises, carol) residual, and flipping every coordinate's sign changes nothing inside a sum of squares, so and its length is also at most . The triangle inequality then bounds the sum of the two terms by . The conclusion: the better TransE fits a 1-to-many relation, the closer its tails are forced together, at distance no more than twice the residual bound. This is not a training difficulty to be patched with more epochs; it is a theorem about the score function. Hold onto it, because at the end of this chapter we will watch it happen to carol and dave in the committed output, and the whole "family" of successor models exists to escape it [2].
Formal setup: points, one arrow per relation, a score
Now the symbols, each decoded before use. Fix an embedding dimension , the number of coordinates each vector gets; the companion code uses (transe.py lines 42–46). The space is the set of all lists of real numbers, so is the space of 16-number lists. Each of the 13 entities (mnemonic: head) or (tail) gets an entity embedding , a point. Each of the 5 relations gets a relation embedding , the displacement arrow (the code stores these as rows of a (13, 16) matrix ent and a (5, 16) matrix rel). The parameter count is exactly real numbers: the entire model.
The model's claim "the triple is true" becomes the vector equation . To grade how nearly it holds, define the residual and measure its length with the Euclidean norm (written , the square root of the sum of squared coordinates). That length is the triple's distance, and the score is its negation, so that higher means more plausible, matching the convention the evaluation protocol of the last chapter demands:
where the index runs over the coordinates and is the -th coordinate of . In the code this is a one-liner, the closure handed to kg.evaluate (transe.py lines 171–176):
def make_score_fn(ent: np.ndarray, rel: np.ndarray):
"""The scoring closure ``kg.evaluate`` expects: s(h,r,t) = -‖e_h+e_r-e_t‖₂
over entity/relation *names* (higher = more plausible)."""
def score(h: str, r: str, t: str) -> float:
return -float(np.linalg.norm(ent[E_ID[h]] + rel[R_ID[r]] - ent[E_ID[t]]))
return score
TransE in one picture: one shared arrow per relation moves every head toward its tail (left), training compares positive and corrupted distances through a margin (middle), and a 1-to-many relation drags its tails toward one target point (right), the failure the rest of the family repairs.
Original diagram by the authors, created with AI assistance.
The margin ranking loss and negative sampling
A score alone does not train anything; we need a loss whose descent makes true triples score higher than false ones. The subtlety, inherited from the open-world discussion of the last chapter, is that a knowledge graph supplies no false triples. TransE's answer is to manufacture them: for each training positive, corrupt it into a negative by swapping one end for a random entity, and then demand that the positive beat the negative by a fixed gap [1]. Write for the distance of the true triple and for the distance of its corruption. The margin ranking loss for the pair is
with the margin here (transe.py line 43). Read it as a demand with a tolerance: we want , the fake fact at least farther than the real one. When the demand is met, , the clamps to zero, and the pair contributes nothing: the model is not rewarded for over-separating. When the demand is violated the loss is positive and grows linearly with the violation. A loss of this clamped shape is called a hinge, and its one-sidedness is the point: it spends capacity only on ordering errors, which is exactly what the ranking evaluation measures.
The corruption step has a trap worth quoting the code for. Our graph is tiny and dense, so a "random" corruption of a true triple is sometimes another true triple: corrupt the tail of (bob, advises, carol) to dave and you have manufactured (bob, advises, dave), which is a held-out true fact, not a negative. Training on it as a negative would push a true fact's distance up. The sampler therefore resamples until the corruption is not a known triple (transe.py lines 114–125):
def _sample_negative(pos: tuple[int, int, int],
rng: np.random.Generator) -> tuple[int, int, int]:
"""One uniform negative for ``pos``: flip a coin to corrupt head or tail,
draw the replacement entity uniformly, and resample while the corruption
happens to be a known-true triple (so "negatives" are really negative)."""
h, r, t = pos
side = int(rng.integers(2)) # 0 = corrupt the head, 1 = corrupt the tail
while True:
e = int(rng.integers(len(ENTITIES)))
cand = (e, r, t) if side == 0 else (h, r, e)
if cand not in KNOWN_IDS:
return cand
One honest caveat, flagged already in the last chapter's methodology section: KNOWN_IDS is built from all 18 triples, test included, so the sampler never corrupts into a test fact. On a benchmark that would be a form of leakage; here it is the standard filtered convention applied consistently, and it is disclosed.
The gradients, derived by hand
The companion code uses no automatic differentiation; every derivative is written out, and a separate script (torch_check.py) replays the same function under autograd to certify them. So the derivation below is not decoration; it is the training algorithm. Six embedding rows touch the loss: the head, relation, and tail of the positive triple, and the head, relation, and tail of the negative. We need for each.
Step 1: the derivative of a norm. Everything reduces to one fact: how the length of a vector changes as the vector changes. Write the norm as a composition of a dot product and a square root, , and differentiate with respect to one coordinate by the chain rule. The outer function is with derivative ; the inner function is , whose derivative with respect to keeps only the term, giving :
Stacking the coordinates back into a vector,
the unit residual: the direction of at length one. Geometrically this says a vector's length grows fastest if you extend the vector along itself, at rate exactly 1, which is why the gradient has unit length. The formula fails only at , where the norm has a kink (a corner, like at ) and no derivative exists; there the code uses the subgradient , a legitimate stand-in at a kink, guarded by if d_pos > 0.0 (transe.py lines 92–94).
Step 2: through the hinge. The loss has two regimes. If the margin is satisfied, identically in a neighborhood, so every partial derivative is zero; the code returns six zero vectors (transe.py lines 87–90) and the training loop skips the update entirely (the if loss > 0.0 guard on line 150). If the margin is violated, the is the identity on its second argument, so
(At the exact boundary the hinge itself has a kink; the code's loss == 0.0 test puts the boundary in the zero-gradient regime, again a valid subgradient choice.)
Step 3: through the residual. The positive residual is . Nudge the head embedding by and the residual moves by exactly ; nudge the tail and it moves by . In matrix language, (the identity matrix), , and . Chaining the three steps for the positive head, with the unit residual:
Repeating the identical chain for all six rows (the negative side picks up the from Step 2) gives the complete gradient set:
This is, symbol for symbol, the dictionary the code returns (transe.py lines 101–108):
grads = {
"h_pos": u_pos.copy(),
"r_pos": u_pos.copy(),
"t_pos": -u_pos,
"h_neg": -u_neg,
"r_neg": -u_neg.copy(),
"t_neg": u_neg.copy(),
}
Step 4: the update, and what it does geometrically. Stochastic gradient descent applies with learning rate to each involved row (transe.py lines 156–161):
ent[h_p] -= LR * g["h_pos"]
rel[r_p] -= LR * g["r_pos"]
ent[t_p] -= LR * g["t_pos"]
ent[h_n] -= LR * g["h_neg"]
rel[r_n] -= LR * g["r_neg"]
ent[t_n] -= LR * g["t_neg"]
Read the signs as forces. The positive head moves by , straight against its residual, and the positive tail moves by , along it: both motions shorten , pulling the true fact together. The negative head moves by and the negative tail by : both lengthen , pushing the fake fact apart. When a row appears in both triples (the uncorrupted slots, always including the relation), it simply receives both updates, which is precisely the sum of the two gradients that the multivariable chain rule prescribes for a shared parameter.
The sphere constraint: closing the inflation escape
One line of the training loop remains unexplained, and it guards the whole enterprise. After every epoch, each entity embedding is rescaled to length one, back onto the unit sphere (transe.py lines 164–167):
# The TransE constraint: entities back to the unit sphere ‖e‖₂ = 1
# after every epoch (stops the loss cheating by inflating norms).
norms = np.linalg.norm(ent, axis=1, keepdims=True)
ent /= np.where(norms == 0.0, 1.0, norms)
Why is this necessary? Because the margin loss has a degenerate way to reach zero that involves no learning at all: scale everything up. Suppose at some point every positive is closer than its negative by even a hair, for some tiny . Multiply every entity and relation embedding by a constant . Every residual becomes , so every distance scales to , and the hinge argument becomes
which reaches zero (and goes negative beyond) as soon as . The loss reaches exactly zero while the ordering of candidates, the only thing the evaluation measures, has not changed at all: scaling by multiplies every score by and preserves every rank. The margin was supposed to be a real gap; inflation makes any nonzero gap look like a real one. Worse, the gradient dynamics actively seek this escape: the negative-side updates push entity rows apart every step, so without a constraint the embedding cloud drifts outward epoch after epoch, the loss decays for free, and training pressure on the positive residuals evaporates. The original recipe therefore constrains entity norms, and this implementation renormalizes after each epoch [1]. Projecting back to the sphere deletes the radial degree of freedom; the only way left to satisfy the margin is to arrange the points, which is the learning we wanted. Relation vectors stay unconstrained, since they must be free to span the gaps between sphere points.
The sphere also quietly reshapes what a translation can do. If a fact fits exactly on the sphere, with , then squaring the tail's norm gives , and using and solving,
Every head of relation must have the same projection onto : exact-fitting heads live on one hyperplane slice of the sphere. That identity has an immediate payoff for chains. In our graph, alice advises bob and bob advises carol; suppose both links fit exactly on the sphere. Then , and taking the dot product of both sides with gives . But alice and bob are now both exact-fitting heads of advises, so the hyperplane identity forces both dot products to equal , and the two statements agree only if . A nonzero translation can never fit two chained hops exactly on the sphere. Constraints of this kind are why, in practice, trained residuals hover near small nonzero values rather than vanishing; keep that in mind when reading the scores below.
The committed run: a worked trace
Everything above is assembled in train (transe.py lines 130–168): initialize entity and relation rows uniformly in (the original recipe's scale, lines 137–141), then for 1000 epochs sweep the 15 training triples, sample one negative each, call loss_and_grads, apply the six-row update, and renormalize entities. The run is deterministic (NumPy default_rng(0)), so the numbers below are not one lucky draw; they are the committed output of python3 transe.py, reproducible to the digit. The mean margin loss over the 15 positives falls like this:
| epoch | mean margin loss |
|---|---|
| 1 | 1.5827 |
| 10 | 0.6812 |
| 100 | 0.1594 |
| 500 | 0.0602 |
| 1000 | 0.0072 |
The first row is worth decoding. At epoch 1 the mean loss 1.5827 exceeds the margin . That cannot happen if the positives are winning: a pair whose positive is already closer than its negative () contributes at most , so a mean of forces on typical pairs. At initialization the true triple is, on average, farther than its corruption, because random points know nothing about the graph. By epoch 10 the mean violation is under the margin; by epoch 1000 it is 0.0072, meaning almost every (positive, negative) pair satisfies outright and contributes zero. Training has essentially saturated the hinge.
Did the geometry generalize, or only memorize? The evaluation from the last chapter answers with the six filtered ranking queries over the three held-out triples, against the frozen random baseline (seed 1, never trained, transe.py lines 179–186). The committed output:
filtered ranking over 6 queries (3 test triples × tail/head)
model MRR H@1 H@3 H@10 ranks
random (seed 1) 0.1062 0.0000 0.0000 0.8333 [10, 10, 12, 7, 10, 9]
TransE trained 0.7778 0.6667 1.0000 1.0000 [3, 3, 1, 1, 1, 1]
per query (filtered rank, random → trained):
(bob, advises, ?dave) 10 → 3
(?bob, advises, dave) 10 → 3
(bob, authored, ?p1) 12 → 1
(?bob, authored, p1) 7 → 1
(erin, affiliated, ?cmu) 10 → 1
(?erin, affiliated, cmu) 9 → 1
Check the headline number by hand from the ranks, since Mean Reciprocal Rank is just the average of reciprocal ranks: , and Hits@1 is : four of the six held-out queries are answered perfectly, at rank 1, by 288 numbers that were never shown those facts. Facts like (erin, affiliated, cmu) are recovered because erin's one training edge, (carol, advises, erin), pins her near carol, a cmu student, and the shared affiliated arrow does the rest. The module's competency checks assert this outcome (trained MRR at least 0.5, beating the baseline; transe.py lines 220–223), so the claim is enforced by an exit code, not by prose.
But four perfect answers is not the interesting part of that table. The interesting part is the pair of 3s, and they are exactly where the theorem from the start of this chapter said they would be.
The 1-to-many failure, measured on our own graph
The two rank-3 queries are the two ends of (bob, advises, dave), and bob is the one entity in our graph with two advisees: carol (a training triple) and dave (held out). Both facts want the same thing, : one target point, two claimants. The module scores every one of the 13 entities as the tail for the query (bob, advises, ?) and prints the top five; this is the committed output:
query (bob, advises, ?) — top 5 tails by s = -‖e_bob + e_advises - e_t‖
(gold answers carry their filtered rank: other known-true answers
are skipped, the same protocol as the MRR/Hits numbers above)
rank tail score
1 carol -0.3681 * gold (train), filtered rank 1
2 bob -0.4794
3 erin -0.7101
4 dave -0.7409 * gold (test), filtered rank 3
5 alice -0.8321
Read it row by row, because every line is the geometry talking.
Row 1, carol at distance 0.3681. The trained advisee, and she owns the target point. But notice the distance is 0.3681, not near zero, even after the hinge saturated: the shared advises arrow must also carry alice→bob and carol→erin, and the chain argument at the end of the sphere section proved that a nonzero translation cannot fit two chained hops exactly. The residual that remains is the compromise between three facts pulling one arrow in three directions.
Row 2, bob himself at 0.4794. This row is a free measurement of the relation vector. Score bob as his own tail and the entity terms cancel: . So the table tells us : the advises arrow is short, less than half the radius of the entity sphere. It has to be. A long arrow could fit one hop, but a chain of hops on a unit sphere cannot keep moving far in one fixed direction, so training shrinks the arrow until the whole chain is tolerably wrong rather than one link exactly right. A short arrow, in turn, means every entity is a mediocre candidate for its own advisee, which is why bob outranks three real people here.
Rows 3 and 4, erin at 0.7101 and dave at 0.7409. Here is the collapse, measured. Dave is a true advisee of bob, but the single target point is already spoken for by carol, and dave's other edges (he authored p3, he is affiliated with cmu) anchor him elsewhere. Our derivation bounded if both residuals were driven to ; the optimizer, unable to make both small while respecting dave's other facts, made carol's small (0.3681) and left dave's at 0.7409. The 1-to-many tension is resolved by sacrificing the held-out fact. Erin edging out dave is the same geometry from another angle: erin is carol's advisee, so training pulls , and since carol sits near bob's target point, erin sits near the target point plus one more short arrow, close enough to intrude. The filtered protocol (kg.py lines 79–104) removes carol, a known-true answer, from dave's candidate list, so dave's filtered rank is 3, behind bob and erin: exactly the 10 → 3 improvement, and no better, that the per-query table reported. Trained TransE is dramatically better than chance on this query and structurally unable to be perfect on it. That is what "the failure mode is a theorem" looks like in a ranking table.
The family: targeted fixes for provable failures
Everything wrong above is wrong with the score function, not with gradient descent, so the successors keep the training recipe (margin loss, negative sampling, norm constraints) and re-engineer the geometry. Each fix answers a limitation you can now state precisely, with one honest distinction: two of them are theorems derived in this chapter (the 1-to-many collapse above, and the symmetry collapse below), while TransR's motivation is a design argument about capacity, not a derived impossibility.
| model | relation parameters | score | the failure it fixes |
|---|---|---|---|
| TransE [1] | (the baseline) | ||
| TransH [2] | , | with | 1-to-many collapse |
| TransR [3] | , | one geometry for all relations | |
| RotatE [4] | , | , | symmetric relations (keeping antisymmetry, inversion, composition) |
Three reading notes on the table. First, the TransH and TransR papers state their scores with the squared norm, ; the square is dropped here for uniformity across rows, and nothing is lost, because squaring is a monotone map on nonnegative distances and therefore preserves every ranking. Second, is transpose notation for the dot product of the unit normal with (multiply matching coordinates, add them up): a single number, the length of 's shadow along the normal. Third, in the RotatE row is the modulus of a complex number, its length: the distance from zero in its plane, so the constraint puts each coordinate of on the unit circle.
TransH: project, then translate [2]. Each relation gets a hyperplane, described by its unit normal (a length-one vector perpendicular to the plane), plus a translation that lives inside the plane. Before translating, both entities are projected onto the hyperplane: subtracts off the component of along the normal, keeping only the part parallel to the plane. Rerun our collapse derivation and watch it break: exact fit for two advisees now forces , equality of projections only. Carol and dave may differ freely in the discarded direction , so they remain distinct points, distinguishable by every other relation, while looking identical to advises. The 1-to-many theorem dies because projection is deliberately lossy.
TransR: a separate space per relation [3]. TransH still makes all relations act inside one shared -dimensional space. TransR gives each relation its own -dimensional space and a projection matrix (a grid of learned weights mapping entity space to relation space); entities are mapped by , then translated. The motivation is that different relations care about different features of an entity: affiliated should read bob's institutional coordinates and ignore his research ones, while authored should do the opposite. A full matrix per relation can stretch, rotate, and collapse dimensions independently for each relation, at a real cost: adds parameters per relation, versus extra for TransH, so TransR trades the parameter frugality that made TransE trainable on 15 triples for expressiveness that needs far more data.
RotatE: translate angles instead of positions [4]. There is a failure the projection fixes never touch. Take a symmetric relation, one where and hold together, and fit both exactly with a translation: and . Add the two equations: , hence , hence , and substituting back, . Translation can model symmetry only by making the relation vanish and the entities coincide. RotatE moves the arithmetic to the complex numbers: entities are vectors in (each coordinate a complex number, a point in a plane), and a relation is a coordinate-wise rotation, a complex vector with every modulus (each coordinate a length-one complex number, a point on the unit circle), applied by elementwise multiplication . Multiplying by a unit complex number rotates that coordinate by a phase angle . Now rerun the symmetry argument, where exact fit both ways means and . Apply to both sides of the first equation and substitute the second: , which coordinate by coordinate reads , that is . On every coordinate where (a generic-position assumption worth stating: a trained entity has no exactly-zero coordinate) this forces , so : phases of 0 or . A rotation by is its own inverse without being the identity, so symmetric relations exist without collapsing the entities. Be precise about what is new here: pure translation already handled the other three classic patterns. Antisymmetry costs only (if exactly, the reversed triple's residual is , so the reverse scores strictly worse), inversion is , and composition is vector addition itself. Rotation keeps all three (inversion as the complex conjugate , rotating back; antisymmetry as any phase other than 0 and ; composition because rotations compose by adding phases) and adds the one pattern translation provably could not carry. One family member, four relational patterns, each an algebraic identity you can verify in a line [4].
The unsolved part
The family fixed the failures we could derive, and that is precisely what should worry you. Each repair was reactive: a theorem exposed a pattern translation cannot carry, and a new score function was engineered for that pattern. Nothing in this chapter says how many more such theorems are waiting, and no member of the family comes with a guarantee of the form "this geometry can represent every finite knowledge graph faithfully." The honest statement is that each model carves out a class of relational patterns it handles (chains, hierarchies, symmetries) and stays silent about the rest; the field found the failure modes empirically, one benchmark at a time, before deriving them. There is also a guarantee we quietly lack on the training side: the margin loss is not convex in the embeddings, so unlike the single neuron of Volume 1 there is no theorem that stochastic gradient descent finds the best arrangement, only the observed fact that on this graph, with this seed, it found a good one. A principled account of which score functions can express which graphs, rather than a catalog of patches, is where this volume is headed: the question gets a name and some sharp answers in the chapter on the expressiveness ceiling.
Why it matters
TransE is the hinge between the two halves of this series. Volume 2 ended with reasoners that are sound, complete, and silent about anything unproven; this chapter built the first system in the series that guesses, and every design choice ahead is a variation on its template: a geometric type for entities, a geometric operation for relations, a differentiable score, and gradient descent on ranked comparisons. The ontology-embedding chapters later in this volume will replace points with balls and boxes so that Volume 2's concepts, not just its individuals, get geometry; the query-embedding chapters will chain translations and their successors into multi-hop questions; and Volume 4's neuro-symbolic integrators will need exactly what we practiced here, gradients flowing through a truth-like score. Just as important is the epistemic lesson, which is the series' recurring one: the model's central weakness was not discovered by running it, it was derived before training and then confirmed in the output table, rank for rank. Geometry makes a model's promises and its failures provable, and that, more than any single MRR number, is why embedding research is mathematics and not alchemy.
Key terms
- Translational model — a knowledge graph embedding whose relation operation is vector addition: a triple is plausible when .
- Residual — the error vector of a triple; its Euclidean norm is the triple's distance, and the score is the negative distance.
- Margin ranking loss (hinge) — : zero once the true triple beats its corruption by the margin , linear in the violation otherwise.
- Negative sampling — manufacturing false triples by corrupting the head or tail of a true one with a uniformly random entity, resampling any corruption that is itself a known-true triple.
- Unit residual — the gradient of the Euclidean norm, derived from the chain rule on ; every gradient in TransE is a unit residual.
- Norm-inflation escape — scaling all embeddings by scales every distance by , driving any correctly ordered pair past the margin without changing a single rank; the unit-sphere renormalization of entities removes this direction.
- 1-to-many collapse — the theorem that a well-fit translation forces all tails of a shared (head, relation) pair within of one another; observed as carol (rank 1) crowding out dave (filtered rank 3).
- TransH / TransR / RotatE — the family: per-relation hyperplane projection, per-relation projection matrices into relation-specific spaces, and per-coordinate complex rotation, fixing the 1-to-many collapse, the one-geometry-for-all limitation, and symmetric relations respectively (rotation keeps translation's antisymmetry, inversion, and composition while adding symmetry).
Where this leads
Translation is one algebraic choice: relations act on entity space by addition. The next chapter, Bilinear Models: DistMult and ComplEx, makes the other elementary choice and lets relations act by multiplication, scoring triples with a weighted product of head and tail coordinates instead of a distance. The trade is instructive: multiplication buys back some of what addition lost, but DistMult, its simplest form, pays with a new theorem-grade failure, a score that is provably identical in both directions, which forces every relation to be symmetric; and its repair, ComplEx, reaches for the same tool RotatE did, the complex numbers. Different algebra, same story: the geometry makes a promise, the derivation finds the crack, and a sharper geometry answers.
Companion code: examples/neural/transe.py implements everything derived here, with loss_and_grads (lines 57–109) as the single source of truth for the mathematics, and examples/neural/kg.py supplies the 18 triples, the deterministic 15/3 split (lines 65–74), and the filtered evaluation (rank_of and evaluate, lines 79–122). Run python3 examples/neural/transe.py to reproduce every number in this chapter; its asserts (lines 220–223) fail the run if the trained model stops beating the baseline, and torch_check.py certifies the manual gradients against autograd.