Class LlamaModel

java.lang.Object
io.github.kirstenali.deepj.models.DecoderOnlyModel
io.github.kirstenali.deepj.models.llama.LlamaModel
All Implemented Interfaces:
CausalLM, Persistable, Trainable

public final class LlamaModel extends DecoderOnlyModel
Llama-style decoder-only transformer.

Architecture differences from GPTModel:

  • No learned positional embedding — RoPE is applied inside each attention block.
  • RMSNorm instead of LayerNorm for the final pre-head normalisation.
  • SwiGLU feed-forward instead of GELU-FFN.
This compact implementation uses full multi-head attention and does not maintain an incremental KV cache; it is not an exact release of Meta's Llama models.

Forward/backward/parameters are provided by DecoderOnlyModel.

  • Constructor Details

    • LlamaModel

      public LlamaModel(LlamaConfig cfg, long seed)
  • Method Details

    • gradClipNorm

      public float gradClipNorm()
      Description copied from interface: CausalLM
      Global gradient-clipping threshold (e.g. 1.0).
    • config

      public LlamaConfig config()