Để đánh giá tốt hơn chất lượng của mô hình, luận văn thực hiện thí nghiệm trên ba bộ dữ liệu biến thể của Spider là Spider-DK, Spider-Realistic, và Spider-Syn.
Các bộ dữ liệu này sửa đổi hoặc thêm một số mẫu vào Spider để tạo ra các biến thể khác nhau. Spider-DK [40] thêm các kiến thức chuyên ngành vào trong các câu hỏi của Spider để làm cho các câu hỏi đó thực tế hơn. Spider-Realistic [41] xoá tên cột trong tập kiểm chứng Spider để tăng độ khó lên. Cuối cùng, Spider-Syn [42]
thay thế tên của một số tên bảng, cột trong Spider với từ đồng nghĩa của chúng.
Bảng 4.8 thể hiện kết quả của thuật toán RELAX và phương pháp sử dụng NLL
43
để đối chiếu. Trong phần lớn các trường hợp, RELAX đều có độ chính xác EM và
EX tốt hơn, trừ bộ Spider-Realistic. Điều đó cho thấy mô hình được huấn luyện không chỉ hoạt động tốt trên bộ dữ liệu gốc mà còn nâng cao độ chính xác một
Z 2 . A Z sk 2 2 Z
cách 6n định trên các biên thé của nó.
44
Kết luận
Trong luận văn này, một phương pháp tiếp cận mới sử dụng học máy tăng cường kết hợp với học máy giám sát đã được đề xuất để giải quyết bài toán chuyển đổi ngôn ngữ tự nhiên sang truy vấn SQL (text-to-SQL). Sự kết hợp đó nhằm mục đích cải thiện kết quả của mô hình so với khi chỉ sử dụng hàm mat mát NLL (Negative Log-Likelihood) của học máy giám sát truyền thống. Dựa trên mô hình Tð, phương pháp được đề xuất dùng kỹ thuật Gumbel-Softmax lấy mẫu trước dau ra của T5
và sử dụng các thuật toán policy gradient là REINFORCE va RELAX để huấn
luyện thành phần học máy tăng cường. Bên cạnh đó, một hàm phần thưởng gần với độ chính xác so khớp cũng được thiết kế dành riêng cho bài toán này. Các thí
nghiệm được thực hiện tập trung vào mô hình có kích thước nhỏ là T5 small và
T5 base. Các kết quả trên bộ dit liệu Spider và các biến thể của nó cho thấy sự kết hợp hàm mat mát của hai phương pháp học máy đã giúp nâng cao độ chính xác của mô hình một cách đáng kể, đặc biệt là trên các câu truy vấn có mức độ phức
tạp cao. Ngoài ra, độ chính xác cao hơn so với mô hình tham chiếu NLL được duy
trì ổn định trong phần lớn quá trình tinh chỉnh. Như vậy kết quả thí nghiệm chứng
minh phương pháp học máy tăng cường đã tận dung được các mẫu sinh ra trong
quá trình huấn luyện bởi mô hình để huấn luyện lại chính nó. So với hệ thống sử
dụng API ChatGPT, phương pháp đề xuất đạt độ chính xác so khớp (EM) tương đương ngay cả khi sử dụng mô hình T5 small. Việc huấn luyện với hàm mục tiêu kết hợp được trình bày trong luận văn cho phép huấn luyện ra các mô hình có kích
thước bé, phù hợp với phần cứng phổ thông giúp tiết kiệm chi phí triển khai.
Bài toán chuyển đổi ngôn ngữ tự nhiên sang truy vấn SQL trong luận văn này được thực hiện cho tiếng Anh. Trong tương lai, nghiên cứu có thể được thực hiện
cho ngôn ngữ tiếng Việt. Ngoài ra, thí nghiệm trên các bộ dữ liệu mới phức tạp hơn và nghiên cứu sâu hơn việc sử dụng kết hợp với các mô hình ngôn ngữ lớn
cũng là những hướng nghiên cứu hợp lý.
45
Nghiên cứu cắt bỏ
Vai trò cua học may tăng cường
Để xác nhận đóng góp của các thuật toán học máy tăng cường vào độ chính xác
của mô hình, tác giả thực hiện các thí nghiệm sau:
¢ NLL: tinh chỉnh mô hình T5 small gốc chỉ sử dung học máy giám sát với hàm mat mát NLL. Các thí nghiệm tiếp theo đều thực hiện tinh chỉnh từ cùng một trọng số được lưu lại (checkpoint) Œ.
ô reNLL: tinh chỉnh lại C mà vẫn sử dụng hàm mat mỏt NLL.
ô REINFORCE và RELAX: tinh chỉnh C sử dụng hàm mat mỏt kết hợp
giữa NLL và thuật toán tương ứng.
Hình 6.5 cho thấy kết quả của các thí nghiệm này. Thí nghiệm reNLL có độ chính xác tương đương với NLL gốc. Còn REINFORCE có kết quả tốt hơn thấy rõ. Điều đó chứng tỏ kết quả của mô hình kết hợp giữa học máy giám sát và học máy tăng cường được nâng cao là nhờ sự kết hợp này chứ không phải do được tỉnh chỉnh thêm một lần nữa. Trong khi đó, hình 6.6 là kết quả của thí nghiệm REINFORCE và RELAX. Ta có thể thay hai thuật toán này cho kết quả gần nhau, nhưng RELAX đạt kết quả tốt sớm hơn REINFORCE chỉ với khoảng một nửa số bước huấn luyện.
Những kết quả này chứng minh rằng hai thuật toán học máy tăng cường có vai
trò rõ ràng trong việc nâng cao độ chính xác của mô hình.
46
Exact Set Match
—— NLL
0.1 —— reNLL
—— REINFORCE
T T T T T T T
0 50K 100K 150K 200K 250K 300K 350K 400K Training steps
Hình 6.5: Kết quả EM khi có và không sử dụng học máy tăng cường
0.50 3
0.45 3
0.40 3
0.35 3
Exact Set Match
0.30 +
0/2577 —— REINFORCE
—— RELAX
0 50K 100K 150K 200K 250K 300K 350K
Training steps
Hình 6.6: Kết quả EM của REINFORCE va RELAX
47
Danh sách công bố
Xuan-Bang Nguyen, Xuan-Hieu Phan, Massimo Piccardi. “Fine-Tuning Text-to- SQL Models with Reinforcement-Learning Training Objectives.” Submitted to Nat- ural Language Processing Journal.
48
Tài
HH
i liệu tham khảo
L. Banarescu, C. Bonial, S. Cai, M. Georgescu, K. Griffitt, U. Hermjakob, K. Knight, P. Koehn, M. Palmer, and N. Schneider, “Abstract meaning rep- resentation for sembanking,” in Proceedings of the 7th linguistic annotationÿ
workshop and interoperability with discourse, 2013, pp. 178-186.
P. Yin and G. Neubig, “A syntactic neural model for general-purpose code generation,” arXiv preprint arXiv:1704.01696, 2017.
T. Yu, R. Zhang, K. Yang, M. Yasunaga, D. Wang, Z. Li, J. Ma, I. Li, Q.
Yao, S. Roman, Z. Zhang, and D. Radev, “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 Processing, E. Riloff, D. Chiang, J. Hockenmaier, and J. Tsujii, Eds., Brussels, Belgium: Association for Computational Linguistics,
Oct. 2018, pp. 3911-3921. DOI: 10.18653/v1/D18-1425. [Online]. Available:
https: //aclanthology.org/D18-1425.
B. Wang, R. Shin, X. Liu, O. Polozov, and M. Richardson, “Rat-sql: Relation- aware schema encoding and linking for text-to-sql parsers,” arXiv preprint
arXtv:1911.04942, 2019.
X. V. Lin, R. Socher, and C. Xiong, “Bridging textual and tabular data for cross-domain text-to-sql semantic parsing,” arXiv preprint arXiv:2012. 12627,
2020.
D. Choi, M. C. Shin, E. Kim, and D. R. Shin, “Ryansql: Recursively applying sketch-based slot fillings for complex text-to-sql in cross-domain databases,”
Computational Linguistics, vol. 47, no. 2, pp. 309-332, 2021.
T. Scholak, N. Schucher, and D. Bahdanau, “Picard: Parsing incrementally for constrained auto-regressive decoding from language models,” arXiv preprint
arXtv:2109.05098, 2021.
J. Li, B. Hui, R. Cheng, B. Qin, C. Ma, N. Huo, F. Huang, W. Du, L. Si, and Y. Li, “Graphix-t5: Mixing pre-trained transformers with graph-aware layers for text-to-sql parsing,” in Proceedings of the AAAI Conference on Artificial
Intelligence, vol. 37, 2023, pp. 13 076-13 084.
49
[9]
[10]
11
12
13
14
[17]
L. Zeng, S. H. K. Parthasarathi, and D. Hakkani-Tur, “N-best hypotheses reranking for text-to-sql systems,” in 2022 IEEE Spoken Language Technology
Workshop (SLT), IEEE, 2023, pp. 663-670.
J. Qi, J. Tang, Z. He, X. Wan, Y. Cheng, C. Zhou, X. Wang, Q. Zhang, and Z.
Lin, “Rasat: Integrating relational structures into pretrained seq2seq model for text-to-sql,” arXiv preprint arXtv:2205. 06988, 2022.
A. Liu, X. Hu, L. Wen, and P. S. Yu, “A comprehensive evaluation of chatgpt’s zero-shot text-to-sql capability,” arXiv preprint arXiv:2803.18547, 2023.
X. Dong, C. Zhang, Y. Ge, Y. Mao, Y. Gao, J. Lin, D. Lou, và cộng sự, “C3:
Zero-shot text-to-sql with chatgpt,” arXiv preprint arXiv:2807.07806, 2023.
A. Agrahari, P. K. Ojha, A. Gautam, and P. Singh, “Sft for improved text- to-sql translation,” 2024.
H. Touvron, L. Martin, K. Stone, P. Albert, A. Almahairi, Y. Babaei, N.
Bashlykov, S. Batra, P. Bhargava, and 5S. Bhosale, “Llama 2: Open foundation and fine-tuned chat models,” arXiv preprint arXiv:2307.09288, 2023.
D. Gao, H. Wang, Y. Li, X. Sun, Y. Qian, B. Ding, and J. Zhou, “Text-to- sql empowered by large language models: A benchmark evaluation,” arXiv preprint arXiv:2808.15363, 2023.
Y. Xiang, Q.-W. Zhang, X. Zhang, Z. Liu, Y. Cao, and D. Zhou, “G3r: A graph-guided generate-and-rerank framework for complex and cross-domain
text-to-sql generation,” in Findings of the Association for Computational Lin- guistics: ACL 2028, 2023, pp. 338-352.
R. Cao, L. Chen, Z. Chen, Y. Zhao, 5. Zhu, and K. Yu, “Lgesql: Line graph enhanced text-to-sql model with mixed local and non-local relations,” arXiv preprint arXiv:2106.01098, 2021.
K. Clark, “Electra: Pre-training text encoders as discriminators rather than generators,” arXiv preprint arXtv:2008.10555, 2020.
R. Paulus, C. Xiong, and R. Socher, A deep reinforced model for abstrac-
tive summarization, 2017. arXiv: 1705 .04304 [cs.CL]. [Online]. Available:
https://arxiv.org/abs/1705 .04304.
50
[20]
[21]
R. Pasunuru and M. Bansal, “Multi-reward reinforced summarization with saliency and entailment,” in Proceedings of the 2018 Conference of the North
American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), M. Walker, H. Ji, and A.
Stent, Eds., New Orleans, Louisiana: Association for Computational Linguis- tics, Jun. 2018, pp. 646-653. DOI: 10.18653/v1/N18-2102. [Online]. Avail- able: https: //aclanthology.org/N18-2102.
J. Parnell, I. Jauregi Unanue, and M. Piccardi, “A multi-document cover- age reward for RELAXed multi-document summarization,” in Proceedings
of the 60th Annual Meeting of the Association for Computational Linguis- tics (Volume 1: Long Papers), S. Muresan, P. Nakov, and A. Villavicencio, Eds., Dublin, Ireland: Association for Computational Linguistics, May 2022, pp. 5112-5128. Dor: 10. 18653/v1/2022.ac1-1ong. 351. [Online]. Available:
https: //aclanthology.org/2022.acl-long.351.
M. Ranzato, S. Chopra, M. Auli, and W. Zaremba, “Sequence level training with recurrent neural networks,” arXiv preprint arXtv:1511.06782, 2015.
S. Edunov, M. Ott, M. Auli, D. Grangier, and M. Ranzato, “Classical struc- tured prediction losses for sequence to sequence learning,” in Proceedings ofằ
the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), M. Walker, H. Ji, and A. Stent, Eds., New Orleans, Louisiana: As-
sociation for Computational Linguistics, Jun. 2018, pp. 355-364. DOI: 10.
18653/v1/N18-1033. [Online]. Available: https: //aclanthology.org/N18-
1033.
V. Zhong, C. Xiong, and R. Socher, “Seq2sql: Generating structured queries
from natural language using reinforcement learning,” CoRR, vol. abs/1709.00103,
2017.
K. Papineni, S. Roukos, T. Ward, and W.-J. Zhu, “Bleu: A method for au-
tomatic evaluation of machine translation,” in Proceedings of the 40th An- nual Meeting on Association for Computational Linguistics, ser. ACL ’02, Philadelphia, Pennsylvania: Association for Computational Linguistics, 2002,
pp. 311-318. Dor: 10. 3115/1073083. 1073135. [Online]. Available: https:
//doi.org/10.3115/1073083. 1073135.
51
26
27
28
29
30
[32]
33
34
39
36
R. 5. Sutton, “Reinforcement learning: An introduction,” A Bradford Book,
2018.
J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov, “Proximal policy optimization algorithms,” arXiv preprint arXiv:1707.06347, 2017.
J. Devlin, “Bert: Pre-training of deep bidirectional transformers for language understanding,” arXiv preprint arXiv:1810.04805, 2018.
A. Radford, K. Narasimhan, T. Salimans, and I. Sutskever, “Improving lan- guage understanding by generative pre-training,” 2018.
C. Raffel, N. Shazeer, A. Roberts, K. Lee, S. Narang, M. Matena, Y. Zhou, W.
Li, and P. J. Liu, “Exploring the limits of transfer learning with a unified text- to-text transformer,” Journal of machine learning research, vol. 21, no. 140, pp. 1-67, 2020.
A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, b.
Kaiser, and I. Polosukhin, “Attention is all you need,” in Advances in Neural Information Processing Systems, I. Guyon, U. V. Luxburg, S. Bengio, H. Wal- lach, R. Fergus, S. Vishwanathan, and R. Garnett, Eds., vol. 30, Curran Asso- ciates, Inc., 2017. [Online]. Available: https: //proceedings .neurips.cc/
paper _ files /paper /2017 /£i1e / 3f5ee243547dee91fbd053c1c4a845aa-
Paper. pdf.
J. Pennington, R. Socher, and C. D. Manning, “Glove: Global vectors for word representation,” in Proceedings of the 2014 conference on empirical methods
in natural language processing (EMNLP), 2014, pp. 1532-1543.
T. Mikolov, “Efficient estimation of word representations in vector space,”
arXtv preprint arXiv:1801.3781, 2013.
E. Jang, S. Gu, and B. Poole, “Categorical reparameterization with gumbel- softmax,” arXiv preprint arXiv:1611.01144, 2016.
R. J. Williams, “Simple statistical gradient-following algorithms for connec- tionist reinforcement learning,” Machine learning, vol. 8, pp. 229-256, 1992.
W. Grathwohl, D. Choi, Y. Wu, G. Roeder, and D. Duvenaud, “Backpropa- gation through the void: Optimizing control variates for black-box gradient estimation,” arXiv preprint arXiv:1711.00123, 2017.
52