DuoRAT
Text-to-SQL model whose encoder and decoder are both relation-aware transformers, with a BERT input stage.
Language · 1,144 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
At a glance
- Task
- Language
- Parameters
- 387.1M
- Operations
- 1,144
- Framework
- PyTorch
- Recurrent
- No
- Published
- NAACL 2021
- Cited by
- 23 (as of 29 October 2026)
- Authors
- Torsten Scholak, Raymond Li, Dzmitry Bahdanau and others
- Source
- GitHub: ElementAI/duorat
- License
- CC-BY-NC-4.0
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m16218
- Graph hash
- ab5a52189dd9247672c6d24b0cb50926eee853900e9f3dea074740314f8d627f
- Skeleton hash
- 4f601fe28fa96a72ec2498cf7f910e2edf308cf8a29fea1538178bb4c4a8dabe
- Architecture hash
- bfd265724daaa02b51c7af2721a0372d8910d5452962c25c95c06fd1ec80f19a
- Diagram SHA-256
- 89da1de8dbdc6e5e9fed2e4217efcad0ef045f080af82befdb29d029acc69ad9
- TorchLens version
- 2.36.0
- Renderer
- graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
- Check
- Forward pass replayed in PyTorch
What it is
DuoRAT is a text-to-SQL model: given a natural language question and a relational database schema, it produces an SQL query. It is a reimplementation of RAT-SQL in which both the encoder and the decoder are relation-aware transformers, and its authors built it as a simpler baseline for ablation experiments.
The encoder has two stages: a stack initialized with BERT weights reads the question, table names, column names and column types, and relation-aware self-attention layers trained from scratch follow it. Relation-aware attention adds a learned embedding for the labeled edge between two inputs, and the edge labels cover schema linking, table-column membership and foreign keys. The decoder is a relation-aware transformer with attention over the encoder output and a pointer-network copy mechanism, restricted to sequences of grammar actions that encode a valid SQL abstract syntax tree.
The paper reports 68.7 ± 0.7 exact-match accuracy on the original Spider development set. Training takes roughly two days compared with six for RAT-SQL, which the authors associate with replacing the LSTM decoder with a transformer. In the ablations, name-based schema linking could be disabled with a negligible loss when BERT is used, while content-based schema linking could not.
Key idea. DuoRAT reimplements RAT-SQL using only relation-aware or vanilla transformers, and its ablations show which text-to-SQL techniques remain useful and which are redundant.
- DuoRAT
- text-to-SQL
- text2sql
- relation-aware transformer
- Spider dataset
- semantic parsing
- schema linking
- grammar-constrained decoding
- natural language interface to databases
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{scholak2021duoratsimplertexttosqlmodels,
title={DuoRAT: Towards Simpler Text-to-SQL Models},
author={Torsten Scholak and Raymond Li and Dzmitry Bahdanau and Harm de Vries and Chris Pal},
year={2021},
eprint={2010.11119},
archivePrefix={arXiv},
primaryClass={cs.CL},
doi={https://doi.org/10.18653/v1/2021.naacl-main.103},
url={https://arxiv.org/abs/2010.11119},
}