## 3 Model Design and Implementation
### Pre-Processing
Using Python to express complex logic, such as medical diagnosis paths, legal case reasoning, etc., and then converting it to SQL to achieve efficient queries and data operations can simplify multi-source data integration and support personalized analysis and decision-making. At the same time, the rich Python library can meet the industry's specific needs and promote intelligent upgrades. Financial applications based on LLM may face bias risks and compliance issues. For example, the model may inherit biases in the training data, leading to unfair decisions in credit approval, risk assessment, etc. In addition, the generated content may conflict with financial regulations or fail to meet regulatory requirements. To address these challenges, it is necessary to strengthen data review, introduce bias correction mechanisms, and combine strict model output monitoring and compliance audits to ensure fairness and legality while protecting customer rights and reducing legal and reputational risks. In order to comply with GDPR or financial data privacy laws, LLM should embed privacy protection mechanisms such as data minimization, de-identification, and encryption technologies to ensure that user data is not abused during training and inference. Model development must follow privacy design principles and conduct regular compliance audits and risk assessments. In addition, access control and output filtering can be set to prevent the generation of sensitive information. Transparent explanations of model behavior and user data permission management are crucial to meeting regulatory requirements and enhancing user trust. ## 5 Conclusions

This paper thoroughly analyzes previous advancements and challenges in NL2 SQL, considers the unique characteristics of the financial industry, and proposes a tailored NL2 SQL approach specifically designed for this sector on the edge-cloud computing platform. Based on the inherent structure of large models, an innovative two-step method is introduced: first, converting natural language to Python, then translating Python to SQL. Accuracy is further enhanced by iteratively optimizing database semantics and supplementing knowledge. Utilizing the open-source DeepSeek model, along with the unique features of Python and SQL, and making full use of prompt engineering, various modes were designed and iteratively refined, achieving significant improvements in NL2 SQL accuracy. Specifically, EX improved by at least 2.73%, F1 by at least 3.72%, and VES by 6.34% over existing methods, ultimately achieving strong business performance. However, given the high demands of the financial industry, current accuracy levels are still slightly insufficient, indicating the need for further optimization. During experimentation, it was also observed that the industry's high level of expertise and extensive corpus could significantly benefit NL2 SQL accuracy through continued corpus expansion and the creation of industry-specific datasets, areas for future work to further refine and enhance performance. Although the NL2 PY2 SQL method performs well in natural language to SQL conversion, it still has some limitations, especially regarding scalability and applicability. First, the NL2 PY2 SQL method relies on Python intermediate representation, which may make it face performance bottlenecks when processing complex or diverse queries. For large databases and highly dynamic query scenarios, the intermediate representation generated by Python may not fully capture complex grammatical structures or data dependencies, resulting in limited optimization space. In addition, the current method may have difficulty adapting to unstructured natural language input, especially queries containing fuzzy and ambiguous content. Future research can focus on improving the method's scalability, such as by optimizing Python intermediate representation generation and more accurate SQLsyntax mapping, especially in complex SQL scenarios such as multi-table joins and nested queries.