构建可自适应的法律RAG流水线,提升法律问答准确性与可复现性。
All for law and law for all: Adaptive RAG Pipeline for Legal Research
- 通过上下文感知查询翻译,动态调整检索深度与回答风格。
- 采用开源嵌入模型,实现媲美专有方案的检索效果且成本更低。
- 定制法律提示词显著提升答案忠实度,适合法律研究场景。
检索增强生成(RAG)通过将大语言模型输出与检索知识结合,显著提升了文本生成质量,尤其在法律领域具有重要意义。本文提出一种端到端的RAG流水线,包含三项关键改进:(i) 上下文感知的查询翻译器,能分离文档引用并根据用户专业程度和问题具体性,动态调整检索深度与回应风格;(ii) 使用SBERT与GTE等开源嵌入策略,在保持低成本的同时实现显著性能提升;(iii) 构建综合评估框架,结合RAGAS、BERTScore-F1与ROUGE-Recall,系统评估不同模型与提示设计下的语义一致性与忠实度。实验表明,精心设计的开源流水线可达到与专有方案相当的检索质量,而定制化的法律提示能持续生成更准确、更符合上下文的答案。整体证明了任务感知、组件级调优对构建可复现、低成本、法律可信的RAG系统具有巨大潜力。
原文摘要 · Abstract (English)
Retrieval-Augmented Generation (RAG) has transformed how we approach text generation tasks by grounding Large Language Model (LLM) outputs in retrieved knowledge. This capability is especially critical in the legal domain. In this work, we introduce a novel end-to-end RAG pipeline that improves upon previous baselines using three targeted enhancements: (i) a context-aware query translator that disentangles document references from natural-language questions and adapts retrieval depth and response style based on expertise and specificity, (ii) open-source retrieval strategies using SBERT and GTE embeddings that achieve substantial performance gains while remaining cost-efficient, and (iii) a comprehensive evaluation and generation framework that combines RAGAS, BERTScore-F1, and ROUGE-Recall to assess semantic alignment and faithfulness across models and prompt designs. Our results show that carefully designed open-source pipelines can rival proprietary approaches in retrieval quality, while a custom legal-grounded prompt consistently produces more faithful and contextually relevant answers than baseline prompting. Taken together, these contributions demonstrate the potential of task-aware, component-level tuning to deliver legally grounded, reproducible, and cost-effective RAG systems for legal research assistance.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。