Ternlight – 7 MB embedding model that runs in browser (WASM)
摘要
文章介绍 Ternlight 是一款体积为 7 MB 的 embedding 模型,仅在浏览器端通过 WASM 执行,无需 API 调用或 GPU。提供完整 npm 安装命令:npm install @ternlight/base,并附带 example.js 代码示例。模型包含 Engine + weights(7 MB)或 mini 变体(5 MB),支持约 5 ms 的快速 embedding。演示场景为 React 文档搜索,使用 @ternlight/mini 实现浏览器内文本嵌入,无服务器依赖。页面展示加载进度、chunks 处理、每秒嵌入率及查询输入界面,明确标注 CPU-only 运行。
荐读理由
npm install @ternlight/base 就能在浏览器直接调用引擎+weights,embedding 几行代码完成,无需下载模型或服务器调用
原文
Ternlight
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 });
EXAMPLE
React docs search
Search React's docs in your browser. Type a question — powered by @ternlight/mini, the 5 MB tier.
Loading the engine…
0 / 0
CHUNKS
— emb/sec
ON YOUR CPU
0.0 s
ELAPSED
› —
ASK
这条对你有帮助吗?