Class DeepSeekTransformerBlock

java.lang.Object
io.github.kirstenali.deepj.layers.transformer.blocks.DeepSeekTransformerBlock
All Implemented Interfaces:
Layer, Trainable

public final class DeepSeekTransformerBlock extends Object
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 Details

    • DeepSeekTransformerBlock

      public DeepSeekTransformerBlock(int dModel, int nHeads, int qRank, int kvRank, int dFF, int maxSeqLen, Random rnd)
      Parameters:
      dModel - model dimension
      nHeads - attention heads (must divide dModel)
      qRank - Q latent dimension
      kvRank - KV latent dimension
      dFF - SwiGLU intermediate dimension
      maxSeqLen - maximum sequence length for the RoPE table
      rnd - random source for weight initialisation
  • Method Details