Ternlight – 可在浏览器(WASM)中运行的 7 MB 嵌入模型
Ternlight – 7 MB embedding model that runs in browser (WASM)

原始链接: https://ternlight-demo.vercel.app/

一个 7 MB 大小的嵌入模型。在 CPU 上运行。无需 API。直接集成,毫秒级文本嵌入,无需调用服务器。 在浏览器中运行,无 API 调用。 引擎 + 权重 · 7 MB 迷你版 · 5 MB 快速嵌入 · 约 5 毫秒 仅限 CPU · 无需 GPU 使用它 三行代码实现语义搜索。 作为单个 npm 包提供。无需下载模型,无需服务器。 $ npm install @ternlight/base example.js import { embed, similar } from '@ternlight/base'; similar('easy weeknight dinner ideas', recipes, { topK: 3 }); // → 排序后的匹配结果 · 约 5 毫秒 · 零网络延迟 示例 React 文档搜索 在浏览器中搜索 React 文档。输入问题 — 由 5 MB 大小的 @ternlight/mini 驱动。

**Ternlight** 是一个轻量级、高性能的嵌入(embedding)模型,旨在通过 Rust 编译的 WASM 直接在浏览器中运行。该项目利用三元量化感知训练,提供了两个精简版本:8MB 的基础模型和 5MB 的迷你模型。 与大型语言模型不同,Ternlight 为文本生成 384 维向量,从而实现语义搜索、意图匹配和聚类分析。这使得开发者能够在无需依赖外部 API 或服务器端开销的情况下,在本地实现“输入即搜索”的功能。对于较大型的数据集,开发者可以在服务器端预先计算嵌入并将其传送到客户端,以优化性能。 该项目已发布在 npm 上,支持 Node 和浏览器环境。完整的技术流程和源代码已在 GitHub 上开源,并采用 MIT 许可证。
相关文章

原文

An embedding model in 7 MB.

Runs on your CPU. No API.

Drop it in, embed text in milliseconds, and never call a server.

Runs in your browser

no API call

Engine + weights · 7 MB

mini variant · 5 MB

Fast embeddings · ~5 ms

CPU only · no GPU

USE IT

Three lines to semantic search

Ships as a single npm package. No model download step, no server.

$ npm install @ternlight/base

example.js

import { embed, similar } from '@ternlight/base';

similar('easy weeknight dinner ideas', recipes, { topK: 3 });
// → ranked matches · ~5 ms · zero network

EXAMPLE

React docs search

Search React's docs in your browser. Type a question — powered by @ternlight/mini, the 5 MB tier.

联系我们 contact @ memedata.com