JEV RAG:一种更高效的 RAG 系统解决方案?

2026-11-27 📁 翻译

原文

Jev 最近是热门话题:X 时间线上约 70% 的帖子都在讨论 Jev。TypeSafe AI 于 2026 年 9 月 15 日发布了 AI 模型 Jev。

它像分类器,输出三类判断:“Choice”、“Score"和"Noul(Yes/No 概率)",不生成文本。

Jev 不做文本生成,专门返回"类型化判断 + 校准概率”。它标称响应时间为 70 到 500ms,成本比 LLMs 低数十到数百倍。

Jev 的独特之处在于它"不生成文本"。这是一种新型模型,只以低成本和低延迟快速返回分类;在公开可用的验证中, 其准确率比前沿 LLMs 低一档 。

不过,在 “Jev 做分类,Claude 做生成” 的设计中,它仍然有价值。

这些 LLM 系统中最棘手的问题是 Hallucination。这个问题会让模型用很自信的语气说出完全错误的内容,而且即使你不断纠正,它仍会反复犯同样的错误。

但最麻烦的并不是模型会犯错,而是 模型说错话时的语气,几乎和正常对话时一样。

如果向模型询问日期这类基本信息,输出中很可能出现错误。早期版本模型在需要精确计算的问题(例如数学题)上也经常产生各种错误。

虽然当前模型在这些方面已有显著改善,但尚未完全解决。除了模型能力提升之外,当前模型还使用 RAG(Retrieval-Augmented Generation)。

正如我在许多视频中提到的,让模型在需要精确信息时获取外部数据,可以进一步降低凭空生成错误内容的概率。

另外,我提到过, 知识不应由模型记忆,而应在需要时检索 。

当有明确的外部证据可以追溯答案时,模型可以基于检索到的信息作答,而不是基于印象猜测。

这样,至少答案有机会被验证,来源也可以追溯。

不过,这种幻觉问题目前无法从根本上解决:即使检索到的内容正确,模型仍可能误解或误用,或者在整合多个搜索结果时出现逻辑错误。

这正是为什么 RAG Pipeline 中的验证层 Reranking 以及后续的 Reviewer Agent 并不是多余的设计。

下面用一个实时聊天机器人快速演示整个流程。

打开应用时,它首先检查 documents/ 文件夹:查看每个 PDF 和文本文件,并检查自上次使用以来是否有变化。

第一次运行应用时,它会逐页读取文档,将文本切成小块。块与块之间会有一些文本重叠,以免重要信息丢失。

它使用 OpenAI 为这些 chunks 创建 embeddings ,并保存在本地 Chroma 向量数据库 中。进度条会显示完成进度。

下次打开应用时,不需要重新处理所有内容:它会从本机加载已保存的索引,因此快得多。如果应用无法读取某个文件,例如扫描版或损坏的 PDF,它会在侧边栏中列出该文件,而不是崩溃。

在侧边栏中,可以上传新文件,应用会自动将它们加入索引。还可以更改搜索设置,例如搜索多少个 chunks、保留多少个高质量 chunks,以及相关性分数应有多严格。

我提了这个问题:“What is reranking?” 应用会逐步展示搜索过程。首先,它把问题转换为清晰的搜索查询。

接下来,应用从数据库中找到最接近的 15 个 chunks。一个小型 OpenAI 模型检查全部 15 个 chunks,并给每个 chunk 一个 0 到 4 的相关性分数 。

应用会移除低分 chunks,再把最好的 chunks 发给主回答模型。

答案会逐字出现在屏幕上。AI 必须只使用文档中找到的信息作答,并添加诸如 [1] 和 [2] 的引用。

答案下方有一个 Sources 区域,显示每个来源的文件名和页码,以及相关性分数、confidence 和相似度。

应用会高亮最终答案中使用的来源,对已找到但未使用的来源用较弱强调显示。

在 RAG 中把 Jev 放在哪里

Jev 的放置位置有两种可能:向量搜索之前和之后。模式 1 用 Jev 过滤搜索结果;模式 2 在搜索之前让 Jev 选择“使用哪些 tags 来缩小该问题的结果范围”。

模式 1:搜索后使用 Jev

模式 1 对应搜索之后的位置:在用 WHERE 子句和向量搜索检索候选之后,Jev 读取 chunk 的文本,以判断目标受众是否匹配。它的优势在于能做出必须阅读文本才能完成的判断,例如区分主题相似但目标受众不同的情况。

模式 2:在搜索前用 Jev 选择 tags

我还没有完成这方面的概念验证(PoC),但它看起来很有前景,所以会介绍一下。这个模式假设 Cosmos DB 中的每条记录都带有 tags(文档类型、领域、出版年份、语言等)。用户的问题会传给 Jev,由 Jev 选择合适的 tags,然后使用这些 tags 创建 WHERE 子句,再执行向量搜索。

如果条件已知,可以事先用 WHERE 子句缩小范围来节省 RUs。模式 2 则是由 Jev 从查询文本中选择条件,而不是由人提供条件。

选择 tag 有两种方式。

我无法确认一次最多可以提交多少个问题。不过,总请求限制约为 64,000 tokens,因此 tag 选项写得越长,输入就越大。

需要留意选错 tag 的影响:一旦选错,正确的 chunk 可能根本不会出现在搜索结果中。当 Choice 的 confidence 较低,或 Noul 接近 0.5 时,最好准备回退方案:不缩小搜索范围,而是在整个数据集中搜索。

我们验证了什么?

验证 1:Reranking

Cohere Rerank 3.5 / Amazon Rerank 1.0:将问题和 20 个 chunks 传给 Bedrock 的 reranking 函数并排序。

Claude Haiku 4.5:我给它 20 个 chunks,编号,并要求它“按相关性从高到低用编号排序”。

Jev:为 20 个 chunks 分别创建一个分级评分问题,询问“这个问题有多相关?”,然后将全部 20 个问题放在一个请求中发送。

{
  "model": "jev-1.13.0",
  "state": {
    "query": "What is the deadline for transportation expense reimbursement?",
    "items": [
      {
        "id": "item_0",
        "title": "Travel and Transportation Expense Regulations",
        "text": "Transportation expense reimbursement requests must be submitted by the 25th of each month."
      },
      {
        "id": "item_1",
        "title": "Travel and Transportation Expense Regulations",
        "text": "To request transportation expense reimbursement, enter the date of use, travel route, business destination, and purpose into the expense reimbursement system..."
      }
      // … up to item_19
    ]
  },
  "questions": {
    "rel_0": {
      "type": "score",
      "instructions": "How relevant is the text of item_0 to the query?",
      "criteria": [
        "0 - Irrelevant. It has nothing to do with the query.",
        "1 - Loosely related because it is in the same general area.",
        "2 - It concerns the same subject, but addresses a different matter from what the query is asking.",
        "3 - It concerns the same subject and the same matter as the query. It does not matter whether the answer itself is explicitly written."
      ]
    }
    // … up to rel_19, one question for each chunk
  }
}

分级评估的 criteria 从 0 分开始逐级向上排列。3 分档的描述中包含“答案是否写出无关紧要”这句话,以免相关性判断受答案是否存在影响。结果按返回的 score 值降序排序。

结果

首先,Haiku 基本可以排除:它几乎要花一秒,而且最贵。仅仅为了排序调用一个 LLM,随后又把它排除掉,似乎并不值得。

至于两个 reranker 和 Jev,它们在准确率或速度上没有太大差别。差别在价格:Jev 是 1/8。你可能会觉得 Jev 很棒!

但这个准确率不太可靠。不做 reranking 时,Recall@5 为 1.000,意味着执行向量搜索时答案已经在 top 5 中。看起来根本不需要 reranker。

验证 2:你能判断答案是否为“I cannot answer”吗?

即使拿到了 chunks,如果答案不在其中,也没有意义。如果能判断一个看似接近的问题其实“无法回答”,就可以在不调用 LLM 的情况下回复“无法找到该信息”,从而节省成本。

🔧 如何判断

Rerank 分数阈值:如果 reranker 返回的最高分数低于阈值,则不允许回答。这是 RAG 中长期以来使用的方法。

阈值用开放测试之前的 40 个问题确定:Cohere 为 0.672,Amazon 为 0.0006。由于每种方法的分数尺度不同,需要分别确定。

Claude Haiku 4.5:给它一个问题以及 top 5 chunks,让模型对“你能仅凭这些信息回答吗?”回答 Yes 或 No。

Jev:连同 top 5 chunks 一起询问 Yes/No 问题。

给出的五个结果,都是三种方法使用 Cohere Rerank 3.5 排序后的 top 5 结果。

{
  "model": "jev-1.13.0",
  "state": {
    "query": "By when do I need to apply for the social insurance premium exemption while on childcare leave?",
    "items": [
      {
        "id": "item_0",
        "title": "Childcare and Family Care Leave Regulations",
        "text": "Social insurance premiums during childcare leave are exempted upon request by the employee. The Human Resources Department handles the procedure."
      }
      // … up to item_4
    ]
  },
  "questions": {
    "can_answer": {
      "type": "noul",
      "instructions": "Do the texts in the items contain evidence that can answer the query?",
      "criteria": {
        "true": "At least one of the items directly states the value, condition, method, or contact point requested by the question, so the question can be answered using only the items.",
        "false": "The items discuss the same topic as the question, but do not state the specific information being asked for. Or they only point to another source (for example, 'as separately specified' or 'check with the responsible department'). Or they concern a different subject or matter. Answering the question would require information that is not provided."
      }
    }
  }
}

结果

验证 3:我们能同时做 Reranking 和答案判定吗?

到这里,我的想法更大了一些:既然 Jev 可以并行处理问题,也许能在同一个请求中同时完成 reranking 和答案判定?于是,我为每个 chunk 同时发送两个问题。

{
  "model": "jev-1.13.0",
  "state": {
    "query": "By when do I need to apply for the social insurance premium exemption while on childcare leave?",
    "items": [
      {
        "id": "item_0",
        "title": "Childcare and Family Care Leave Regulations",
        "text": "Social insurance premiums during childcare leave are exempted upon request by the employee. The Human Resources Department handles the procedure."
      }
      // … up to item_19
    ]
  },
  "questions": {
    "rel_0": {
      "type": "score",
      "instructions": "How relevant is the text of item_0 to the query?",
      "criteria": [
        "0 - Irrelevant. It has nothing to do with the query.",
        "1 - Loosely related because it is in the same general area.",
        "2 - It concerns the same subject, but addresses a different matter.",
        "3 - It concerns the same subject and the same matter as the query."
      ]
    },
    "ans_0": {
      "type": "noul",
      "instructions": "Does the text of item_0 contain evidence that can answer the query?",
      "criteria": {
        "true": "The item's text directly states the rule, condition, value, procedure, or person responsible that answers the question.",
        "false": "The item's text discusses the same topic but does not state the rule, condition, value, procedure, or person responsible that the question asks for. Or it concerns a different topic."
      }
    }
    // … up to item_19, with 2 questions per chunk (40 questions total)
  }
}

这样可以按相关性排序,并用 noul 过滤结果:如果相关性最高的 chunk 达不到 0.755,就判定为不可回答。这里只增加了 Yes/No 问题,请求数量仍然是一个。

我们比较了三种不同配置。

配置 ③ 的答案判定与配置 ② 相同,而重排效果优于配置 ① 和 ②。速度是配置 ② 的 60%,价格是 1/6。reranker 调用完全消失,这一点是很大的优势。

我的印象

看起来可以用 Jev 提升 RAG 的速度并降低成本。不过,任何明显的速度提升很可能仅限于项目范围之外的问题。(如果涉及 LLM,你仍然得等。)

用 Jev 做 reranking 会移除不必要的 chunks,留下纯度较高的 chunks,让答案更容易命中。借助这些 chunks,以前需要用 Sonnet 的场景,现在用 Haiku 可能就够。

作为高级应用,还可以根据答案判定的 confidence 水平区分 Sonnet 和 Haiku,以选择最优模型。

© 2026 Hot Ingest