Class LlamaTransformerBlock
java.lang.Object
io.github.kirstenali.deepj.layers.transformer.blocks.LlamaTransformerBlock
Pre-LN transformer block with Llama-style full-head attention:
x = x + RoPE-Attn( RMSNorm(x) ) x = x + SwiGLU( RMSNorm(x) )
Composes RMSNorm1D, RoPEMultiHeadSelfAttention, and
SwiGLULayer.
-
Constructor Details
-
LlamaTransformerBlock
- Parameters:
dModel- model dimensionnHeads- attention heads (must divide dModel)dFF- SwiGLU intermediate dimension (typically ≈ 8/3 × dModel)maxSeqLen- maximum sequence length for the RoPE tablernd- random source for weight initialisation
-
-
Method Details
-
subLayers
Return the ordered sub-layers that own trainable parameters. -
forward
-
backward
-
parameters
- Specified by:
parametersin interfaceTrainable
-