{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/rat-sql-relation-aware-schema-encoding-and-1","title":"RAT-SQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers","arxiv_id":"1911.04942","date":"2019-11-10","proceeding":"ACL 2020 6","authors":["Bailin Wang","Richard Shin","Xiaodong Liu","Oleksandr Polozov","Matthew Richardson"],"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.","url_abs":"https://arxiv.org/abs/1911.04942v5","url_pdf":"https://arxiv.org/pdf/1911.04942v5.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"rat-sql-relation-aware-schema-encoding-and-1","repo_url":"https://github.com/Microsoft/rat-sql","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"rat-sql-relation-aware-schema-encoding-and-1","repo_url":"https://github.com/dmirlab-group/sadga","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"rat-sql-relation-aware-schema-encoding-and-1","repo_url":"https://github.com/yandex-research/sparqling-queries","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"rat-sql-relation-aware-schema-encoding-and-1","repo_url":"https://github.com/PaddlePaddle/PaddleNLP/tree/develop/examples/text_to_sql/RAT-SQL","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":null}],"tasks":[{"task_slug":null,"task_name":"Relation"},{"task_slug":"semantic-parsing","task_name":"Semantic Parsing"},{"task_slug":"text-to-sql","task_name":"Text to SQL"},{"task_slug":"text-to-sql","task_name":"Text-To-SQL"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/semantic-parsing-on-spider","task":"Semantic Parsing","dataset":"spider","model":"RATSQL + BERT","rank_in_archive_order":9,"of":10,"metrics":{"Accuracy":"65.6"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=1911.04942","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1911.04942"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PaddlePaddle/PaddleNLP/tree/develop/examples/text_to_sql/RAT-SQL","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yandex-research/sparqling-queries","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dmirlab-group/sadga","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Microsoft/rat-sql","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":3,"ran_draft_wrong":1,"unverified":3},"by_repo_kind":{"official":{"samples":7,"ran":4,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"ac13caa2ecfa34fe","entry":"clones","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/models/transformer.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/models/transformer.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ac13caa2ecfa34fe"}},{"code_sha256_prefix":"0992d2a47ae733fa","entry":"get_schema","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/datasets/spider_lib/process_sql.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/datasets/spider_lib/process_sql.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0992d2a47ae733fa"}},{"code_sha256_prefix":"c4dcaf29b663a364","entry":"get_schema_from_json","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/datasets/spider_lib/process_sql.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/datasets/spider_lib/process_sql.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c4dcaf29b663a364"}},{"code_sha256_prefix":"b1447ba09556aed5","entry":"relative_attention_values","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/models/transformer.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/models/transformer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b1447ba09556aed5"}},{"code_sha256_prefix":"3c377f8696988de8","entry":"beam_search","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/beam_search.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/beam_search.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3c377f8696988de8"}},{"code_sha256_prefix":"ccc72a1f79c00ef3","entry":"relative_attention_logits","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/models/transformer.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/models/transformer.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ccc72a1f79c00ef3"}},{"code_sha256_prefix":"a906f5de1f5971b0","entry":"tokenize","repo":"Microsoft/rat-sql","repo_kind":"official","path":"ratsql/datasets/spider_lib/process_sql.py","file_url":"https://github.com/Microsoft/rat-sql/blob/HEAD/ratsql/datasets/spider_lib/process_sql.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a906f5de1f5971b0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}