Dergiler / Gazi Üniversitesi Mühendislik Mimarlık Fakültesi Dergisi / 2026 / Cilt: 41 Sayı: 2

Yapılandırılmış sorgu dilinde sorgu üretimi için erişim destekli üretim ve erişim destekli uyarlama yöntemlerinin karşılaştırmalı değerlendirmesi

A comparative evaluation of retrieval-augmented generation and retrieval-augmented fine-tuning methods for SQL query generation

Metin Bilgin(Bursa Uludağ Üniversitesi)0000-0002-4216-0542
Mehmet Bozdemir(Bursa Uludağ Üniversitesi)0000-0003-1467-6047
Sayfa
11273–1288
Yayın Tarihi
2026-07-20
🏛️Bu makalenin bibliyografik verileri ve tam metin bağlantısı DergiPark üzerinden sağlanmıştır.
DergiPark Kaydı ↗
✨

Yapay Zeka Hızlı Bakış & Çıkarımlar

AI Insight
⚡ TL;DR(1 Cümlede Hızlı Çıkarım)

Sonuçlar, RAFT yaklaşımı ile eğitilen GPT-4o modelinin %80 EX skoru, %92 tablo benzerliği ve %89 SQL benzerliği ile en yüksek başarıyı sağladığını; Gemini-1.5 modelinin ise %81 EX skoru ve %90+ yapısal benzerlik ile benzer düzeyde bir performans sergilediğini göstermektedir.

📌 3 Maddede Bu Makale

🎯
Amaç & Hipotez:Doğal dilden veri tabanı sorgusu yapmak, insanların teknik bilgi olmadan verilerle kolayca çalışabilmesini sağlar ve bilgiye ulaşma şeklini önemli ölçüde değiştirir.
📊
Temel Bulgular & Veri:Bu bağlamda, büyük dil modellerinin (LLM) doğal dil girdilerinden SQL sorguları üretme konusundaki yetkinlikleri giderek daha fazla ilgi çekmektedir.
💡
Sonuç & Katkı:Sonuçlar, RAFT yaklaşımı ile eğitilen GPT-4o modelinin %80 EX skoru, %92 tablo benzerliği ve %89 SQL benzerliği ile en yüksek başarıyı sağladığını; Gemini-1.5 modelinin ise %81 EX skoru ve %90+ yapısal benzerlik ile benzer düzeyde bir performans sergilediğini göstermektedir.
🔬Tür:Modelleme & Sayısal Simülasyon
📍Kapsam:Genişletilmiş Akademik Örneklem
⚙️Değişkenler:RAG · RAFT · SQL

Özet

Doğal dilden veri tabanı sorgusu yapmak, insanların teknik bilgi olmadan verilerle kolayca çalışabilmesini sağlar ve bilgiye ulaşma şeklini önemli ölçüde değiştirir. Bu bağlamda, büyük dil modellerinin (LLM) doğal dil girdilerinden SQL sorguları üretme konusundaki yetkinlikleri giderek daha fazla ilgi çekmektedir. Bu çalışmada, LLM’lerin bu görevdeki başarımı, geleneksel RAG (Retrieval-Augmented Generation) yaklaşımı ile RAFT (Retrieval-Augmented Fine-Tuning) yöntemi kullanılarak karşılaştırmalı olarak analiz edilmiştir. GPT-4o, Gemini-1.5-flash-001 ve Qwen2.5-14B-Instruct modelleri RAFT yöntemiyle ince ayar işlemine tabi tutulmuş; ardından her bir model, 1 ila 4 şemalı veritabanları üzerinde toplam 1.006 SQL sorgusu ile test edilmiştir. Model performansları, Exact Match (EX) skorları ile birlikte Tablo Benzerliği ve SQL Benzerliği ölçütleri üzerinden değerlendirilmiştir. Sonuçlar, RAFT yaklaşımı ile eğitilen GPT-4o modelinin %80 EX skoru, %92 tablo benzerliği ve %89 SQL benzerliği ile en yüksek başarıyı sağladığını; Gemini-1.5 modelinin ise %81 EX skoru ve %90+ yapısal benzerlik ile benzer düzeyde bir performans sergilediğini göstermektedir. Qwen2.5-14B modelinin EX skoru ise %63’te kalmıştır. Ayrıca, tüm modellerin RAFT ile eğitilmiş sürümleri, RAG temelli versiyonlarına kıyasla daha yüksek EX skoru elde etmiştir. Bu sonuçlar, RAFT yönteminin yalnızca bağlamsal doğruluğu değil, aynı zamanda yapısal tutarlılığı da güçlendiren etkili bir strateji olduğunu ortaya koymaktadır.

Abstract

Natural language database querying enables people to easily work with data without technical knowledge and dramatically changes the way information is accessed. In this context, the ability of large language models (LLMs) to generate SQL queries from natural language input is of increasing interest. In this work, the performance of LLMs in this task is analyzed comparatively using the traditional RAG (Retrieval-Augmented Generation) approach and the RAFT (Retrieval-Augmented Fine-Tuning) method. The GPT-4o, Gemini-1.5-pro-001 and Qwen2.5-14B-Instruct-bnb-4bit models were fine-tuned using the RAFT method and then each model was tested with a total of 1,006 SQL queries on databases with 1 to 4 schemas. Model performances were evaluated on Exact Match (EX) scores as well as Table Similarity and SQL Similarity measures. The results show that the GPT-4o model trained with the RAFT approach achieves the highest performance with an EX-score of 80%, 92% table similarity and 89% SQL similarity, while the Gemini-1.5-pro-001 model performs at a similar level with an EX-score of 81% and 90%+ structural similarity. The EX-score of the Qwen2.5-14B-Instruct-bnb-4bit model remained at 63%. Moreover, the RAFT-trained versions of all models achieved higher EX scores compared to the RAG-based versions. These results suggest that RAFT is an effective strategy to improve not only contextual accuracy but also structural consistency.

🔖

Bu Makaleye Atıf Yap

Bilgin, M., Bozdemir, M. (2026). Yapılandırılmış sorgu dilinde sorgu üretimi için erişim destekli üretim ve erişim destekli uyarlama yöntemlerinin karşılaştırmalı değerlendirmesi. Gazi Üniversitesi Mühendislik Mimarlık Fakültesi Dergisi, Cilt: 41 Sayı: 2, 11273–1288. https://doi.org/10.17341/gazimmfd.1796962

📄 Tam Metin PDF Okuyucu

↗Yeni Sekme

PDF belgesi yükleniyor...

Kaynakça (33)

  1. 1. Minaee S., Mikolov T., Nikzad N., Chenaghlu M., Socher R., Amatriain X., Gao J., Large language models: A survey, arXiv preprint arXiv:2402.06196, 2024.
  2. 2. Vaswani A., Shazeer N., Parmar N., Uszkoreit J., Jones L., Gomez A.N., Kaiser L., Polosukhin I., Attention is all you need, Advances in Neural Information Processing Systems, 30, 5999-6009, 2017.
  3. 3. Naveed H., Khan A.U., Qiu S., Saqib M., Anwar S., Usman M., Akhtar N., Barnes N., Mian A., A comprehensive overview of large language models, arXiv preprint arXiv:2307.06435, 2023.
  4. 4. OpenAI, Achiam J., Adler S., Agarwal S., Ahmad L. vd., GPT-4 technical report, arXiv preprint arXiv:2303.08774, 2023.
  5. 5. Güven Z.A., Large-scale impact analysis on large language models for Turkish question-answering, Journal of the Faculty of Engineering and Architecture of Gazi University, 40 (3), 1787-1796, 2025.
  6. 6. Gao Y., Xiong Y., Gao X., Jia K., Pan J., Bi Y., Dai Y., Sun J., Wang M., Wang H., Retrieval-augmented generation for large language models: A survey, arXiv preprint arXiv:2312.10997, 2023.
  7. 7. Lewis P., Perez E., Piktus A., Petroni F., Karpukhin V., Goyal N., Küttler H., Lewis M., Yih W., Rocktäschel T., Riedel S., Kiela D., Retrieval-augmented generation for knowledge-intensive NLP tasks, Advances in Neural Information Processing Systems, 33, 9459-9474, 2020.
  8. 8. Wang M., Shafran I., Soltau H., Han W., Cao Y., Yu D., El Shafey L., Retrieval augmented end-to-end spoken dialog models, IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Seoul, Güney Kore, 12056-12060, 14-19 Nisan, 2024.
  9. 9. Öztürk S., Atmaca H.E., İlişkisel ve ilişkisel olmayan (NoSQL) veri tabanı sistemleri mimari performansının yönetim bilişim sistemleri kapsamında incelenmesi, Bilişim Teknol. Derg., 10 (2), 199-212, 2017.
  10. 10. Chamberlin D.D., Boyce R.F., SEQUEL: A structured English query language, Proceedings of the 1974 ACM SIGFIDET Workshop on Data Description, Access and Control, Ann Arbor, Michigan, ABD, 249-264, 1974.
  11. 11. Darwen H., SQL: A Comparative Survey, Bookboon.com, 2014.
  12. 12. Li Y., Manoharan S., A performance comparison of SQL and NoSQL databases, IEEE Pacific Rim Conference on Communications, Computers and Signal Processing (PACRIM), Victoria, BC, Kanada, 15-19, 2013.
  13. 13. Han Y., Liu C., Wang P., A comprehensive survey on vector database: Storage and retrieval technique, challenge, arXiv preprint arXiv:2310.11703, 2023.
  14. 14. Dong X., Zhang C., Ge Y., Mao Y., Gao Y., Chen L., Lin J., Lou D., C3: Zero-shot text-to-SQL with ChatGPT, arXiv preprint arXiv:2307.07306, 2023.
  15. 15. Li Z., Wang X., Zhao J., Yang S., Du G., Hu X., Zhang B., Ye Y., Li Z., Zhao R., Mao H., PET-SQL: A prompt-enhanced two-round refinement of text-to-SQL with cross-consistency, arXiv preprint arXiv:2403.09732, 2024.
  16. 16. Pourreza M., Rafiei D., DIN-SQL: Decomposed in-context learning of text-to-SQL with self-correction, Advances in Neural Information Processing Systems, 36, 2023.
  17. 17. Mai C., Tal R., Mohamed T., Learning metadata-agnostic representations for text-to-SQL in-context example selection, arXiv preprint arXiv:2410.14049, 2024.
  18. 18. Li H., Zhang J., Li C., Chen H., RESDSQL: Decoupling schema linking and skeleton parsing for text-to-SQL, Proceedings of the AAAI Conference on Artificial Intelligence, 37 (11), 13067-13075, 2023.
  19. 19. Gao D., Wang H., Li Y., Sun X., Qian Y., Ding B., Zhou J., Text-to-SQL empowered by large language models: A benchmark evaluation, arXiv preprint arXiv:2308.15363, 2023.
  20. 20. Gao Y., Liu Y., Li X., Shi X., Zhu Y., Wang Y., Li S., Li W., Hong Y., Luo Z., Gao J., Mou L., Li Y., A preview of XiYan-SQL: A multi-generator ensemble framework for text-to-SQL, arXiv preprint arXiv:2411.08599, 2025.
  21. 21. Zhu X., Li Q., Cui L., Liu Y., Large language model enhanced text-to-SQL generation: A survey, arXiv preprint arXiv:2410.06011, 2024.
  22. 22. Rossiello G., Pham N., Glass M., Lee J., Subramanian D., Rationalization models for text-to-SQL, arXiv preprint arXiv:2502.06759, 2025.
  23. 23. Kanburoğlu A.B., Tek F.B., TUR2SQL: A cross-domain Turkish dataset for text-to-SQL, 8th International Conference on Computer Science and Engineering (UBMK), Antalya, Türkiye, 206-211, 2023.
  24. 24. Kanburoğlu A.B., Tek F.B., Text-to-SQL: A methodical review of challenges and models, Turk. J. Electr. Eng. Comput. Sci., 32 (3), 403-419, 2024.
  25. 25. Demirkiran F., Coşkun A.K., Kömeçoğlu Y., Kömeçoğlu B.B., Güven R., Enhancing text-to-SQL conversion in Turkish: An analysis of LLMs with schema context, 9th International Conference on Computer Science and Engineering (UBMK), Antalya, Türkiye, 1-5, 2024.
  26. 26. Kanburoglu A.B., Tek F.B., TURSpider: A Turkish text-to-SQL dataset and LLM-based study, IEEE Access, 12, 169379-169387, 2024.
  27. 27. Li J., Hui B., Qu G., Yang J., Li B., Li B., Wang B., Qin B., Cao R., Geng R., Huo N., Zhou X., Ma C., Li G., Chang K.C.C., Huang F., Cheng R., Li Y., Can LLM already serve as a database interface? A big bench for large-scale database grounded text-to-SQLs, arXiv preprint arXiv:2305.03111, 2023.
  28. 28. Yu T., Zhang R., Yang K., Yasunaga M., Wang D., Li Z., Ma J., Li I., Yao Q., Roman S., Zhang Z., Radev D.R., Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-SQL task, Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), Brussels, Belçika, 3911-3921, 2018.
  29. 29. Zhang T., Patil S.G., Jain N., Shen S., Zaharia M., Stoica I., Gonzalez J.E., RAFT: Adapting language model to domain specific RAG, arXiv preprint arXiv:2403.10131, 2024.
  30. 30. Yang H., Zhang M., Wei D., SRAG: Speech retrieval augmented generation for spoken language understanding, 6th International Seminar on Research of Information Technology and Intelligent Systems (ISRITI), 279-283, 2023.
  31. 31. Oh S., Evaluating mathematical problem-solving abilities of generative AI models: Performance analysis of ChatGPT 4o1 and ChatGPT 4o using the Korean College Scholastic Ability Test, IEEE Access, 13, 1123-1135, 2024.
  32. 32. Gemini Team, Georgiev P., Lei V.I., Burnell R., Bai L., Gulati A. vd., Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context, arXiv preprint arXiv:2403.05530, 2024.
  33. 33. Qwen, Yang A., Yang B., Zhang B., Hui B., Zheng B., Yu B. vd., Qwen2.5 technical report, arXiv preprint arXiv:2412.15115, 202.