r/FunMachineLearning • u/paimeg • Jun 20 '26
An open-source AI semantic search model in the browser - 7MB, runs on CPU, no server
I’ve been toying around with a hobby project - ultra lightweight semantic embeddings on CPU. I made a model + tokenizer + Rust→WASM SIMD inference engine, all in one 7MB package. No API, no GPU, no ML runtime.
Check out the Live demo - semantic search over 2k React docs, fully on-device → https://ternlight-demo.vercel.app/
I used an aggressive BitNet-style ternary quantization on stacked encoders, distilled teacher model into a ternary student with QAT. A few highlights:
fast embedding on CPUs ~2ms per embed, ~500 emb/s
0.84 Spearman vs the MiniLM teacher model
Rust implementation of forward pass inference engine (no torch, no ONNX), includes ternary weights, embedding table, and tokenizer
Compiled into webAssembly, ubiquitous runtime
Planning to open source this, would love your thought... is this something you'd find useful as an npm package?