Skip to main content

Module train

Module train 

Source
Expand description

Embedding training — the heavy, run-once artifact producer (see the module docs on affordability gating). Stochastic gradient descent with negative sampling: a margin ranking loss for the translational models (TransE, RotatE) and a logistic loss for the bilinear models (DistMult, ComplEx).

This is the path that must NOT sit on a user’s critical path: a capable machine runs it once and distributes the resulting EmbeddingTable. The per-triple score and gradient are kernel-class DenseLinear; this CPU reference is always present and is what a future GPU batch path would be correctness-gated against (§13).

The RNG is the deterministic LCG shared with the optimisation library, so a given seed reproduces the same table — important for an auditable, distributable artifact.

Structs§

TrainConfig
Training hyper-parameters.

Functions§

train
Train an embedding table on triples (entity/relation indices) with n_entities distinct entities and n_relations relations. Returns the trained table, or fails closed on an empty corpus / inconsistent config.