ruv-FANN neural network library for local AI
Use ruv-FANN when you need a small neural network library with explicit weight-edit review rather than an opaque training loop. The Rust, JavaScript, and WebAssembly packages cover training, activation tracing, candidate evaluation, promotion, and rollback, while Safetensors tooling adds checkpoint hashing. Treat it as a focused local-model toolkit, not a general-purpose deep-learning platform. Checked 2026-11-24: MIT, last push 2026-11-23.
Training, inspection, and revision control
- โThe Rust core trains generic floating-point feedforward networks with backpropagation, RPROP, Quickprop, Adam, and AdamW. It also provides explicit dense-layer autograd with reusable gradient and optimizer buffers.
- โThe JavaScript neural network package exposes WASM inference and training through explicit subpaths. Package choices include the complete core, a smaller weight-editing install, and focused toolkit packages for smaller dependency footprints.
- โWeight-space programming separates inspection, proposal, evaluation, and activation. A direct parameter change starts as a candidate, and only an accepted candidate can be promoted to a new model revision.
- โActivation tracing reports model dimensions, checkpoint fingerprints, and values around layer boundaries. Sensitivity analysis uses central finite differences to diagnose the effect of small weight or bias changes.
- โWorkspace revisions support explicit promotion and rollback. Rollback creates another revision containing selected earlier weights, preserving the sequence of model changes.
- โSafetensors weight editing streams a private copy of F32, F16, or BF16 checkpoints, verifies the baseline hash, limits replacements, and can restore byte-identical originals from hash-bound receipts.
Installing the Rust crate and npm packages
For Rust, add the published crate to your project: sh cargo add ruv-fann For the JavaScript and TypeScript core: sh npm install [email protected] For the smaller weight-editing package: sh npm install [email protected] Install the standalone Rust Safetensors editor with: sh cargo install ruv-fann-wsp-tensor --version 0.1.0 --locked
Running inference and proposing weight edits
Start with the Rust API when the model is small and explicit weights make the expected result easy to verify: rust use ruv_fann::{ActivationFunction, NetworkBuilder}; fn main() -> Result<(), Box<dyn std::error::>> { let mut network = NetworkBuilder::<f32>::new() .input_layer(1) .output_layer_with_activation(1, ActivationFunction::Linear, 1.0) .build()?; network.set_weights(&[0.25, 0.5])?; let output = network.run(&[2.0])?; assert!((output[0] - 1.0).abs() < 1e-6); Ok(()) } For weight-space programming, call `applyWeightPatch` to create a bounded candidate, then pass it to `evaluateWeightPatch` with supplied cases and thresholds. Use `createWeightWorkspace` for proposal, promotion, and rollback. The package intentionally does not call an LLM provider or execute generated code; your application supplies the patch and decides whether to activate it.
Practical local AI integration patterns
- โขRun compact neural-network inference inside a Rust application, browser build, or Node.js service without sending model inputs to a remote provider.
- โขInspect a trained checkpoint's activations and test targeted neuron ablations before changing production weights.
- โขApply bounded weight edits under application-controlled promotion rules, with independent test cases kept outside the search process.
- โขTrain fixed dense models with autograd, freeze validated parameters, and reuse the prepared snapshot for repeated inference.
- โขMaintain auditable model revisions where promotion and rollback must be deliberate rather than automatic.
What ruv-FANN handles well
- โThe Rust, JavaScript, and WebAssembly paths share the same conceptual model and let teams keep computation local across native and browser environments.
- โThe revision workflow makes weight changes reviewable instead of treating a successful patch as an automatic improvement.
- โActivation tracing, finite-difference sensitivity, and independent evaluation give developers concrete diagnostics for small model edits.
- โSafetensors checkpoint editing includes hash binding, rollback receipts, and a policy that avoids overwriting existing files.
- โThe npm distribution supports smaller installations for focused weight editing instead of forcing every application to install the complete toolkit.
Scope, evidence, and safety limits
- โณThe README positions ruv-FANN around small neural networks and fixed dense workflows. It is not a broad model zoo, transformer training stack, or general tensor-graph framework.
- โณThe README explicitly says LSTM and GRU forecasting architectures return unsupported errors; forecasting currently covers a univariate RNN and simple baselines.
- โณFinite-domain checks, checkpoint hashes, and independent cases do not establish universal safety or generalization. Worker threads are also execution contexts, not security sandboxes.
- โณThe standalone Safetensors utility runs offline and does not overwrite files that already exist. Its guide states that gains in GPU generation and model quality remain unvalidated.
- โณThe package family spans separate Cargo workspaces and npm package boundaries. Some satellite packages intentionally retain nested core dependencies, while Agenticow needs Node.js and a supported native binary.
- โณAgentDB is installed and owned by the application, so persistence is not provided as a self-contained service by ruv-FANN.
Choosing a different package or workflow
Who should choose ruv-FANN
Choose ruv-FANN if you are building a small local model in Rust, JavaScript, TypeScript, or WebAssembly and need inspectable parameters, explicit evaluation gates, or auditable model revisions. Pick another framework for large pretrained models, general tensor graphs, recurrent architectures not listed as supported, or workflows centered on an existing model interchange format.
Frequently asked questions
ruv-FANN is open source under the MIT License, which permits commercial use, modification, distribution, and private use. The license applies to the repository, while third-party dependencies and separately installed services retain their own terms.
ruv-FANN runs in Node.js and compatible browsers through its WebAssembly packages. The standalone weight-editing package uses ESM and requires Node.js 20.9 or newer. Browser deployment still requires application-controlled model loading, evaluation, and promotion.
Weight-space programming in ruv-FANN means proposing a direct change to selected model parameters instead of relying only on a training optimizer. The edited checkpoint remains a proposal until baseline and candidate results pass application-supplied cases and thresholds.
A proposed ruv-FANN weight edit never activates itself. Your application evaluates the candidate, controls promotion, and can retain the previous revision or create a rollback revision containing the selected earlier weights.
Yes. ruv-fann-wsp-tensor can process existing F32, F16, and BF16 Safetensors checkpoints, but it streams a private copy and never overwrites the original. Baseline hashes, bounded replacements, and rollback receipts protect the edit workflow.
ruv-FANN does not currently support LSTM or GRU forecasting architectures; those requests return unsupported errors. The repository's forecasting package currently implements a univariate RNN and simple baseline models.
The problem it solves
Small local models often need more than a single inference call: developers may need to trace activations, alter selected parameters, compare a candidate against its baseline, and undo an unsuccessful revision. ruv-FANN fills that gap with an explicit weight-space programming workflow shared by Rust, JavaScript, TypeScript, and WebAssembly.
Related repositories
Curious whether ruv-FANN is right for you?
Let ChatGPT, Claude, or Perplexity look into it โ click below and see what AI actually says about ruv-FANN.
