Gated Feed-Forward Block

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

Gated Feed-Forward Block

A feed-forward block whose hidden numbers have a gate each: one branch, through SiLU, decides how much of the other gets through.

the gated feed-forward block

Shapes

A sequence [B×T×C] in, the same shape out. It widens to 8/3 of C inside.

Parameters

3 × C × 8/3 C = 8 × C², no biases: what a Feed-Forward Block at Expand 4 has, less its biases.

In PyTorch

self.w1, self.w2 = nn.Linear(C, H, False), nn.Linear(C, H, False)
self.w3 = nn.Linear(H, C, False)
y = self.w3(F.silu(self.w1(x)) * self.w2(x))

Making it

The Fabricator makes it from a photomask of Gated Feed-Forward: verify the spec on a Bench, or find a salvaged mask in the ruins, which makes it unfused. See The Bench and the Fabricator.