arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2603.05569cs.IRcs.AIcs.CL

CBR-to-SQL:重新思考基于检索的文本到SQL方法:在医疗领域使用基于案例的推理

CBR-to-SQL: Rethinking Retrieval-based Text-to-SQL using Case-based Reasoning in the Healthcare Domain

  • Department of Computer Science Aalto University(奥卢大学计算机科学系)
  • Department of Clinical Medicine Aalborg University(奥尔堡大学临床医学系)

机构由 AI 辅助整理,请以论文原文为准。

Hung Nguyen, Hans Moen, Pekka Marttinen

更新

AI总结:

本文提出CBR-to-SQL框架,通过分解检索增强生成的两阶段检索,提升医疗领域文本到SQL的准确性和效率。

AI中文摘要:

从电子健康记录(EHR)数据库中提取见解通常需要SQL专业知识,这在临床决策和研究中形成障碍。一种有前景的方法是使用大型语言模型(LLMs)通过检索增强生成(RAG)将自然语言问题转换为SQL,其中相关问题-SQL示例被检索以通过少量样本学习生成新查询。然而,将此方法适应医疗领域具有挑战性,因为有效的检索需要示例与问题的逻辑结构及其参考实体(如药物名称、程序标题)对齐。标准单步RAG难以同时优化这两个方面,通常依赖近精确匹配来有效推广。在医疗领域,这个问题尤为严重,因为问题常包含噪声和不一致的医学术语。为了解决这个问题,我们提出了CBR-to-SQL,一个受案例推理理论启发的框架,将RAG的单步检索分解为两个显式阶段:一个专注于检索结构相关示例,另一个将实体与目标数据库模式对齐。在两个临床基准上评估,CBR-to-SQL在与微调方法竞争的准确性方面表现相当。更重要的是,它在数据稀缺和检索扰动下显示出显著更高的样本效率和鲁棒性。

英文摘要:

Extracting insights from Electronic Health Record (EHR) databases often requires SQL expertise, creating a barrier for clinical decision-making and research. A promising approach is to use Large Language Models (LLMs) to translate natural language questions into SQL through Retrieval-Augmented Generation (RAG), where relevant question-SQL examples are retrieved to generate new queries via few-shot learning. However, adapting this method to the medical domain is non-trivial, as effective retrieval requires examples that align with both the logical structure of the question and its referenced entities (e.g., drug names, procedure titles). Standard single-step RAG struggles to optimize both aspects simultaneously and often relies on near-exact matches to generalize effectively. This issue is especially severe in healthcare, as questions often contain noisy and inconsistent medical jargon. To address this, we present CBR-to-SQL, a framework inspired by Case-based Reasoning theory that decomposes RAG's single-step retrieval into two explicit stages: one that focuses on retrieving structurally relevant examples, and one that aligns entities with the target database schema. Evaluated on two clinical benchmarks, CBR-to-SQL achieves competitive accuracies compared to fine-tuned methods. More importantly, it demonstrates considerably higher sample efficiency and robustness than the standard RAG approach, particularly under data scarcity and retrieval perturbations.

↑