Add instant search-as-you-type semantic search without a network round trip.
Embed text on-device in privacy-sensitive apps so queries never leave the browser.
Ship semantic search in offline-first browser extensions or desktop apps.
Run embeddings inside edge functions on Cloudflare Workers or Vercel Edge with no separate inference service.
| soycaporal/ternlight | facebookresearch/vicreg | khrisat/text-humanizer | |
|---|---|---|---|
| Stars | 573 | 574 | 571 |
| Language | Python | Python | Python |
| Last pushed | — | 2023-07-06 | — |
| Maintenance | — | Dormant | — |
| Setup difficulty | easy | hard | — |
| Complexity | 2/5 | 4/5 | — |
| Audience | developer | researcher | general |
Figures from each repo's GitHub metadata at analysis time.
Some bundlers like older Vite or webpack need a one-line config change to handle the WebAssembly module.
ternlight is a small text embedding engine that turns sentences into numeric vectors you can compare for similarity, without calling any external API and without needing a GPU. The whole thing, model, tokenizer, and inference engine, fits inside a single WebAssembly file that is only about 5 to 7 megabytes, so it runs directly on a CPU in the browser, on a server, or on edge platforms. The project comes as two npm packages that share the same simple API: a base tier aimed at higher quality, and a mini tier that trades a bit of accuracy for a smaller download and faster embedding. With either one, you call a single function to turn a string into a fixed length vector, then compare vectors with a cosine similarity function, or ask for the most similar items in a list of texts given a query. The technical trick behind the small size is a distilled version of the all-MiniLM-L6 sentence embedding model, trained with ternary weights, meaning every weight in the model is restricted to negative one, zero, or positive one. That lets the math during inference use only additions and subtractions instead of full multiplications, and the model is trained this way from the start rather than compressed afterward. The inference engine itself is written in Rust and compiled to WebAssembly with SIMD instructions, so the simple math still runs fast on ordinary CPU cores, including ARM chips found in devices like a Raspberry Pi. Because everything runs on the user's own device, ternlight is meant for use cases like search-as-you-type interfaces, privacy sensitive apps where text should never leave the device, offline-first browser extensions or desktop apps, edge functions on platforms like Cloudflare Workers or Vercel Edge, and static sites that want semantic search without running a separate backend service. The repository includes the published npm packages, the Rust to WebAssembly inference engine, a Python pipeline for training and quantizing the model, benchmark and evaluation tooling, and design documentation. It works out of the box with most modern bundlers and edge runtimes, though a couple of build tools, like older Vite versions or webpack, need a small config change to handle the WebAssembly module correctly. The project is released under the MIT license.
A tiny 5-7 MB WebAssembly embedding engine that turns text into vectors on-device, with no API calls and no GPU required.
Mainly Python. The stack also includes Rust, WebAssembly, Python.
Use, modify, and redistribute freely, including commercially, as long as you keep the copyright notice.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.