Skip to main content
QUICK REVIEW

[论文解读] RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers

Bailin Wang, Richard Shin|arXiv (Cornell University)|Nov 10, 2019
Natural Language Processing Techniques被引用 72
一句话总结

RAT-SQL 引入面向关系的自注意力,用于在文本到 SQL 解析中联合编码与链接数据库模式与问题,在 Spider 上达到最先进的结果(57.2% 精确匹配),并且在 BERT 情况下达到 65.6%。

ABSTRACT

When translating natural language questions into SQL queries to answer questions from a database, contemporary semantic parsing models struggle to generalize to unseen database schemas. The generalization challenge lies in (a) encoding the database relations in an accessible way for the semantic parser, and (b) modeling alignment between database columns and their mentions in a given query. We present a unified framework, based on the relation-aware self-attention mechanism, to address schema encoding, schema linking, and feature representation within a text-to-SQL encoder. On the challenging Spider dataset this framework boosts the exact match accuracy to 57.2%, surpassing its best counterparts by 8.7% absolute improvement. Further augmented with BERT, it achieves the new state-of-the-art performance of 65.6% on the Spider leaderboard. In addition, we observe qualitative improvements in the model's understanding of schema linking and alignment. Our implementation will be open-sourced at https://github.com/Microsoft/rat-sql.

研究动机与目标

  • 对尚未看到的数据库模式在文本到 SQL 解析中实现鲁棒的一般化。
  • 开发一个统一的编码框架,将模式关系与问题上下文集成。
  • 通过对预定义的模式关系和问题-模式交互的建模,实现有效的模式链接。
  • 在 Spider 数据集上展示改进并进行消融分析以识别关键因素。

提出的方法

  • 提出关系感知自注意力,在一个输入图中联合编码模式、表和问题词。
  • 将数据库模式表示为具有标签边的有向图,捕捉外键以及表/列关系。
  • 用预定义的关系特征 r_{ij}^K 和 r_{ij}^V 来增强 Transformer 的注意力,使其偏向模式关系。
  • 引入基于名称的和基于值的模式链接,以将问题标记与模式列/表对齐。
  • 计算 memory-alignment 矩阵 L_col 和 L_tab,以明确捕捉问题到模式的对齐关系以指导解码。
  • 使用树结构解码器通过展开语法规则并基于上下文选择列/表来生成 SQL。

实验结果

研究问题

  • RQ1关系感知注意力如何提高对未见数据库的关系模式信息的编码?
  • RQ2显式模式链接(基于名称和基于值)是否能改善问题与模式元素之间的对齐?
  • RQ3将预定义的模式关系与软、学习得到的关系相结合对解析准确性的影响如何?
  • RQ4RAT-SQL 在 Spider 和 WikiSQL 上的表现如何,BERT 增强对结果有何影响?

主要发现

  • RAT-SQL 在 Spider 测试集上实现 57.2% 的精确匹配,较非 BERT 基线高出 8.7% 的绝对值。
  • RAT-SQL 与 BERT 在 Spider 测试集达到 65.6% 的精确匹配,为当时带 BERT 增强模型的最新最先进水平。
  • 在开发数据上,RAT-SQL 达到 62.7%(dev)和 57.2%(test);使用 BERT 时,69.7%(dev)和 65.6%(test)。
  • 消融显示去除模式链接或图关系会显著降低准确性(例如 无 模式链接 40.37%,无 图关系 35.59% 在 dev)。
  • Oracle 实验表明,如果提供正确的列/表或 AST 草图,准确性可以接近完美水平(99.4% 同时具备 oracle sketch 和 oracle columns)。
  • 基于值的链接显著提升性能(dev 60.54%,与 无值链接 55.13% 相比)。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。