Building cross-domain NL2SQL parsers relies heavily on accurate schema linking—the ability to align question tokens with database schema elements. However, existing methods based on n-gram or static similarity often fail when natural language expressions differ from database terms. To address this, we propose MSAE-SQL, a multi-layer semantic-aware enhanced NL2SQL model. Our approach leverages pre-trained language models (PLMs) to capture semantic correlations, constructs a schema linking graph by combining hyperbolic space distances and cosine similarity, and introduces relation-guided graph encoding to enhance the contextual representation of question-schema pairs. Finally, we apply irrelevant table pruning in decoding to improve SQL generation accuracy. Experiments on Spider, Spider-SYN, and Spider-DK benchmarks demonstrate the superior performance and robustness of our model.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

MSAE-SQL: A Multi-layer Semantic-Aware Enhanced NL2SQL Model

  • Minxuan Li,
  • Kexin Ding,
  • Derong Shen,
  • Tiezheng Nie,
  • Yue Kou,
  • Minghe Yu

摘要

Building cross-domain NL2SQL parsers relies heavily on accurate schema linking—the ability to align question tokens with database schema elements. However, existing methods based on n-gram or static similarity often fail when natural language expressions differ from database terms. To address this, we propose MSAE-SQL, a multi-layer semantic-aware enhanced NL2SQL model. Our approach leverages pre-trained language models (PLMs) to capture semantic correlations, constructs a schema linking graph by combining hyperbolic space distances and cosine similarity, and introduces relation-guided graph encoding to enhance the contextual representation of question-schema pairs. Finally, we apply irrelevant table pruning in decoding to improve SQL generation accuracy. Experiments on Spider, Spider-SYN, and Spider-DK benchmarks demonstrate the superior performance and robustness of our model.