Modern Block

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

Modern Block

One whole modern layer in one machine: RMS norm, modern attention, add back; RMS norm, gated feed-forward, add back. With Rotary on, a stack of them needs no Position Table: see The Modern Block.

the modern layer

Shapes

A sequence [B×T×C] in, the same shape out.

Settings

  • Heads: 1, 2, 4 or 8. 4 by default. C must divide evenly by it, and with Rotary on, each head's width must be even.
  • Rotary: on by default.
  • QK norm: on by default.

Parameters

12 × C² + 2 × C + 1: about 49,000 at width 64, as a Transformer Block has.

In PyTorch

x = x + self.attn(self.rms1(x))
x = x + self.ffn(self.rms2(x))

Notes

Its picture shows the attention pattern of its first head.

Making it

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