SONA WASM Example
Interactive browser demo of the Self-Optimizing Neural Architecture (SONA).
Quick Start
- Build the WASM module (if not already built):
cd ..
wasm-pack build --target web --features wasm
cp -r pkg wasm-example/
- Serve the example:
cd wasm-example
python3 -m http.server 8080
- Open in browser:
http://localhost:8080
Features
- Real-time Learning: Record trajectories and see instant updates
- LoRA Visualization: Watch transformation in real-time
- Statistics Dashboard: Monitor patterns, quality, and performance
- Interactive Controls: Adjust configuration and run experiments
Files
index.html- Demo page with UIindex.js- JavaScript logic using WASM bindingspackage.json- NPM configurationpkg/- Generated WASM packagesona.js- JavaScript bindingssona_bg.wasm- WebAssembly binarysona.d.ts- TypeScript definitions
Usage Example
import init, { WasmSonaEngine } from './pkg/sona.js';
async function main() {
await init();
const engine = new WasmSonaEngine(256);
const trajectoryId = engine.start_trajectory(new Float32Array(256).fill(0.1));
engine.record_step(trajectoryId, 42, 0.8, 1000);
engine.end_trajectory(trajectoryId, 0.85);
const output = engine.apply_lora(new Float32Array(256).fill(1.0));
console.log('Transformed output:', output);
}
main();
Performance
- WASM file size: ~1.5MB (release build)
- Initialization: < 100ms
- Per-trajectory overhead: < 1ms
- LoRA application: < 0.1ms (256-dim)
Browser Support
- Chrome/Edge 91+
- Firefox 89+
- Safari 14.1+
License
MIT OR Apache-2.0