VIETNAM NATIONAL UNIVERISTY HO CHI MINH CITY HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY NGUYEN VINH KHIEM APPLICATION OF LARGE LANGUAGE MODEL IN TEXT-TO-SQL Major: COMPUTER SCIENCE Major code: 8480101 MASTER’S THESIS HO CHI MINH CITY, June 2024 THIS THESIS IS COMPLETED AT HO CHI MINH UNIVERSITY OF TECHNOLOGY – VNU-HCM Supervisors: Assoc. Huynh Tuong Nguyen Assoc. Quan Thanh Tho Examiner 1: Dr. Le Thanh Van Examiner 2: Dr.
Le Thi Thuy This master’s thesis is defended at Ho Chi Minh City University of Technology (HCMUT) – VNU-HCM on 17th June 2024. Master’s Thesis Committee: 1. Vo Thi Ngoc Chau Chairman 2. Le Thanh Van Examiner 1 3.
Le Thi Thuy Examiner 2 4. Tran Thanh Tung Commissioner 5. Phan Trong Nhan Secretary Approval of the Chairperson of the Master’s Thesis Committee and Dean of Faculty of Computer Science and Engineering after the thesis being corrected (If any). CHAIRPERSON OF DEAN OF FACULTY OF THESIS COMMITTEE COMPUTER SCIENCE AND ENGINEERING VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY SOCIALIST REPUBLIC OF VIETNAM HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY Independence – Freedom - Happiness THE TASK SHEET OF MASTER’S THESIS Full name: Nguyen Vinh Khiem Student ID: 2270162 Date of birth: 11/05/1997 Place of birth: Ho Chi Minh Major: Computer Science Major ID: 8480101 I.
THESIS TITLE (in English): Application of large language models in Text-to-SQL II. THESIS TITLE (in Vietnamese): Ứng dụng mô hình ngôn ngữ lớn trong việc tạo câu truy vấn III. TASKS AND CONTENTS: a. Research and design a model capable of generating SQL queries from text.
Implement, test and evaluate model. THESIS START DAY: 15/01/2024 V. THESIS COMPLETION DAY: 20/05/2024 VI. Huynh Tuong Nguyen 2.
Quan Thanh Tho Ho Chi Minh City, date 05/08/2024 SUPERVISOR SUPERVISOR CHAIRMAN OF PROGRAM (Full name and signature) (Full name and signature) COMMITTEE (Full name and signature) DEAN OF FACULTY OF COMPUTER SCIENCE AND ENGINEERING (Full name and signature) i VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY SOCIALIST REPUBLIC OF VIETNAM HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY Independence – Freedom - Happiness ACKNOWLEDGEMENTS This thesis could not have been completed without significant support from various individuals and groups. I am profoundly grateful to my primary advisors, Assoc. Quan Thanh Tho and Assoc. Huynh Tuong Nguyen, who has been a constant source of guidance, providing necessary resources and assistance throughout my research, and offering support whenever I faced challenges.
I wish to express my profound gratitude to the esteemed professors and lecturers of the Department of Computer Science and Engineering, and the Ho Chi Minh City University of Technology at large. The knowledge they imparted is priceless and has been instrumental in the completion of this thesis. I am also thankful to my colleagues at GiaoHangNhanh Company for granting me the chance to engage deeply in research and improve my professional expertise, alongside providing resources essential for training my models. Lastly, I owe a deep gratitude to my family, friends and classmate, all of whom have been supportive, encouraging, and provided the emotional and physical support needed to complete this thesis.
With heartfelt gratitude, I wish good health and all the best to the professors and lecturers of the Department of Computer Science and Engineering at the Ho Chi Minh City University of Technology, National University of Ho Chi Minh City. ii VIETNAM NATIONAL UNIVERSITY - HO CHI MINH CITY SOCIALIST REPUBLIC OF VIETNAM HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY Independence – Freedom - Happiness ABSTRACT The rapid advancements in natural language processing (NLP) have been significantly driven by large language models (LLMs), which have demonstrated impressive capabilities in understanding and generating human-like text. This thesis explores the application of LLMs, specifically the Flan-T5 model, in the context of the Text-to-SQL task, which aims to translate natural language queries into structured SQL commands. This translation is crucial for enhancing data accessibility, allowing users without SQL expertise to interact with relational databases effectively.
The proposed solution utilizes a two-tier architecture comprising a generator and a ranker model. The generator, based on the Flan-T5 model, generates multiple SQL query candidates from natural language inputs.