A new embedding model called Ternlight runs entirely in web browsers at just 7MB in size, eliminating the need for API calls or server dependencies.
The model delivers semantic search capabilities in approximately 5 milliseconds on standard CPU hardware, with no GPU requirements. Developers can integrate it with three lines of JavaScript code.
Ternlight ships as a single npm package with the engine and weights bundled together. The company offers two variants: the base model at 7MB and a mini version at 5MB for lighter applications.
How it works
The model uses ternary weights and BitLinear transformer layers to achieve its compact size while maintaining performance. After the initial load, the model caches locally with zero network overhead.
The demo shows Ternlight powering search across React's documentation, processing queries like "share state across components" and "avoid prop drilling" in real-time. The system ranks matches without external server calls.
Developers can call the embed() function to generate embeddings or use similar() to find ranked matches from a dataset. The model handles text input up to its maximum token limit through standard transformer attention mechanisms.
Browser-first approach
Unlike cloud-based embedding services, Ternlight runs entirely client-side. This approach eliminates latency from network requests and keeps user data local to the browser.
The model targets use cases where developers need semantic search without the complexity of managing embedding APIs or the cost of per-query pricing. Applications include documentation search, content recommendation, and text similarity matching.
Ternlight releases under an MIT license and is available immediately through npm. The company has not disclosed funding details or team information in the initial release.
💬 Discussion
Sign in to join the discussion.
Sign in →No comments yet — be the first.