让大模型找答案时优先选对规则,而非最像的文本。
Beyond Similarity: Task-Aligned Retrieval for Language Models

- 将文档转为可追踪的条件-动作规则,用大模型判断哪些规则适用
- 在多个任务中比传统检索提升12.2%,且减少93%的检索内容
- 适合需要严格遵循规则或指令的任务,如代码合规、事实修正
检索增强生成(RAG)通常依据语义相似度排序段落,隐含假设语义相似即任务相关。但在依赖规则、约束或步骤指导的任务中,真正有用的上下文可能是触发输入的规则,而非语义最接近的文本。本文提出任务对齐检索(TAG),将源文档转化为可追溯的条件-动作规则,通过成对大模型判断识别适用于当前输入的规则,并仅基于选定的动作生成输出。实验显示,在维基百科中立性重写、HumanEval PEP8合规性检查及RuleArena篮球交易推理任务中,TAG均优于标准RAG,尤其在高不匹配场景下提升达12.2%,同时检索内容减少高达93%。结果表明,在规则与指令驱动的任务中,检索应优化适用性而非单纯语义相似度。
原文摘要 · Abstract (English)
Retrieval-augmented generation (RAG) ranks passages by semantic similarity to the input, implicitly assuming that semantic similarity is a reliable indication of applicability in downstream tasks. This assumption breaks down when task success depends not on topical relevance but on applying the correct rules, constraints, or procedural guidance. In such settings, the most useful context may be the rule triggered by the input rather than the most semantically similar passage. We propose Task-Aligned Retrieval (TAG), a retrieval framework that replaces similarity-based retrieval with applicability-based rule selection. TAG transforms source documents into traceable condition-action rules, identifies which rules apply to a given input through pairwise LLM judgments, and generates the output conditioned only on the selected actions. We empirically observe that across Wikipedia NPOV rewriting, HumanEval with PEP~8 compliance, and NBA transaction reasoning on RuleArena, TAG consistently outperforms standard RAG, with the largest gains in high-mismatch settings (up to 12.2\%) while reducing retrieved context by up to 93\%. These results suggest that, in rule- and instruction-governed tasks, retrieval should optimize for applicability rather than for semantic similarity alone.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。