AWS Machine Learning Blog 发布于 08/22 00:59

Reduce RAG costs on Amazon Bedrock with query-aware compression

(翻译)通过查询感知压缩降低 Amazon Bedrock 上的 RAG 成本

查看原文

资讯摘要

Input tokens are often a meaningful part of the cost of running Retrieval Augmented Generation (RAG) at scale. This post describes a query-aware context compression pattern on Amazon Bedrock: after retrieval, a smaller model filters retrieved chunks against the query before the primary model answers

AI 摘要

本文介绍了在 Amazon Bedrock 上通过查询感知压缩降低 RAG 成本的方法。该模式在检索后、最终回答前,使用较小的模型(如 Claude Haiku)根据用户查询过滤检索到的文本块,再让主模型(如 Claude Sonnet)基于压缩后的证据生成答案,从而减少输入令牌数,降低成本并降低幻觉风险。

AI 问答

查询感知压缩如何降低 RAG 成本?

在检索后使用较小模型过滤与查询相关的文本块,只将相关片段发送给主模型,从而减少主模型处理的输入令牌数,降低推理成本。

实现该模式需要哪些前提条件?

需要有效的 AWS 账户、为 Lambda 函数创建 IAM 角色并添加权限,以及在 Bedrock 中启用所需的模型访问权限(如 Claude Haiku 和 Claude Sonnet)。

打开原文