Skip to main content

Module relative_position

Module relative_position 

Source
Expand description

Relative position embeddings for the ESM3 structure encoder (ferritin-100.22).

The structure encoder is local: each residue is encoded from its k-nearest neighbours in space, not from the whole chain. Those neighbours arrive in distance order, which throws away where they sat in the sequence — so the only thing telling the model that a spatial neighbour was also a sequence neighbour is this embedding.

It is also the encoder’s initial hidden state. There is no token embedding: the transformer starts from these relative offsets and lets all geometry enter through geometric attention.

Structs§

RelativePositionEmbedding
Embeds the signed sequence offset between a query residue and each of its spatial neighbours.

Constants§

BINS
Offsets are clamped to ±BINS before lookup.
NUM_EMBEDDINGS
Table rows: 2 * BINS + 2. The +2 is one row per clamped extreme plus the padding index that shifts the range to be non-negative — which is why the checkpoint’s table is 66 rows and not 65.