Hacker News 中文摘要

RSS订阅

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

文章摘要

Ternlight是一个仅7MB的嵌入模型,可在CPU上运行,无需API调用。它作为单个npm包提供,能在浏览器中实现毫秒级文本嵌入和语义搜索,例如搜索React文档。

文章总结

标题:Ternlight · 语义搜索 · React文档

来源:https://ternlight-demo.vercel.app/

发布时间:2026年7月7日 00:50:31 GMT

警告:此页面可能尚未完全加载,建议明确指定超时时间。 警告:这是原始页面的缓存快照,如需最新内容请尝试禁用缓存。


一个仅7MB的嵌入模型。

在CPU上运行,无需调用API。

直接嵌入,毫秒级完成文本处理,无需连接服务器。

在浏览器中运行

无需API调用

引擎+权重:7MB

迷你版:5MB

快速嵌入:约5毫秒

仅需CPU,无需GPU

立即使用

三行代码实现语义搜索

以单个npm包形式提供,无需模型下载步骤,无需服务器。

$ npm install @ternlight/base

example.js

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

similar('简易的平日晚餐创意', recipes, { topK: 3 }); // → 返回排名结果 · 约5毫秒 · 零网络请求 ```

示例

React文档搜索

在浏览器中搜索React文档。输入问题——由5MB级别的@ternlight/mini驱动。

评论总结

根据评论内容,总结如下:

主要观点与论据:

  1. 项目价值与创新性(支持观点,评分高):

    • 作者soycaporal介绍了一个基于MiniLM的轻量级句子编码器,可在浏览器中运行,用于语义搜索、FAQ匹配和聚类。模型输出384维向量,余弦相似度可达0.88(如“reset my password”与“I forgot my password”)。
    • 评论者gaigalas称赞:“That's really impressive, congratulations. It's nice to see novel applications of browser models.”(“这令人印象深刻,祝贺。很高兴看到浏览器模型的新颖应用。”)
    • 评论者dmezzetti表示:“Interesting project. Happy to see someone who shares an interest in tiny vector embeddings models.”(“有趣的项目。很高兴看到有人对微型向量嵌入模型感兴趣。”)
  2. 性能与实用性(中性观点,评分中等):

    • 作者提供两个npm包:@ternlight/base(7 MB,约5 ms/嵌入)和@ternlight/mini(5 MB,约2.5 ms/嵌入),支持Node和浏览器。
    • 评论者aetherspawn询问:“Can the 30 second embedding time be done beforehand and sent to the browser? Inference is nice and quick after that.”(“能否提前完成30秒的嵌入时间并发送到浏览器?之后的推理很快。”)
    • 评论者wazzup_im分享类似项目:“I added an offline search engine... First search downloads the model from the internet and subsequent runs are from the cache.”(“我添加了一个离线搜索引擎...首次搜索从网络下载模型,后续运行来自缓存。”)
  3. 隐私与安全担忧(反对观点,评分低):

    • 评论者CobrastanJorji批评:“Great, now my websites are gonna push entire LLMs onto my browser in order to use my CPU to make inferences about my shopping habits or whatever.”(“太好了,现在我的网站会把整个LLM推送到浏览器,用我的CPU推断我的购物习惯等。”)
    • 评论者rvz质疑:“Why do these things download into the browser automatically? This could be used to distribute malware and also or hog excessive browser memory.”(“为什么这些东西会自动下载到浏览器?这可能被用来分发恶意软件或占用过多浏览器内存。”)
  4. 功能改进建议(中性观点,评分中等):

    • 评论者dirteater_建议:“maybe you could put a button on the landing page to trigger the demo because it's a bit startling to hear my fans go crazy when opening a webpage.”(“也许你可以在首页放一个按钮来触发演示,因为打开网页时听到风扇狂转有点吓人。”)
    • 评论者newspaper1希望:“I'd love to point it at my own corpus to index/embed. Would be cool if you could give it a link to a markdown file or even a website to crawl.”(“我希望指向自己的语料库进行索引/嵌入。如果能提供链接到markdown文件或网站进行爬取会很酷。”)

平衡性总结: - 支持者强调创新性、隐私保护和离线性能,认为这是浏览器端AI的有益尝试。 - 反对者担忧自动下载带来的安全风险、资源消耗和潜在滥用。 - 中立者关注性能优化、用户体验改进和功能扩展。