Machine Learning in 21 KB: Our WebAssembly Kernel
Kutup moved its client-side machine learning into a 21 KB WebAssembly kernel written in C — no TensorFlow.js, no 50 MB model download. How it works and what it buys.
Compute locally with a small numerical kernel, explicit memory limits and reproducible checks.
WebAssembly can run compiled C++ functions inside a browser. Kutup Lab uses it for statistics and simple prediction. Parsing, interface state and chart rendering remain in JavaScript. For a small dataset, transfer overhead may exceed computation savings; measure on actual devices before making speed claims.
Pass typed arrays with explicit lengths. Limit input size, reject non-finite numbers and copy results before reusing memory. Never pass a length exceeding the buffer capacity. A fixed upper bound makes the behavior of an educational tool easier to reason about.
Use fixtures containing a constant series, one sample, negatives, a large offset and an outlier. Compare native results with a reference implementation using a stated tolerance. Handle zero variance explicitly instead of emitting infinity. Show which engine was used when WebAssembly cannot load.
Local computation does not make an entire application offline. Lab data stays in the browser, whereas NQ questions go to its answer service. Explain this at the point of data entry. WebAssembly isolation does not replace application-level validation.
Measure on actual devices, since for a small dataset the transfer overhead may exceed the computation savings. Check native results against an independent reference implementation with a stated tolerance. Use fixtures with a constant series, one sample, negatives and an outlier, and show which engine ran if WebAssembly cannot load.
Local computation does not make an entire application offline. Lab data stays in the browser, but NQ questions are sent to its answer service. Explain this at the point of data entry, because WebAssembly isolation does not replace application-level validation.
Pilot steps in this guide are proposed engineering workflows. Examples do not constitute measured field performance.