Residual Junction

Experimental alpha. Expect breaking changes and major bugs. Your feedback is much appreciated.

Residual Junction

Adds its two inputs, number by number. It has two jobs. It combines token and position vectors, and it makes residual connections: adding a branch's output back onto the stream that went into it, so the branch refines the stream instead of replacing it.

a residual connection

a residual connection's gradient

Shapes

Two equal shapes, or a smaller one that matches the end of the larger and repeats across it: [B×T×C] and [T×C] make [B×T×C].

Parameters

None.

In PyTorch

x = x + self.attn(self.norm1(x))

Notes

The identity term in its gradient gives every layer a direct path back to the loss. That is why stacks of residual layers keep learning when plain stacks stall.

Making it

The Fabricator makes it with no mask. See The Bench and the Fabricator.