Beyond Standard Losses: Redefining Text-to-SQL with Task-Specific Optimization

Đã lưu trong:
Chi tiết về thư mục
Xuất bản năm:Mathematics vol. 13, no. 14 (2025), p. 2315-2338
Tác giả chính: Azurmendi Iker
Tác giả khác: Ekaitz, Zulueta, García, Gustavo, Uriarte-Arrazola Nekane, Lopez-Guede, Jose Manuel
Được phát hành:
MDPI AG
Những chủ đề:
Truy cập trực tuyến:Citation/Abstract
Full Text + Graphics
Full Text - PDF
Các nhãn: Thêm thẻ
Không có thẻ, Là người đầu tiên thẻ bản ghi này!
Miêu tả
Bài tóm tắt:In recent years, large language models (LLMs) have shown an impressive ability in translating text to SQL queries. However, in real-world applications, standard loss functions frequently fail to capture the complexity of queries adequately. Therefore, in this study, a dynamic loss function is proposed, which assigns different weights to specific groups of tokens, such as SQL keywords or table names. The objective is to guide the model during training to facilitate the mastery of more fundamental concepts within the SQL. Our custom loss function is composed of four components: cross-entropy with sequence matching loss, focal loss, F-beta loss, and contrastive sequence loss. During the training process, the weights of each component of the loss function are dynamically adjusted to prioritize different aspects of query generation at the appropriate stage. This approach avoids computationally expensive approaches such as SQL validation or detokenization, which improves the efficiency of the learning process compared to alternative methods. We empirically tested this method on several open source LLMs with less than 2 billion parameters, using a customized real vehicle diagnostic dataset. The findings demonstrate that the employment of our dynamic loss function can enhance SQL execution accuracy by up to 20% in comparison with standard cross-entropy loss. It has been demonstrated that customized loss functions for specific tasks can improve the efficiency of LLMs without extending the model or acquiring additional labelled data. The proposed technique is also scalable and adaptable to new domains or more complex weighting schemes, highlighting the importance of custom design of loss functions in real world applications.
số ISSN:2227-7390
DOI:10.3390/math13142315
Nguồn:Engineering Index