|
Mila
Deep Neural Network Library
|
CRTP base configuration for all deployable Mila language models. More...
Classes | |
| struct | Mila::Dnn::LanguageModelConfig< TDerived > |
| CRTP base configuration for all deployable Mila language models. More... | |
Namespaces | |
| namespace | Mila |
| Mila main API namespace. | |
Enumerations | |
| enum class | Mila::Dnn::KvCacheCompression { None , FP8 } |
| KV cache storage and compression strategy for GroupedQueryAttention. More... | |
| enum class | Mila::Dnn::WeightQuantization { None , FP8 , FP4 } |
| Weight storage and matmul strategy for Linear components. More... | |
Functions | |
| std::string | Mila::Dnn::weightQuantizationName (WeightQuantization quantization) |
| The scheme name recorded in an artifact and in its manifest. | |
CRTP base configuration for all deployable Mila language models.
LanguageModelConfig<TDerived> owns the deployment concerns that are universal across all language model architectures:
All fluent setters return TDerived& so that chains work correctly across both base and derived methods without casting at the call site:
ModelConfig<TDevice, TPrecision> is the structural base for all Mila models. LanguageModelConfig is the deployment configuration counterpart for the language model branch of that hierarchy. Vision model configurations would derive from a sibling VisionModelConfig<TDerived>, not from this class.
LanguageModelConfig is the public API surface for deployment configuration. BuildContext is the internal carrier through the component tree. fromPretrained() projects LanguageModelConfig into BuildContext once – they are never the same object.
Convenience preset methods express common deployment decisions in user vocabulary. Fine-grained setters are available for atypical configurations:
|
exportstrong |
KV cache storage and compression strategy for GroupedQueryAttention.
Maps to the TKvPolicy template parameter on GroupedQueryAttention and CudaGqaOp via the fromPretrained() runtime->compile-time bridge. The mapping is:
None -> NoKvCompression (BF16 cache, no compression overhead) FP8 -> PerChannelKvFp8<> (FP8_E4M3 cache, per-head per-token float32 scales)
New compression algorithms (SlidingWindow, LowRank, TurboQuant) add a value here and a corresponding policy struct in KvCache.QuantPolicy – no other changes are required at this level.
| Enumerator | |
|---|---|
| None | No compression – default; BF16 KV cache. |
| FP8 | FP8_E4M3 per-head per-token KV cache compression – Alpha.6 target. |
|
exportstrong |
Weight storage and matmul strategy for Linear components.
Maps to the TWeightQuant template parameter on Linear and CudaLinearOp via the fromPretrained() runtime->compile-time bridge. The mapping is:
None -> NoWeightQuant (BF16 weights, standard cuBLASLt plan) FP8 -> PerChannelFp8<> (FP8_E4M3 weights, per-channel float32 scales) FP4 -> PerGroupFp4<> (future)
This enum is Mila API vocabulary. Callers set it via fluent methods on the concrete model config – they do not interact with the policy structs directly.
| Enumerator | |
|---|---|
| None | BF16 weights – default; no quantization overhead. |
| FP8 | FP8_E4M3 per-channel weight quantization – Alpha.5 target. |
| FP4 | Per-group FP4 weight quantization – future target. |
|
inlineexport |
The scheme name recorded in an artifact and in its manifest.
It lives beside the enum because it is written by the model that saves the artifact and read by the tool that packages it, and those two must agree exactly: the load side refuses an artifact whose scheme disagrees with the build's compile-time policy, since the bytes are packed differently per scheme and reinterpreting them produces a model that runs and is wrong. It was previously spelled out in both places.