ruvector_learning_wasm/lib.rs
1//! MicroLoRA WASM - Ultra-fast Low-Rank Adaptation for Edge AI
2//!
3//! This crate provides rank-2 LoRA (Low-Rank Adaptation) matrices optimized for
4//! WASM execution with <100us adaptation latency. Designed for real-time
5//! per-operator-type learning in query optimization systems.
6//!
7//! ## Key Features
8//!
9//! - **Rank-2 LoRA**: Minimal parameter count (2d parameters per adapter)
10//! - **Per-Operator Scoping**: Separate adapters for different operator types
11//! - **<100us Adaptation**: Instant weight updates for real-time learning
12//! - **WASM-Optimized**: no_std compatible, minimal allocations
13//!
14//! ## Architecture
15//!
16//! ```text
17//! Input Embedding (d-dim)
18//! |
19//! v
20//! +---------+
21//! | A: d x 2 | Down projection
22//! +---------+
23//! |
24//! v
25//! +---------+
26//! | B: 2 x d | Up projection
27//! +---------+
28//! |
29//! v
30//! Delta W = alpha * (A @ B)
31//! |
32//! v
33//! Output = Input + Delta W
34//! ```
35
36mod lora;
37mod operator_scope;
38mod trajectory;
39
40pub use lora::{LoRAConfig, LoRAPair, MicroLoRAEngine};
41pub use operator_scope::{OperatorScope, ScopedLoRA};
42pub use trajectory::{Trajectory, TrajectoryBuffer, TrajectoryStats};
43
44// Re-export core types for JS
45pub use lora::wasm_exports::*;
46pub use operator_scope::wasm_exports::*;