/** * Native training via @ruvector/ruvllm's TrainingPipeline (#2549 follow-up). * * `neural train` historically trained only on the RuVector WASM path * (MicroLoRA + InfoNCE) and its "checkpoint" was a freshly-constructed * adapter's weights — the native TrainingPipeline (real epochs, loss * history, early stopping, EWC registration, disk checkpoints since * ruvllm 2.5.7) was never exercised. This service routes the LoRA * training leg through it. * * Batch formulation: pattern-alignment pairs — input = embedding[i], * target = embedding[i+1 mod n], quality 1.0 — the MSE analogue of the * WASM path's anchor→positive contrastive objective (adjacent training * items belong to the same pattern family by construction). * * Graceful: returns null when @ruvector/ruvllm is absent or anything * throws — callers fall back to the WASM path. */ export interface NativeTrainingResult { epochs: number; steps: number; finalLoss: number; bestValLoss: number | null; durationMs: number; earlyStopped: boolean; checkpointPath?: string; checkpointBytes?: number; /** True when training resumed from a --resume checkpoint. */ resumed?: boolean; /** * How the resume happened: 'resumeFrom' (ruvllm >=2.6.0 — restores epoch * position + optimizer state) or 'loadCheckpoint' (2.5.7 fallback — * weights only, training restarts from epoch 0). */ resumeMode?: 'resumeFrom' | 'loadCheckpoint'; } export interface NativeTrainingOptions { embeddings: Float32Array[]; epochs: number; batchSize: number; learningRate: number; dim: number; /** * Validation holdout fraction (0..1). >0 makes the pipeline report * bestValLoss + early-stopping; 0 (or omitted) disables validation. * validationSplit exists in ruvllm 2.5.7 — no version gate needed. */ validationSplit?: number; /** * Resume weights (and, on >=2.6.0, epoch position) from this checkpoint * BEFORE training. A missing/invalid path throws ResumeFailedError — an * explicit --resume must fail loudly, never silently fresh-train. */ resumeFrom?: string; /** When set, the TRAINED pipeline checkpoints here (ruvllm >=2.5.7). */ checkpointPath?: string; } /** * Thrown when an explicit --resume checkpoint cannot be found or loaded. * Distinct from the generic "native unavailable → null" degradation so the * caller can surface a loud, exit-1 failure rather than fresh training. */ export declare class ResumeFailedError extends Error { constructor(message: string); } export declare function nativeTrainingAvailable(): boolean; export declare function runNativeTraining(opts: NativeTrainingOptions): Promise; //# sourceMappingURL=native-training.d.ts.map