跳转至

RAG 亟需建立索引:为什么写入时编译优于查询时解释

文章背景与核心概要

当前的检索增强生成(RAG)系统存在一个底层架构缺陷:即所谓的“查询时解释”。在处理每一个用户查询时,大语言模型都在重复推导原始文本语料库的语义,并在查询结束后丢弃这些宝贵的计算成果。尽管单 token 的推理成本有所下降,但由于数据增长速度远超价格下降速度,总推理开销仍在飙升。本文作者指出,这种低效性正是现代 AI 领域的“全表扫描”。

为了解决这一痛点,作者提出了“写入时语义编译”(Ingest-Time Semantic Compilation, ISC)方案。该方法将繁重的计算工作前置到数据写入阶段(类似于数据库建立索引),利用由增量更新嵌入和可追溯原子断言(atomic claims)所构成的维护基础层。实验证明,ISC 不仅将数据维护成本大幅降低了 33.7 倍,在检索准确率和负载优化上也实现了对传统分块 RAG 方案的全面超越。


📌 执行摘要 (Executive Summary)

Modern Retrieval-Augmented Generation (RAG) systems suffer from an architectural flaw: query-time interpretation. On every query, language models re-derive the meaning of raw text corpus and throw the computational work away.

Modern Retrieval-Augmented Generation (RAG) systems suffer from an architectural flaw: query-time interpretation. On every query, language models re-derive the meaning of raw text corpus and throw the computational work away.

现代检索增强生成(RAG)系统存在一个架构缺陷:查询时解释。在处理每一个查询时,大语言模型都会重新推导原始文本语料库的含义,并将这些计算成果白白丢弃。

Although per-token inference prices have dropped, total inference spending continues to surge because data volume grows faster than prices fall. The authors argue that this inefficiency is the modern equivalent of the full-table scan.

Although per-token inference prices have dropped, total inference spending continues to surge because data volume grows faster than prices fall. The authors argue that this inefficiency is the modern equivalent of the full-table scan.

尽管单 token 的推理价格有所下降,但由于数据量的增长速度超过了价格下降的速度,总推理开销仍在持续激增。作者认为,这种低效性正是现代计算中“全表扫描”的翻版。

The proposed remedy is Ingest-Time Semantic Compilation (ISC)—moving heavy computational work to write time (similar to database indexing), utilizing a maintained substrate of incrementally updated embeddings and provenanced atomic claims.

The proposed remedy is Ingest-Time Semantic Compilation (ISC)—moving heavy computational work to write time (similar to database indexing), utilizing a maintained substrate of incrementally updated embeddings and provenanced atomic claims.

为此提出的解决方案是写入时语义编译(ISC)——将沉重的计算工作转移到写入阶段(类似于数据库索引),利用一个由增量更新的嵌入向量以及带有来源证明的原子断言所构成的维护基底。


🔍 核心发现与摘要亮点 (Key Findings & Abstract Highlights)

  • The Problem: RAG systems act as hidden interpreters during user queries, performing redundant linguistic labor repeatedly. Context volume growth outpaces token price deflation.
  • The Solution (ISC): Treat the corpus substrate as a first-class database object equipped with its own:
  • Data Definition Language (DDL)
  • Maintenance and migration contracts
  • Cost models
  • Efficiency (Existence Proof 1): Substrate upkeep scales proportionally with corpus changes rather than total corpus size. Incremental updates run 33.7x cheaper than full reconstruction while maintaining floating-point precision.
  • Accuracy & Payload Optimization (Existence Proof 2): Tested on 500 broadcast-interview transcripts, compiled claims as the retrieval payload dominated across all model configurations:
  • Compiled Claims: 85.2% accuracy using ~2.2k reader tokens.
  • Best Chunk Configuration: 72.5% accuracy using ~16.3k tokens.
  • Parity Baseline: Only contextualized-chunk pipelines with hybrid retrieval and reranking kept pace with compiled claims. However, they required 21x more query-path tokens to achieve statistical parity—effectively because they were beginning to mimic compilation themselves.
  • The Problem: RAG systems act as hidden interpreters during user queries, performing redundant linguistic labor repeatedly. Context volume growth outpaces token price deflation.
  • The Solution (ISC): Treat the corpus substrate as a first-class database object equipped with its own:
  • Data Definition Language (DDL)
  • Maintenance and migration contracts
  • Cost models
  • Efficiency (Existence Proof 1): Substrate upkeep scales proportionally with corpus changes rather than total corpus size. Incremental updates run 33.7x cheaper than full reconstruction while maintaining floating-point precision.
  • Accuracy & Payload Optimization (Existence Proof 2): Tested on 500 broadcast-interview transcripts, compiled claims as the retrieval payload dominated across all model configurations:
  • Compiled Claims: 85.2% accuracy using ~2.2k reader tokens.
  • Best Chunk Configuration: 72.5% accuracy using ~16.3k tokens.
  • Parity Baseline: Only contextualized-chunk pipelines with hybrid retrieval and reranking kept pace with compiled claims. However, they required 21x more query-path tokens to achieve statistical parity—effectively because they were beginning to mimic compilation themselves.
  • 问题所在: RAG 系统在用户查询期间充当了隐藏的解释器,重复执行冗余的语言学工作。上下文体量的增长速度超过了 token 价格的下降速度。
  • 解决方案(ISC): 将语料库基础层视为一类一等(first-class)数据库对象,为其配备专属的:
  • 数据定义语言(DDL)
  • 维护与迁移契约
  • 成本模型
  • 效率(存在性证明 1): 基础层的维护成本与语料库的变更量成正比,而非与语料库的总大小成正比。增量更新的成本比完整重建低 33.7 倍,同时保持了浮点精度。
  • 准确率与负载优化(存在性证明 2): 在 500 个广播采访文稿上进行测试,作为检索负载的编译断言在所有模型配置中均占优势:
  • 编译断言: 准确率为 85.2%,消耗约 2.2k 个读取器 token。
  • 最佳分块配置: 准确率为 72.5%,消耗约 16.3k 个 token。
  • 平价基准线: 只有结合了混合检索与重排(reranking)的上下文分块管道才能在效果上与编译断言并驾齐驱。然而,它们需要消耗 21 倍的查询路径 token 才能达到统计意义上的平价——本质上是因为它们开始模仿编译的过程。

📄 论文元数据与获取途径 (Paper Metadata & Access)