Package Exports
- @openfluke/welvet
- @openfluke/welvet/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@openfluke/welvet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@openfluke/welvet
M-POLY-VTD AI Engine (Loom v0.75.0) — Isomorphic TypeScript/WASM library for building, training, and evolving neural networks with 21 numerical types, WebGPU acceleration, and DNA-based evolution.
Features
- Isomorphic Architecture: Runs seamlessly in Node.js, Bun, and the Browser (React/Frontend).
- Multi-Precision Support: Native support for 21 numerical types (FP64, FP32, FP16, BF16, FP8, INT8... all the way down to Binary/Ternary).
- Hybrid Training: standard Backprop, Target Propagation, and NEAT-style structural evolution in a single unified engine.
- Hardware Acceleration: WebGPU support for high-performance inference and training in the browser.
- DNA Evolution: Network "DNA" extraction and comparison for architectural analysis and genetic recombination.
Installation
npm install @openfluke/welvet
# or
bun add @openfluke/welvetQuick Start
1. Initialization
The engine initializes automatically after a single call to init(). It detects whether it's running in Node.js, Bun, or the Browser and loads the appropriate WASM environment.
import welvet from "@openfluke/welvet";
await welvet.init(); // Auto-detects Node.js/Browser and loads WASM[!TIP] In browser environments, if your assets are served from a non-standard path, you can optionally pass a custom URL:
await init("/custom/path/to/main.wasm").
2. Create a Network
import welvet from "@openfluke/welvet";
// 1D sequential stack on the Volumetric Grid (cell 0,0,0)
const net = welvet.createNetwork({
depth: 1, rows: 1, cols: 1, layers_per_cell: 2,
layers: [
{ z: 0, y: 0, x: 0, l: 0, type: "Dense", input_height: 784, output_height: 256, activation: "ReLU" },
{ z: 0, y: 0, x: 0, l: 1, type: "Dense", input_height: 256, output_height: 10, activation: "Linear" }
]
});
const input = new Float32Array(784).fill(0.5);
const output = net.sequentialForward(input);
console.log("Prediction:", output[0]); // Returns Float32Array3. Training
import { trainNetwork } from "@openfluke/welvet";
const batches = [
{ input: [0.1, 0.2, ...], target: [1, 0, ...] },
];
const result = trainNetwork(net, batches, 10, 0.001);
console.log("Final Loss:", result.final_loss);4. Transformer (LLM Context)
// Create an MHA layer (Multi-Head Attention)
const tnet = welvet.createNetwork({
layers: [{ z: 0, y: 0, x: 0, l: 0, type: "MHA", d_model: 64, num_heads: 4 }]
});
// Wrap in Transformer context with pre-loaded weights
const model = welvet.createTransformer(tnet, embeds, lmHead, finalNorm);
const logits = model.forwardFull([1, 2, 3, 4]); // Direct token prefill5. NEAT Evolution
const population = welvet.createNEATPopulation(net, 100);
const fitnesses = new Array(100).fill(1.0);
population.evolveWithFitnesses(fitnesses);
console.log("Top Fitness:", population.bestFitness());Testing & Benchmarks
The package includes a built-in TypeScript testing suite suitable for both CI and environment verification.
Run tests in Node.js:
npm testOr individual suites:
npm run test:cabi # Check WASM exports and functional smoke tests
npm run test:bench # Run layer-by-layer performance benchmarksIntegrate tests into Frontend/React:
import { runVerify } from "@openfluke/welvet/tests/cabi_verify";
// Run benchmarks or verification logic directly in your app's lifecycle
await runVerify();License
Apache-2.0