# Ternlight — 7 MB embedding model that runs in the browser

> A 7 MB sentence-embedding model that runs in the browser at ~5 ms per query, with no API call.

- Org: soycaporal
- Date: 2026-07-05
- Category: model, repo
- Source: https://github.com/soycaporal/ternlight
- Canonical page: https://ai-tldr.dev/releases/ternlight-v0-1-0/

## In short

Ternlight is a 7 MB sentence-embedding model distilled from MiniLM with ternary quantization-aware training. It runs on CPU in the browser via WebAssembly, holds 0.844 Spearman fidelity to its teacher, and needs no API.

## What it is

Ternlight is a compact text-embedding model that turns any short text into a 384-dimensional vector for semantic search, FAQ matching, and clustering. Distilled from all-MiniLM-L6 with ternary quantization-aware training, the base variant ships as a 7 MB WebAssembly bundle and the mini variant as 5 MB. Everything runs on CPU with no server or API involved.

## How it works

The Ternlight model uses ternary weights — each parameter is -1, 0, or +1 — following the BitNet b1.58 recipe, then packs the model, tokenizer, and inference engine into one WASM binary and uses SIMD for the matrix math. The published numbers show 0.844 Spearman correlation to the MiniLM teacher for the base model and 0.820 for the mini, at roughly 5 ms and 2.5 ms per embedding respectively.

## Why it matters

Small enough to ship inside a static site, Ternlight makes on-device semantic search practical without an inference service, an API bill, or a network round-trip. Because ternary weights compress the model by roughly 30× versus fp16, developers get sub-10-millisecond embeddings on the client CPU with a bundle small enough to cache once and reuse offline.

## Who it's for

Frontend developers, static-site owners, and anyone shipping search or FAQ features who wants embeddings without an API.

## Try it

npm i @ternlight/base

## Links

- [GitHub Repo](https://github.com/soycaporal/ternlight)
- [Live Demo](https://ternlight-demo.vercel.app/)
- [Hacker News](https://news.ycombinator.com/item?id=48811644)
