Nace发布Drex提取模型,为Agent提供可验证事实来源
Extraction Models as Verifiers for Agents
Agent开发者的实用指南,详细展示了如何用提取模型做事实验证,附完整API代码与工作流设计,直接提升Agent可靠性。
Over the past couple of months, I've been closely tracking a new class of small extraction models. Unlike decision models, every answer they return points back to its source.
在过去的几个月里,我一直在密切关注一类新型的小型提取模型。与决策模型不同,它们返回的每个答案都会指向其来源。
This is useful for any agent that has to prove where an answer came from.
这对于任何需要证明答案来源的智能体来说都非常有用。
It turns out extraction models serve as great verifiers for agents. This is extremely important for improving agent reliability.
事实证明,提取模型是智能体的绝佳验证器。这对于提高智能体的可靠性至关重要。
An extraction model checks each claim against the source before the agent's answer goes out.
在智能体的答案发出之前,提取模型会针对来源检查每一项声明。
Nace just added this capability to Drex Max with Drex for Extraction.
Nace 刚刚通过 Drex for Extraction 将这一功能添加到了 Drex Max 中。
You describe a field in plain words. Drex returns the exact text span with its character positions, or a box on the page image. Each answer comes with a confidence score.
你用通俗的语言描述一个字段。Drex 返回带有字符位置的精确文本片段,或者页面上的方框。每个答案都附带一个置信度分数。
Every text answer is an exact substring of the input, so you can check it.
每个文本答案都是输入的一个确切子串,因此你可以进行检查。
The no-match result is something interesting to build around. On blank form fields, Drex Box returned "not on page" 98% of the time, against 18.8% for VGSE-32B.
无匹配结果是一个值得围绕其构建的有趣特性。对于空白表单字段,Drex Box 有 98% 的时间返回“不在页面上”,而 VGSE-32B 仅为 18.8%。
On ExtractBench, a set of PDF form fields, Nace reports 84.1 for Drex Box, against 65.7 for Liquid d1.2-ultra and 64.1 for VGSE-32B.
在 ExtractBench(一组 PDF 表单字段)上,Nace 报告 Drex Box 得分为 84.1,而 Liquid d1.2-ultra 为 65.7,VGSE-32B 为 64.1。
A blank field should stay blank. If an agent invents a due date on an invoice, that wrong date flows into every step after it. In other words, the errors compound fast in your system.
空白字段应保持空白。如果智能体在发票上编造了一个到期日期,这个错误的日期就会流入之后的每一个步骤。换句话说,错误会在你的系统中迅速累积。
On text, Nace reports an 81.5 average across six held-out datasets, against 73.9 for Perplexity Decider 1.3. The widest gap is on SQuAD 2.0, a set built around unanswerable questions, at 84.2 vs 70.0.
在文本方面,Nace 报告在六个保留数据集上的平均分为 81.5,而 Perplexity Decider 1.3 为 73.9。最大的差距出现在 SQuAD 2.0 上,这是一组围绕不可回答问题构建的数据集,得分为 84.2 vs 70.0。
The bigger idea for me is pairing this with the Drex Max decision models.
对我来说更大的想法是将此与 Drex Max 决策模型配对使用。
Extraction finds where a fact is. A decision model picks what to do with it. Both return calibrated scores in a single forward pass, and Nace runs them on the same API key.
提取模型用于定位事实所在的位置。决策模型用于决定如何处理它。两者都在单次前向传播中返回校准后的分数,并且 Nace 使用相同的 API 密钥运行它们。
Decision models perfectly complement extraction models. Combining both opens up opportunities to improve the reliability of the agentic system.
决策模型完美地补充了提取模型。结合两者为提升智能体系统的可靠性打开了机会之门。
Let’s cover a concrete example: Take an invoice. Drex Box locates the total, the due date, and the PO number. A Drex Max decision model then chooses to approve, flag, or send it to a person, with a probability for each option.
让我们来看一个具体的例子:以一张发票为例。Drex Box 定位总金额、到期日期和采购订单号。然后,一个 Drex Max 决策模型选择批准、标记或将其发送给某人,并为每个选项提供概率。
A low score or a no-match at either step goes to a human. The LLM only sees fields that were found and checked.
任一阶段的低分或无匹配结果都将转交给人工处理。LLM 仅查看已找到并经过检查的字段。
To get started, open the Experimental tab in Nace Console. Paste text or upload a page image, describe the fields you need, and you get spans or boxes back.
要开始使用,请打开 Nace Console 中的 Experimental 标签页。粘贴文本或上传页面图像,描述你需要的字段,然后你会得到对应的文本片段或方框。
For the API, Extract is the documented route today. You give it a document and a JSON schema of the fields you want. It fills each field and cites where in the document it came from.
对于 API,Extract 是目前文档中记录的接口。你提供一个文档和你想要提取字段的 JSON 模式。它会填充每个字段,并引用该字段在文档中的来源位置。
curl "https://console.nace.ai/v1/documents/extract?wait_seconds=60" \
-H "Authorization: Bearer $NACE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": {
"type": "url",
"url": "https://example.com/services-agreement.txt",
"file_name": "services-agreement.txt"
},
"schema": {
"type": "object",
"properties": {
"payer": { "type": "string" },
"fee": { "type": "string" },
"termination_notice": { "type": "string" }
},
"required": ["payer", "fee"]
}
}'The docs and links are below.
相关文档和链接如下。
- Nace Console Experimental tab
- Console docs
- Extract endpoint docs
- Drex for Extraction
- Nace Console 实验性标签页
- Console 文档
- Extract 端点文档
- 用于提取的 Drex
A RAG agent retrieves again whenever a claim has no matching span in the retrieved text.
每当检索到的文本中没有匹配的跨度时,RAG 代理会再次进行检索。
Here are some ways I would use extraction models like Drex as a verifier in agent pipelines:
以下是我将像 Drex 这样的提取模型作为验证器在代理管道中使用的一些方式:
- A contract agent writes a summary. Before the summary goes out, Drex Locate checks each claim against the contract. Any claim without a matching span gets flagged.
- A research agent quotes a paper. Locate confirms the quoted text exists in that paper, so made-up citations get caught early.
- An invoice agent fills a payment form. Drex Box confirms each value sits on the page. A field that is not on the page stays empty.
- A RAG answer gets checked one span at a time. A low-confidence span sends the agent back to retrieve more context before it answers.
- 一个合同代理编写摘要。在摘要发出之前,Drex Locate 会将每个声明与合同进行核对。任何没有匹配跨度的声明都会被标记。
- 一个研究代理引用论文。Locate 确认引用的文本确实存在于该论文中,从而尽早发现捏造的引用。
- 一个发票代理填写付款表单。Drex Box 确认每个值都位于页面上。如果某个值不在页面上,则该字段保持为空。
- 对 RAG 答案逐个跨度进行检查。低置信度的跨度会让代理在回答之前返回去检索更多上下文。
Inside the harness, only the fields the agent asked for reach its context, each with its source.
在 harness 内部,只有代理请求的字段才会进入其上下文,每个字段都附带其来源。
Inside the harness itself, I would make extraction a built-in step of the agent loop.
在 harness 本身内部,我会将提取作为代理循环的一个内置步骤。
- When a tool returns a long document, the extraction model pulls only the spans the agent asked for into context. The context window stays small, and every fact keeps a pointer to its source.
- Before the agent writes to memory, each fact needs a matching source span. Facts without one never get stored.
- Before the final answer, a verify hook runs the same check on every claim. Claims it cannot locate go back to the agent with a no-match result.
- 当工具返回长文档时,提取模型仅将代理请求的跨度拉入上下文。上下文窗口保持较小,且每个事实都保留指向其来源的指针。
- 在代理写入内存之前,每个事实都需要有匹配的源跨度。没有匹配源的事实永远不会被存储。
- 在最终答案生成之前,一个验证钩子会对每个声明运行相同的检查。无法定位的声明会带着无匹配结果返回给代理。
This is how I think document agents will be built in the future. Incorporating more reliable steps across the pipeline with decision models, extraction models, and more deterministic steps.
这就是我思考未来文档代理构建方式的方式:通过决策模型、提取模型以及更多确定性步骤,在整个管道中整合更可靠的环节。
Thanks to @NaceAI for sponsoring this post.
感谢 @NaceAI 赞助此帖。
Please reach out to [email protected] if you would like to sponsor an upcoming post.
如果您希望赞助即将发布的帖子,请联系 [email protected]。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力