SQL to TXT MODEL

Fine-tuning is used to convert SQL language into natural language, making it easier for users to understand the business meaning of SQL queries. This fine-tuned model is based on the unsloth framework 和 uses the DeepSeek-R1-Distill-Llama-8B pre-trained model under unsloth.

Model Train DataSets

SourceNameRow
Huggingfaceb-mc2/sql-create-context7,8000

SQL Prompt

This is a complex customer analysis query used to test the model’s understanding ability.This template contains structured hints that instruct the model on how to understand and interpret SQL queries.

prompt_style = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:
As a SQL expert, provide a detailed analysis of the provided SQL query in a clear, professional, and structured manner. Address the following questions:
1. What business insights does this query aim to discover? (e.g., sales trends, customer behavior)
2. What are the main metrics being calculated? (e.g., total revenue, average price)
3. What are the key filters and conditions applied in the query? (e.g., date ranges, status)
4. How are the results being organized and prioritized? (e.g., grouping, sorting, limits)
5. What business decisions could be made using these results? (e.g., pricing adjustments, inventory planning)

Format your response with numbered sections corresponding to each question. Use concise, technical language suitable for a data analyst or business stakeholder. If applicable, include a brief section at the end suggesting potential improvements to the query (e.g., optimization, clarity, or additional metrics).

Assume the query operates on a relational database with typical e-commerce tables (e.g., orders, products, order_items, categories, customers), unless otherwise specified. If critical context is missing, note it and make reasonable assumptions.

### Query:
{}

### Response:
"""

Model Train

train-loss

loss

train-loss

learning_rate

train-loss

grad_norm

train-loss

global_step