Inference models
Forward-only inference models with zero gradient or optimizer memory overhead and O(1)-step KV-cache decoding: InferenceDecoderOnlyModel, InferenceEncoderDecoderModel, InferenceModel, InferenceRnnModel.
All modules (19)
Core APIConfigurationTypesMathsUtilitiesFile & matrix I/OBitmap I/OAudio I/OAudio processingText & tokenizersModel baseLayers, Activations & LossesOptimizers & LR schedulesTraining modelsModel buildersInference modelsCorpus, chat & checkpointsCUDA backendsServer
class InferenceDecoderOnlyModel
Flat contiguous weight storage with zero gradient/Adam buffers and per-layer KV-cache for fast autoregressive token generation.
explicit InferenceDecoderOnlyModel(const TrainingDecoderOnlyModel &trainedModel);
static InferenceDecoderOnlyModel fromCheckpoint(const std::string &filePath) / fromGGUF(...) / fromONNX(...);
int predictNextToken(PayloadTensor1D &batch) / std::vector<int> inference(PayloadTensor1D &batch, size_t max_len, std::ostream *outputStream = nullptr, size_t tokensPerWrite = 1);
class InferenceModel
Compact forward-only sequential/CNN/RNN inference model.
explicit InferenceModel(const TrainingModel &trainedModel);
Tensor1D predict(const Tensor1D &input) / Tensor1D predict(const std::vector<real_t> &input) / Tensor2D predictBatch(const Tensor2D &inputs);