Skip to main content

Module tenant_delta

Module tenant_delta 

Source
Expand description

Per-tenant LoRA delta for isolated Test-Time Training

Each tenant gets their own LoRA delta (A/B weight matrices) that accumulates adaptations across requests. Deltas are trained via SGD and can be persisted to content-addressed storage or merged into permanent adapter files.

Structs§

LayerDeltaConfig
Per-layer LoRA rank and target module override.
TenantDelta
Per-tenant LoRA delta with per-layer accumulation tracking
TenantDeltaConfig
Configuration for creating a new tenant delta (also used by the create_lora MCP tool)

Functions§

extract_lora_components
Extract LoRA components from hierarchical tensor names e.g., “base_model.model.layers.5.self_attn.q_proj.lora_A.weight” -> Some((5, “q_proj”, “lora_a”))
load_state_dict_from_bytes
Load a state dict from safetensors bytes.
serialize_state_dict_to_bytes
Serialize a state dict (HashMap<String, Tensor>) to safetensors bytes.

Type Aliases§

SharedTenantDelta
Type-safe wrapper that enforces Mutex protection for TenantDelta. All cross-thread access must go through this wrapper.