What is the role of WebAssembly in browser-based offline AI?
WebAssembly (Wasm) enables running AI models directly in web browsers without server connectivity. Key frameworks: TensorFlow.js with Wasm backend, ONNX Runtime Web, and MediaPipe for vision tasks. Wasm advantages: near-native performance (within 2x of native code), runs in any modern browser, leverages WebGPU for GPU acceleration, and works with Service Workers for true offline capability. Implementation: convert models to ONNX or TFLite format, compile the inference runtime to Wasm, bundle with a Service Worker that caches model weights in IndexedDB or Cache API. Performance tips: use SIMD extensions (128-bit), enable threading with SharedArrayBuffer, quantize models to INT8 for faster Wasm execution, and implement progressive loading showing results as model layers initialize. Use cases: offline document scanning, privacy-preserving face detection, on-device text classification, and browser-based language translation. Models up to 500MB are practical for browser deployment with good caching strategies.