IP Library Granted Patent US 12,399,892
Granted Patent B2
US 12,399,892 · App. 17/508,914 · Granted Aug 26, 2025

System and method for transferable natural language interface

Inventors: Yanshuai Cao (Toronto, CA); Peng Xu (Toronto, CA); Keyi Tang (Vancouver, CA); Wei Yang (Toronto, CA); Wenjie Zi (Toronto, CA); Teng Long (Toronto, CA); Jackie Chit Kit Cheung (Toronto, CA); Chenyang Huang (Toronto, CA); Lili Mou (Toronto, CA); Hamidreza Shahidi (Toronto, CA); Ákos Kádár (Toronto, CA)
Assignee: Royal Bank of Canada
G06F16/2433G06F16/243
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,399,892
App. No.
17/508,914
Granted
Aug 26, 2025
Kind
B2
Abstract

A computer system and method for answering a natural language question is provided. The system comprises at least one processor and a memory storing instructions which when executed by the processor configure the processor to perform the method. The method comprises receiving a natural language question, generating a SQL query based on the natural language question, generating an explanation regarding a solution to the natural language question as answered by the SQL query, and presenting the solution and the explanation.

Claims (46)

1. A system for answering a natural language question, the system comprising:

at least one processor; and

a memory comprising instructions which, when executed by the processor, configure the processor to:

receive a natural language question;

generate, using a neural network architecture having an encoder and a decoder, an executable SQL query based on the natural language question, wherein the SQL query is represented as an abstract syntax tree generated from a sequence of tree-constructing actions predicted by the neural network architecture, the abstract syntax tree generated based on a database schema and a plurality of words in the natural language question;

generate using a shallow synchronous context-free grammar system architecture and a deep synchronous context-free architecture, a natural language explanation of the executable SQL query which is used to find a solution to the natural language question from a database; and

present the solution and the natural language explanation.

2. The system as claimed in claim 1 , wherein the at least one processor is configured to send the SQL query to the database.

3. The system as claimed in claim 1 , wherein the at least one processor is configured to receive the solution from the database.

4. The system as claimed in claim 1 , wherein the at least one processor is configured to determine if the question is out-of-domain or hard-to answer.

5. The system as claimed in claim 1 , wherein the at least one processor is configured to translate the natural language question into the SQL query based on a directed graph constructed to represent relationships between the plurality of words.

6. A method of answering a natural language question, the method comprising:

receiving a natural language question;

generating, using a neural network architecture having an encoder and a decoder, an executable SQL query based on the natural language question, wherein the SQL query is represented as an abstract syntax tree generated from a sequence of tree-constructing actions predicted by the neural network architecture, the abstract syntax tree generated based on a database schema and a plurality of words in the natural language question;

generating, using a shallow synchronous context-free grammar system architecture and a deep synchronous context-free grammar system architecture, a natural language explanation of the executable SQL query which is used to find a solution to the natural language question from a database; and

presenting the solution and the natural language explanation.

7. The method as claimed in claim 6 , comprising sending the SQL query to the database and receiving the solution from the database.

8. The method as claimed in claim 6 , comprising determining if the question is out-of-domain or hard-to answer.

9. The method as claimed in claim 6 , comprising translating the natural language question into the SQL query based on a directed graph constructed to represent relationships between the plurality of words.

10. A system for answering a natural language question, the system comprising:

at least one processor; and

a memory comprising instructions which, when executed by the processor, configure the processor to:

receive a natural language question; and

when the question is not out-of-domain and not hard-to answer:

generate, using a neural network architecture having an encoder and a decoder, an executable SQL query based on the natural language question, wherein the SQL query is represented as an abstract syntax tree generated from a sequence of tree-constructing actions predicted by the neural network architecture, the abstract syntax tree generated based on a database schema and a plurality of words in the natural language question;

generate, using a shallow synchronous context-free grammar system architecture and a deep synchronous context-free grammar system architecture, a natural language explanation of the executable SQL query which is used to find a solution to the natural language question from a database; and

present the solution and the natural language explanation.

11. The system as claimed in claim 10 , wherein the at least one processor is configured to send the SQL query to the database.

12. The system as claimed in claim 10 , wherein the at least one processor is configured to receive the solution from the database.

13. The system as claimed in claim 10 , wherein the at least one processor is configured to determine if the question is out-of-domain or hard-to answer.

14. The system as claimed in claim 10 , wherein the at least one processor is configured to translate the natural language question into the SQL query based on a directed graph constructed to represent relationships between the plurality of words.

15. A method of answering a natural language question, the method comprising:

receiving a natural language question; and

when the question is not out-of-domain and not hard-to answer:

generating, using a neural network architecture having an encoder and a decoder, an executable SQL query based on the natural language question, wherein the SQL query is represented as an abstract syntax tree generated from a sequence of tree-constructing actions predicted by the neural network architecture, the abstract syntax tree generated based on a database schema and a plurality of words in the natural language question;

generating, using a shallow synchronous context-free grammar system architecture and a deep synchronous context-free grammar system architecture, a natural language explanation of the executable SQL query which is used to find a solution to the natural language question from a database; and

presenting the solution and the natural language explanation.

16. The method as claimed in claim 15 , comprising sending the SQL query to the database.

17. The method as claimed in claim 15 , comprising receiving the solution from the database.

18. The method as claimed in claim 15 , comprising determining if the question is out-of-domain or hard-to answer.

19. The method as claimed in claim 15 , comprising translating the natural language question into the SQL query based on a directed graph constructed to represent relationships between the plurality of words.

20. The method as claimed in claim 6 , comprising:

generating a plurality of executable SQL queries based on the natural language question;

generating an explanation for each SQL query of the plurality of executable SQL queries based on the natural language question, wherein the explanation for each SQL query of the plurality of executable SQL queries reflects differences between each SQL query of the plurality of executable SQL queries;

selecting a SQL query of the plurality of executable SQL queries to be a solution to the natural language question, and

presenting the solution and the explanation for the SQL query corresponding to the solution.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 30, 2025
From: CAO, YANSHUAI; XU, PENG; TANG, KEYI; YANG, WEI; ZI, WENJIE; LONG, TENG; CHEUNG, JACKIE CHIT KIT; HUANG, CHENYANG; MOU, LILI; SHAHIDI, HAMIDREZA; KÁDÁR, ÁKOS
To: ROYAL BANK OF CANADA
Reel/Frame 073051/0234 →
Continuity (3)
Provisional Application 63126887 · Dec 17, 2020
Provisional Application 63104789 · Oct 23, 2020
Related Publication 20220129450A1 · Apr 28, 2022
References Cited (70)
US 5265014A · Haddock · 1993 [cited by examiner]
US 5386556A · Hedin · 1995 [cited by examiner]
US 5884302A · Ho · 1999 [cited by examiner]
US 9501585B1 · Gautam · 2016 [cited by examiner]
US 9830315B1 · Xiao · 2017 [cited by examiner]
US 11561969B2 · Kim · 2023 [cited by examiner]
US 20010013036A1 · Judicibus · 2001 [cited by examiner]
US 20030200206A1 · de Judicibus · 2003 [cited by examiner]
US 20070022109A1 · Imielinski · 2007 [cited by examiner]
US 20080235199A1 · Li · 2008 [cited by examiner]
US 20110093486A1 · Lin · 2011 [cited by examiner]
US 20110320187A1 · Motik · 2011 [cited by examiner]
US 20120173476A1 · Rizvi · 2012 [cited by examiner]
US 20150142704A1 · London · 2015 [cited by examiner]
US 20160180438A1 · Boston · 2016 [cited by examiner]
US 20160260433A1 · Sumner · 2016 [cited by examiner]
US 20170025120A1 · Dayan · 2017 [cited by examiner]
US 20170075953A1 · Bozkaya · 2017 [cited by examiner]
US 20170083615A1 · Boguraev · 2017 [cited by examiner]
US 20180095962A1 · Anderson · 2018 [cited by examiner]
US 20180210883A1 · Ang · 2018 [cited by examiner]
US 20180336798A1 · Malawey · 2018 [cited by examiner]
US 20180349377A1 · Verma · 2018 [cited by examiner]
US 20190205726A1 · Khabiri · 2019 [cited by examiner]
US 20190243831A1 · Rumiantsau · 2019 [cited by examiner]
US 20190272296A1 · Prakash · 2019 [cited by examiner]
US 20200034362A1 · Galitsky · 2020 [cited by examiner]
US 20200257679A1 · Sheinin · 2020 [cited by examiner]
US 20220067281A1 · Hu · 2022 [cited by examiner]
US 20230025842A1 · Nandikotkur · 2023 [cited by examiner]
US 20230026764A1 · Karashchuk · 2023 [cited by examiner]
US 20230026794A1 · Hwang · 2023 [cited by examiner]
Jimmy Lei Ba et al., 2016, Layer normalization, arXiv preprint arXiv:1607.06450. [cited by applicant]
DongHyun Choi et al., 2020, Ryansql: Recursively applying sketch-based slot fillings for complex text-to-sql in cross-domain databases, arXiv preprint arXiv:2004.03125. [cited by applicant]
Chelsea Finn et al., Model-agnostic meta-learning for fast adaptation of deep networks, In ICML. [cited by applicant]
Xavier Glorot et al., Understanding the difficulty of training deep feed forward neural networks, In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pp. 249-256. [cited by applicant]
Jiaqi Guo et al., 2019, Towards complex text-to-sql in cross-domain database with intermediate representation, ACL. [cited by applicant]
Sepp Hochreiter et al., 1997, Long short-term memory, Neural computation, 9(8):1735-1780. [cited by applicant]
Xiao Shi Huang et al., 2020, Improving transformer optimization through better initialization, ICML. [cited by applicant]
Preetum Nakkiran et al., 2019, Deep double descent: Where bigger models and more data hurt, In International Conference on Learning Representations. [cited by applicant]
Peter Shaw et al., 2018. Self-attention with relative position representations, In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Techno… [cited by applicant]
Nitish Srivastava et al., 2014, Dropout: a simple way to prevent neural networks from overfitting, The journal of machine learning research, 15(1):1929-1958. [cited by applicant]
Christian Szegedy et al., 2016, Rethinking the inception architecture for computer vision, In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2818-2826. [cited by applicant]
Ashish Vaswani et al., 2017, Attention is all you need, In Advances in neural information processing systems, pp. 5998-6008. [cited by applicant]
Bailin Wang et al., 2019, Rat-sql: Relation-aware schema encoding and linking for text-to-sql parsers, arXiv preprint arXiv:1911.04942. [cited by applicant]
Sam Wiseman et al., 2016, Sequence-to-sequence learning as beam-search optimization. arXiv preprint arXiv:1606.02960. [cited by applicant]
Zitong Yang et al., 2020, Rethinking bias-variance trade-off for generalization of neural networks, arXiv preprint arXiv:2002.11328. [cited by applicant]
Pengcheng Yin et al., 2018, Tranx: A transition-based neural abstract syntax parser for semantic parsing and code generation, arXiv preprint arXiv:1810.02720. [cited by applicant]
Tao Yu et al., 2018, Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task, In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Process… [cited by applicant]
Hongyi Zhang et al., 2019, Fixup initialization: Residual learning with-out normalization, ICLR. [cited by applicant]
Anna Currey et al., 2017, Copied monolingual data improves low-resource neural machine translation, In Proceedings of the Second Conference on Machine Translation, pp. 148-156. [cited by applicant]
Diederik P. Kingma et al., 2014, Adam: A method for stochastic optimization, arXiv preprint arXiv:1412.6980. [cited by applicant]
Ahmed Elgohary et al., 2020, Speak to your parser: Interactive text-to-sql with natural language feedback, In Annual Conference of the Association for Computational Linguistics (ACL 2020). [cited by applicant]
Catherine Finegan-Dollak et al., 2018, Improving text-to-SQL evaluation methodology, In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (vol. 1: Long Papers), pp. 351-360, Melbour… [cited by applicant]
Victor Zhong et al., 2017, Seq2sql: Generating structured queries from natural language using reinforcement learning, arXiv preprint arXiv:1709.00103. [cited by applicant]
Tong Guo et al., 2020, Content enhanced bert-based text-to-sql generation. [cited by applicant]
G. Koutrika et al., 2010, Explaining structured queries in natural language, In 2010 IEEE 26th International Conference on Data Engineering (ICDE 2010), pp. 333-344. [cited by applicant]
F. Li et al., 2014, Nalir: an interactive natural language interface for querying relational databases, Proceedings of the 2014 ACM SIGMOD International Conference on Management of Data. [cited by applicant]
Xi Victoria Lin et al., 2020, Bridging textual and tabular data for cross-domain text-to-sql semantic parsing, arXiv preprint arXiv:2012.12627. [cited by applicant]
Axel-Cyrille Ngonga Ngomo et al., 2013, Sorry, i don't speak sparql: translating sparql queries into natural language, In WWW, pp. 977-988. [cited by applicant]
Ana-Maria Popescu et al., 2003, Towards a theory of natural language inter-faces to databases. In Proceedings of the 8th in-ternational conference on Intelligent user interfaces, pp. 149-157. [cited by applicant]
Ohad Rubin et al., 2020, Smbop: Semi-autoregressive bottom-up semantic parsing. [cited by applicant]
Yannis Ioannidis et al., 2009, Dbmss should talk back too, CoRR, abs/0909.1786. [cited by applicant]
Alane Suhr, 2020, Exploring unexplored generalization challenges for cross-database semantic parsing, In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 8372-8388, Online, As… [cited by applicant]
Kun Xu et al., 2018. SQL-to-text generation with graph-to-sequence model, In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 931-936, Brussels, Belgium, Association for Comput… [cited by applicant]
P. Xu et al., 2020, Optimizing deeper transformers on small datasets: An application on text-to-sql semantic parsing, ArXiv, abs/2012.15355. [cited by applicant]
John M Zelle et al., 1996, Learning to parse database queries using inductive logic programming, In Proceedings of the national conference on artificial intelligence, pp. 1050-1055. [cited by applicant]
Jichuan Zeng et al., 2020, Photon: A robust cross-domain text-to-SQL system, In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 204-214, Online, Associ… [cited by applicant]
Victor Zhong et al., 2020, Grounded adaptation for zero-shot executable semantic parsing, In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6869-6882, Online, Associa… [cited by applicant]
Peter Shaw et al., 2020, Compositional generalization and natural language variation: Can a semantic parsing approach handle both?, arXiv preprint arXiv:2010.12725. [cited by applicant]
Cited By (1)
US 12,670,211