## 3 Model Design and Implementation
### Pre-Processing
\begin{table}
\begin{tabular}{l c c c c} \hline \hline
**NL2 SQL Model** & **Simple VES** & **Moderate VES** & **Challenging VES** & **Total VES** \\ \hline NL2 PY2 SQL & 73.00\% & 54.84\% & 52.23\% & 65.54\% \\ \hline SuperSQL & 67.13\% & 47.24\% & 46.86\% & 59.20\% \\ \hline SFT\_Code5\_15B\_EK & 66.17\% & 46.38\% & 47.97\% & 58.46\% \\ \hline SFT\_Code5\_7B\_EK & 64.70\% & 44.78\% & 55.83\% & 57.84\% \\ \hline SFT\_Code5\_3B\_EK & 63.45\% & 47.57\% & 36.05\% & 56.05\% \\ \hline DAILSQL\_SC & 64.31\% & 42.13\% & 44.55\% & 55.73\% \\ \hline DAILSQL & 63.63\% & 39.32\% & 37.73\% & 53.83\% \\ \hline SFT\_Code5\_1B\_EK & 58.94\% & 36.28\% & 33.91\% & 49.72\% \\ \hline C3\_SQL & 58.13\% & 36.11\% & 28.83\% & 48.70\% \\ \hline RESDSQL\_3B\_EK & 50.91\% & 32.12\% & 27.35\% & 43.00\% \\ \hline RESDSQL\_Large\_EK & 44.82\% & 25.10\% & 29.73\% & 37.43\% \\ \hline RESDSQL\_Base\_EK & 39.51\% & 18.91\% & 14.16\% & 30.88\% \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Comparison of VES prediction results, compared with 11 NL2 SQL models on Challenging, Moderate, and Simple datasets. Overall, the FI-NL2 PY2 SQL VES comparison results are significantly better than those of other models. As can be seen from Table 6, the EX, F1, and VES indicators of NL2 PY2 SQL and other compared models, P value of Ex, P Value of F1, and P Value of VES. P values for pairwise statistical significance tests of NL2 PY2 SQL relative to the following models. Except that the P value of EX between NL2 PY2 SQL and SUPERSQL did not reach below 0.05, other indicators all reached below 0.05, indicating that NL2 PY2 SQL exceeds the indicators of different models under specific indicators and is statistically significant. #### 4.2.5 Error Analysis

In the NL2 SQL experiment using the BIRD dataset, the errors mainly focused on entity recognition, join operations, and processing complex conditions. First, entity recognition errors occurred frequently, especially when the query involved multiple tables and columns. Many column names and table names in the BIRD dataset have similarities or synonyms, and the model sometimes fails to correctly identify these entities, resulting in references to the wrong table or column, thereby generating invalid SQL queries. For example, the user query may mention \"total sales\", but the model may incorrectly map it to \"sales quantity\", resulting in logical misunderstanding. Second, joint operation errors are also a common problem. There are complex relationships between the tables in the BIRD dataset. When the model generates SQL queries for multi-table joins, it sometimes fails to correctly understand the association conditions between the tables, resulting in the generated query omitting the necessary join conditions, leading to Cartesian products or incorrect dataset results. In addition, the model's processing of complex nested queries is also insufficient. When the user's natural language query contains nested conditions, the subquery structure generated by the model sometimes has errors, resulting in the inability to execute the SQL query or the results not being different. Finally, the errors of entity recognition and complex joins were solved using the NL2 PY and then the PY2 SQL method. First, the natural language was converted into highly readable Python code to clarify the logic, and then the Python code was converted into SQL queries. This gradual conversion reduced ambiguity and ensured that the model had clear context and logical relationships when understanding and generating SQL, especially in processing multi-table joins and nested conditions.