Interface CausalLM

All Superinterfaces:
Trainable
All Known Implementing Classes:
DecoderOnlyModel, DeepSeekModel, GPTModel, LlamaModel

public interface CausalLM extends Trainable
Common contract for decoder-only causal language models (GPT, Llama, DeepSeek, …).

Extends Trainable with the three additional methods that every causal-LM training loop needs:

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    backward(Tensor dLogits)
    Back-propagates gradient of the logits through the model.
    forward(int[] inputIds)
    Maps token ids to logits [seqLen × vocabSize].
    float
    Global gradient-clipping threshold (e.g.

    Methods inherited from interface io.github.kirstenali.deepj.training.Trainable

    parameters, zeroGrad
  • Method Details

    • forward

      Tensor forward(int[] inputIds)
      Maps token ids to logits [seqLen × vocabSize].
    • backward

      void backward(Tensor dLogits)
      Back-propagates gradient of the logits through the model.
    • gradClipNorm

      float gradClipNorm()
      Global gradient-clipping threshold (e.g. 1.0).