AI Grimoire

Architectures / ffn

Feed-forward

Two thirds of a transformer’s parameters sit in a block that looks at one position at a time. It is where most of the model’s stored knowledge appears to live, and where gating turned out to be worth the extra matrix.

8 entries.

Entries

01.04.1
Activation Sparsitypromising
Most FFN neurons are zero for any given token; skip the rows they own.
O(n·d·s)
01.04.2
Feed-Forward as Key-Value Memorycommon
Read the FFN as a lookup table: W₁ rows are patterns, W₂ columns are what gets written.
—
01.04.3
Feed-Forward Networksstandard
Two matrices and a nonlinearity, applied to each position alone.
O(n·d²)
01.04.4
GELUcommon
A smooth gate on the identity, and the activation lineage it belongs to.
O(n·d)
01.04.5
Parallel Attention and FFNcommon
Run both branches off the same input instead of one after the other.
—
01.04.6
Product-Key Memorypromising
A million-entry lookup layer searched in √N time by factorising the key space.
O(√N·d)
01.04.7
Squared ReLUpromising
ReLU, then square: cheaper than a gate and far sparser than either.
O(n·d)
01.04.8
SwiGLUstandard
Gated feed-forward block; a Swish gate multiplied into a linear branch.
O(n·d²)