Class DeepSeekTransformerBlock
java.lang.Object
io.github.kirstenali.deepj.layers.transformer.blocks.DeepSeekTransformerBlock
Pre-LN transformer block with DeepSeek-style latent attention:
x = x + MLA( RMSNorm(x) ) x = x + SwiGLU( RMSNorm(x) )
Identical to LlamaTransformerBlock except attention uses
MultiHeadLatentAttention instead of RoPE-MHA. The latent representation
can support a compressed cache in a future incremental decoder.
-
Constructor Summary
ConstructorsConstructorDescriptionDeepSeekTransformerBlock(int dModel, int nHeads, int qRank, int kvRank, int dFF, int maxSeqLen, Random rnd) -
Method Summary
-
Constructor Details
-
DeepSeekTransformerBlock
public DeepSeekTransformerBlock(int dModel, int nHeads, int qRank, int kvRank, int dFF, int maxSeqLen, Random rnd) - Parameters:
dModel- model dimensionnHeads- attention heads (must divide dModel)qRank- Q latent dimensionkvRank- KV latent dimensiondFF- SwiGLU intermediate dimensionmaxSeqLen- 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
-