@smartpointstech/sona
Self-Optimizing Neural Architecture (SONA) - Runtime-adaptive learning with LoRA, EWC++, and ReasoningBank for LLM routers and AI systems
Overview
This package provides native Node.js bindings to the spt-sona Rust crate. SONA implements runtime-adaptive learning through micro-LoRA adapters, Elastic Weight Consolidation (EWC++), and a ReasoningBank for pattern clustering. It is designed for LLM routers and agent systems that need to learn and adapt during execution.
Installation
bash
npm install @smartpointstech/sonaKey Features
- SonaEngine -- main engine for adaptive learning with configurable hidden dimensions
- Micro-LoRA Adapters -- low-rank adaptation applied at runtime for fast fine-tuning
- EWC++ Regularization -- prevents catastrophic forgetting across task switches
- Pattern Clustering -- automatic discovery and retrieval of learned pattern types
- TrajectoryBuilder -- records execution trajectories for background learning
Dependencies
No internal npm dependencies. Uses platform-specific native binaries via optional dependencies (e.g., @smartpointstech/sona-darwin-arm64). Built with @napi-rs/cli.
Quick Start
typescript
import { SonaEngine, TrajectoryBuilder } from '@smartpointstech/sona';
const engine = new SonaEngine({ hiddenDim: 256, microLoraRank: 4 });
const trajectory = new TrajectoryBuilder()
.setInput(inputVec)
.setOutput(outputVec)
.setQuality(0.85)
.build();
engine.submitTrajectory(trajectory);
const patterns = engine.findPatterns(queryVec, 5);API Reference
Exports
| Export | Type | Description |
|---|---|---|
SonaEngine | class | Main adaptive learning engine |
TrajectoryBuilder | class | Builder for execution trajectory records |
SonaConfig | interface | Engine configuration (dims, LoRA ranks, EWC lambda) |
LearnedPattern | interface | Cluster with centroid, quality, access stats |
PatternType | const | Pattern classifications: General, Reasoning, CodeGen, etc. |
getImplementationType | function | Returns 'native' or 'stub' |