Version
@ruvector/sona@0.1.7
- Also reproduced through
agentdb@3.0.0-alpha.17
- Node 26.4.0, macOS arm64
Reproduction
const input = [1, 0.5, -0.25, 0.75];
const engine = new SonaEngine(4);
console.log(engine.applyMicroLora(input));
// [0, 0, 0, 0]
AgentDB's SonaLearningBackend.enhance() returns the same zero vector before training.
After one raw trajectory followed by explicit flush(), applyMicroLora() returns a small nonzero delta, but still not the original input plus the learned delta.
Root cause
The Rust LoRA forward path has residual semantics: it adds the learned delta into the provided output buffer.
The N-API bindings in crates/sona/src/napi_simple.rs and crates/sona/src/napi.rs initialize that output buffer with zeros. Therefore the JavaScript API returns only the delta. AgentDB then replaces the query embedding with that returned value.
Impact
Before any learning, every enhanced query becomes the exact zero vector. After learning, queries become only a small adjustment vector rather than identity plus adjustment. This can collapse or badly distort retrieval rankings whenever SONA enhancement is enabled.
Requested fix
Initialize the micro-LoRA and base-LoRA output buffers from a clone of the input before invoking the Rust forward method.
Please add:
- A cold-start identity test.
- A post-feedback non-identity test.
- AgentDB integration coverage confirming that a cold query is preserved rather than zeroed.
Version
@ruvector/sona@0.1.7agentdb@3.0.0-alpha.17Reproduction
AgentDB's
SonaLearningBackend.enhance()returns the same zero vector before training.After one raw trajectory followed by explicit
flush(),applyMicroLora()returns a small nonzero delta, but still not the original input plus the learned delta.Root cause
The Rust LoRA forward path has residual semantics: it adds the learned delta into the provided output buffer.
The N-API bindings in
crates/sona/src/napi_simple.rsandcrates/sona/src/napi.rsinitialize that output buffer with zeros. Therefore the JavaScript API returns only the delta. AgentDB then replaces the query embedding with that returned value.Impact
Before any learning, every enhanced query becomes the exact zero vector. After learning, queries become only a small adjustment vector rather than identity plus adjustment. This can collapse or badly distort retrieval rankings whenever SONA enhancement is enabled.
Requested fix
Initialize the micro-LoRA and base-LoRA output buffers from a clone of the input before invoking the Rust forward method.
Please add: