Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
ITransformerBlock.ixx File Reference

Virtual inference interface for a heterogeneous transformer block list. More...

#include <memory>
import Compute.DeviceTypeTraits;
import Compute.DeviceType;
import Compute.Device;
import Compute.GqaState;
import Dnn.TensorDataType;
import Dnn.TensorTypes;
import Dnn.Tensor;

Classes

class  Mila::Dnn::ITransformerBlock< TDeviceType, TPrecision >
 Polymorphic inference interface for one transformer block. More...

Namespaces

namespace  Mila
 Mila main API namespace.

Detailed Description

Virtual inference interface for a heterogeneous transformer block list.

A transformer whose stack interleaves structurally different block kinds cannot hold a homogeneous vector<Block> the way GptTransformer / LlamaTransformer do, so it drives its layer list through this interface – one virtual call per layer per token step, negligible against the per-layer GEMMs. Implemented by both GemmaBlock instantiations (local sliding / global full attention) and by both Qwen block kinds (attention / DeltaNet); see Specifications/Gemma.md section 8 and Specifications/Qwen3.8.md section 8.

Inference-only: the interface exposes the prefill/decode KV-cache path and the shared GQA workspace wiring, not training forward/backward (those remain on the concrete CompositeComponent if ever needed).