Expand description
Training utilities and checkpoint management
This module provides:
ttt: Test-Time Training for research-valid model adaptationtenant_delta: Per-tenant LoRA delta for isolated TTTdelta_pool: Per-tenant delta registry with LRU evictionmerge: LoRA adapter merging strategies (DO-Merge, additive, replace) — 1-vs-1 save-time pathdelta_reducer: order-independent N-way param-server reducer (stack + truncated SVD)quality_filter: Heuristic-based output filtering (NOT for training)checkpoint: Checkpoint management with git integrationdata_loader: Training data loading utilities
Modules§
- adaptation_
state - checkpoint
- Async checkpoint management for training
- data_
loader - Training data loading and processing for LoRA fine-tuning
- delta_
pool - Per-tenant delta registry with LRU eviction
- delta_
reducer - N-way delta aggregation (param-server reducer) — replaces DO-Merge for multi-contributor merges.
- merge
- LoRA adapter merging strategies
- muon
- Muon optimizer: MomentUm Orthogonalized by Newton-Schulz.
- pipeline
- Pipeline-split (2b) training orchestration for TTT-on-split (#316).
- quality_
filter - Quality Filter Module
- tenant_
delta - Per-tenant LoRA delta for isolated Test-Time Training
- ttt
- Test-Time Training (TTT) Module
Structs§
- Chat
Template Data Loader - Training data loader with chat template formatting
- Checkpoint
Config - Checkpoint configuration
- Checkpoint
Info - Information about a checkpoint
- Checkpoint
Manager - Manages asynchronous checkpointing during training
- Checkpoint
Request - Checkpoint request sent to background worker
- Contribution
- One contributor in an N-way aggregation round.
- Contribution
Gate - Gate + weighting policy applied to each contributor before it enters the stack. Anomalous / over-norm contributors are rejected (error), never silently dropped or clamped to zero — a quiet drop would let a poisoned host shrink the merge invisibly.
- Contributor
State - One contributor’s full state for
reduce_state_dicts. - Delta
Pool - Registry managing per-tenant LoRA deltas for isolated TTT adaptation
- Evicted
Snapshot - Snapshot returned after eviction (for restoring delta state by the caller).
- Filter
Result - Result of quality filter evaluation
- Gradient
Gating Config - Per-layer gradient gating configuration.
- Guard
Status - Guard status — proof that invariant checks were run before resolution. Returned by the guard middleware; required input to resolve().
- Noop
Validation - No-op validation hook (the default until the held-out-eval host lands).
- Provenance
- Provenance for one contributor’s delta.
- Quality
Filter - Quality filter for generation outputs
- Quality
Filter Config - Configuration for quality filtering
- Rank
Oracle - Per-tenant rank adaptation oracle.
- Rank
Oracle Config - Configuration for runtime rank adaptation oracle.
- Stack
SvdReducer - Stack-in-delta-space + one truncated SVD per round to a fixed rank
R. - TTTConfig
- Configuration for Test-Time Training
- TTTContext
- Context for TTT adaptation (for future cross-model verification)
- TTTOverrides
- Per-request TTT overrides from the client
- TTTResult
- Result of TTT adaptation
- Tenant
Delta - Per-tenant LoRA delta with per-layer accumulation tracking
- Tenant
Delta Config - Configuration for creating a new tenant delta (also used by the create_lora MCP tool)
- Test
Time Trainer - Test-Time Trainer
- Train
Stage - A single pipeline stage: the stage model plus the global layer range it owns.
- Training
Dataset - Training dataset
- Training
Metrics - Training metrics to save with checkpoint
- Training
Sample - A single training sample
- Writeback
Info - Info returned after a successful writeback (for stats accounting by the caller).
Enums§
- Adaptation
Strategy - Strategy for handling a completed adaptation.
- Delta
Adaptation State - The lifecycle state of a tenant delta’s pending adaptation.
- Filter
Reason - Reason for filter failure
- Merge
Strategy - Merge strategy for combining tenant delta with existing adapter.
- Resolve
Outcome - Outcome of resolving an adaptation through the state machine.
- Weight
Format - Weight
Snapshot - Snapshot of model weights for checkpointing
Traits§
- Delta
Reducer - Order-independent N-way delta reducer.
- TTTVerifier
- Trait for TTT verifiers (future extension)
- Validation
Hook - Pluggable post-reduce validation seam.
Functions§
- compute_
ntp_ loss_ split - Compute the next-token-prediction (NTP) cross-entropy loss for a TTT step over a pipeline split, with the autograd graph intact across device boundaries.
- forward_
train_ pipeline - Run the TTT/training forward across pipeline stages and return logits with the autograd graph intact across device boundaries.
- load_
state_ dict_ from_ bytes - Load a state dict from safetensors bytes.
- merge_
state_ dicts - Merge two state dicts using the specified strategy.
- rank_
cap_ for_ dtype_ bytes - Static rank↔quant coupling cap.
- reduce_
state_ dicts - Aggregate N contributors’ full state dicts into one reduced state dict.
- serialize_
state_ dict_ to_ bytes - Serialize a state dict (HashMap<String, Tensor>) to safetensors bytes.
- stage_
ranges - Derive contiguous stage ranges from a
LayerDeviceMap.
Type Aliases§
- Shared
Tenant Delta - Type-safe wrapper that enforces Mutex protection for TenantDelta. All cross-thread access must go through this wrapper.