pub struct TenantDeltaConfig {
pub rank: usize,
pub alpha: f32,
pub dropout: f32,
pub target_modules: Vec<String>,
pub learning_rate: f64,
pub max_accumulated_steps: u64,
pub decay_lambda: f64,
pub muon_momentum: f64,
pub layer_overrides: Option<HashMap<usize, LayerDeltaConfig>>,
}Expand description
Configuration for creating a new tenant delta (also used by the create_lora MCP tool)
This is the single LoRA configuration type. TTT and PEFT differ only in lifecycle (online vs frozen), not structure.
Fields§
§rank: usizeLoRA rank (default: 8)
alpha: f32LoRA alpha scaling factor (default: 4.0, < rank for regularization)
dropout: f32Dropout probability (default: 0.0, unused by TTT but accepted by create_lora RPC)
target_modules: Vec<String>Target modules to apply LoRA to (default: [“q_proj”, “v_proj”])
learning_rate: f64Learning rate for Muon optimizer (default: 1e-3). Muon’s Newton-Schulz amplifies effective step ~22x for rank-8 LoRA B matrices.
max_accumulated_steps: u64Maximum accumulated gradient steps before requiring save/merge (default: 300)
decay_lambda: f64Weight decay factor for Muon optimizer (default: 0.0).
Decoupled weight decay applied as p *= (1 - lr * decay_lambda) per step.
Keep at 0.0 for LoRA-B (zero-initialized) — decay fights learned adaptation.
muon_momentum: f64Muon momentum coefficient (default: 0.9). Lower values reduce oscillation risk with higher learning rates.
layer_overrides: Option<HashMap<usize, LayerDeltaConfig>>Per-layer rank/module override. Key = layer index.
Layers not in map use the top-level rank and target_modules.
Implementations§
Source§impl TenantDeltaConfig
impl TenantDeltaConfig
Sourcepub fn from_profile(
base: &TenantDeltaConfig,
profile: &LayerProfile,
) -> TenantDeltaConfig
pub fn from_profile( base: &TenantDeltaConfig, profile: &LayerProfile, ) -> TenantDeltaConfig
Create config with non-uniform per-layer ranks from a TTN analysis profile.
Works for any model — the profile is produced by ttn_profile::get_layer_profile().
Sourcepub fn from_profile_with_quant_caps(
base: &TenantDeltaConfig,
profile: &LayerProfile,
layer_dtype_bytes: Option<&HashMap<usize, usize>>,
) -> TenantDeltaConfig
pub fn from_profile_with_quant_caps( base: &TenantDeltaConfig, profile: &LayerProfile, layer_dtype_bytes: Option<&HashMap<usize, usize>>, ) -> TenantDeltaConfig
Like from_profile but applies the static
rank↔quant coupling cap (#326): the oracle’s recommended per-layer rank
is clamped by the layer’s stored dtype so a coarse-quant layer (e.g.
block-wise FP8) is not assigned a rank it cannot usefully express.
layer_dtype_bytes maps layer_idx -> stored-weight element size in bytes (1 = FP8/int8, 2 = FP16/BF16, 4 = FP32). Layers absent from the
map (or None for the whole map) are left uncapped — identical to
from_profile.
This is static (applied once, here, when the config is built). It is
deliberately NOT wired into the live auto_adapt rank-oracle path, which
must stay free to adapt rank at runtime without re-deriving quant caps.
Trait Implementations§
Source§impl Clone for TenantDeltaConfig
impl Clone for TenantDeltaConfig
Source§fn clone(&self) -> TenantDeltaConfig
fn clone(&self) -> TenantDeltaConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TenantDeltaConfig
impl Debug for TenantDeltaConfig
Source§impl Default for TenantDeltaConfig
impl Default for TenantDeltaConfig
Source§fn default() -> TenantDeltaConfig
fn default() -> TenantDeltaConfig
Source§impl<'de> Deserialize<'de> for TenantDeltaConfig
impl<'de> Deserialize<'de> for TenantDeltaConfig
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TenantDeltaConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TenantDeltaConfig, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for TenantDeltaConfig
impl Serialize for TenantDeltaConfig
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for TenantDeltaConfig
impl RefUnwindSafe for TenantDeltaConfig
impl Send for TenantDeltaConfig
impl Sync for TenantDeltaConfig
impl Unpin for TenantDeltaConfig
impl UnsafeUnpin for TenantDeltaConfig
impl UnwindSafe for TenantDeltaConfig
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request