Ternlight is a new open-source embedding model that packs semantic search into a 5 to 7 MB WebAssembly bundle and runs entirely on the CPU, with no API calls and no server. Released as an npm package under the MIT license, it reached the front page of Hacker News with more than 220 points within a day of launch. For anyone building search, retrieval, or recommendation features, it moves the embedding step out of a paid API and into the browser.

What This Enables

Ternlight lets you add semantic search to a web app without sending a single request to a hosted embedding service. Install the base package or the smaller mini tier, embed your documents in the browser, and rank them with cosine similarity right on the page. That opens up offline-capable search, zero per-query cost, and no user text leaving the device, which fits privacy-sensitive tools, documentation search, in-app command palettes, and lightweight retrieval over local notes.

Why It Matters for Creators

Hosted embedding APIs charge per token and add a network round trip to every query. Ternlight's base tier produces a 384-dimension embedding in roughly 5 milliseconds on a CPU, and its mini tier does it in about 2.5 milliseconds, fast enough to power typeahead search as the user types. Developers discussing the release on Hacker News pointed to that latency and the tiny footprint as the reasons it is practical for browser extensions and static sites. It also fits the broader 2026 push toward shrinking models to run on-device, a trend we covered with Liquid AI's 230M on-device model.

Key Details

Two tiers. The mini package is 5.0 MB gzipped with roughly 9.5 million parameters; the base package is 7.2 MB with about 15.4 million parameters. Both are two-layer models.

Quality. The base tier scores a 0.844 Spearman correlation against its teacher model and 0.465 NDCG@10 on the SciFact retrieval benchmark. The mini tier scores 0.820 Spearman.

Output. Both produce 384-dimension, L2-normalized embeddings and accept up to 128 tokens, about 95 words, per input.

Packaging. The inference engine, model weights, and tokenizer ship together in the bundle, so there is nothing else to fetch at runtime. A live browser demo runs the model against the React documentation to show retrieval quality in real time.

What to Do Next

Open the demo and search the React docs to gauge quality, then install the package from npm and test it against your own content. Start with the mini tier for latency-critical typeahead, and move up to base when you need higher retrieval accuracy. Because inputs cap at 128 tokens, split longer documents into chunks before embedding them.