arXiv:2506.12149cs.CL2025-06

用模型自身梯度优化检索,让大模型更精准地选对数据答题。

Maximally-Informative Retrieval for State Space Model Generation

  • 基于大模型梯度动态学习最优文档组合,替代传统启发式检索。
  • 无需微调,仅通过降低问题困惑度,检索效果媲美BM25。
  • 适合追求高精度且不想调参的模型部署场景。

给定查询和数据集,最优回答方式是利用所有可用信息。现代大模型虽能记忆训练数据,但训练中未被重视的数据会被遗忘,外部数据也无法使用。由于模型资源有限(如Transformer上下文长度或状态空间模型状态数),推理时无法处理全部数据,必须依赖外部记忆。因此面临核心问题:如何根据当前查询和模型,判断海量已知数据中哪些对推理重要?为最小化测试时模型不确定性,我们提出检索上下文优化(RICO),一种利用大模型自身梯度学习最优文档混合的检索方法。不同于依赖外部启发式的传统检索增强生成(RAG),本方法直接获取模型反馈。理论上,我们证明标准top-k检索结合模型梯度可近似该优化过程,并建立与留一法损失的联系。实证表明,通过最小化以问题困惑度形式的无监督目标函数,无需微调即可达到与BM25相当的检索性能;在最终预测质量上,常优于微调过的密集检索器如E5。

原文摘要 · Abstract (English)

Given a query and dataset, the optimal way of answering the query is to make use all the information available. Modern LLMs exhibit impressive ability to memorize training data, but data not deemed important during training is forgotten, and information outside that training set cannot be made use of. Processing an entire dataset at inference time is infeasible due to the bounded nature of model resources (e.g. context size in transformers or states in state space models), meaning we must resort to external memory. This constraint naturally leads to the following problem: How can we decide based on the present query and model, what among a virtually unbounded set of known data matters for inference? To minimize model uncertainty for a particular query at test-time, we introduce Retrieval In-Context Optimization (RICO), a retrieval method that uses gradients from the LLM itself to learn the optimal mixture of documents for answer generation. Unlike traditional retrieval-augmented generation (RAG), which relies on external heuristics for document retrieval, our approach leverages direct feedback from the model. Theoretically, we show that standard top-$k$ retrieval with model gradients can approximate our optimization procedure, and provide connections to the leave-one-out loss. We demonstrate empirically that by minimizing an unsupervised loss objective in the form of question perplexity, we can achieve comparable retriever metric performance to BM25 with \emph{no finetuning}. Furthermore, when evaluated on quality of the final prediction, our method often outperforms fine-tuned dense retrievers such as E5.

检索增强大模型无监督

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。