vpm238 commited on
Commit
4733274
·
verified ·
1 Parent(s): 34668d2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md CHANGED
@@ -29,6 +29,81 @@ The general SQL queries are the SQL subset from [The Stack](https://huggingface.
29
 
30
  We evaluate our models on two text-to-SQL benchmarks: Spider and GeoQuery.
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ## Training Procedure
33
 
34
  NSQL was trained using cross-entropy loss to maximize the likelihood of sequential inputs. For finetuning on text-to-SQL pairs, we only compute the loss over the SQL portion of the pair. The model is trained using 80GB A100s, leveraging data and model parallelism. We pre-trained for 3 epochs and fine-tuned for 10 epochs.
 
29
 
30
  We evaluate our models on two text-to-SQL benchmarks: Spider and GeoQuery.
31
 
32
+ ## Evaluation Results
33
+
34
+ We evaluate our models on two text-to-SQL benchmarks: Spider and GeoQuery.
35
+
36
+ ### Spider Benchmark (Text-to-SQL Standard Evaluation)
37
+
38
+ NSQL-llama-2-7B was evaluated on the Spider benchmark, the standard academic evaluation for Text-to-SQL systems.
39
+
40
+ #### Overall Performance
41
+
42
+ | Model | Size | Execution Accuracy | Matching Accuracy |
43
+ |-------|------|-------------------|-------------------|
44
+ | **NSQL-llama-2-7B** | 7B | 75.0% | **66.3%** |
45
+ | GPT-4 | ~1.8T | 76.2% | 41.9% |
46
+ | GPT-3.5 Chat | — | 72.8% | 44.2% |
47
+ | Llama-2-7B (base) | 7B | 29.1% | 19.3% |
48
+ | Llama-2-70B | 70B | 61.5% | 35.4% |
49
+
50
+ #### Performance by Query Complexity
51
+
52
+ | Query Type | NSQL-llama-2-7B | GPT-4 | NSQL Advantage |
53
+ |------------|-----------------|-------|----------------|
54
+ | **Join Queries** | **53.7%** | ~37.6% | **+43% relative** |
55
+ | **Nested Queries** | **57.2%** | ~37.1% | **+54% relative** |
56
+ | Simple Queries | 91.4% | Higher | GPT-4 advantage |
57
+
58
+ #### Key Findings
59
+
60
+ 1. **Complex Query Performance:** NSQL-llama-2-7B significantly outperforms GPT-4 on complex queries:
61
+ - +43% improvement on Join queries
62
+ - +54% improvement on Nested queries
63
+
64
+ 2. **Matching Accuracy:** NSQL achieves 66.3% matching accuracy vs. GPT-4's 41.9% (+24.4 points), indicating more structurally correct SQL generation.
65
+
66
+ 3. **Efficiency:** NSQL achieves near-parity with GPT-4 on overall execution (75.0% vs 76.2%) while being ~250× smaller.
67
+
68
+ 4. **Local Deployment:** The 7B parameter size enables local deployment on commodity hardware, preserving data privacy.
69
+
70
+ #### Why This Matters
71
+
72
+ GPT-4 achieves marginally higher overall execution accuracy primarily through superior performance on simple single-table queries. However, enterprise SQL workloads typically involve:
73
+ - Multiple table joins
74
+ - Nested subqueries
75
+ - Complex business logic
76
+
77
+ On these complex query types, NSQL substantially outperforms GPT-4 while enabling privacy-preserving local deployment.
78
+
79
+ ### GeoQuery Benchmark
80
+
81
+ | Model | Size | Execution Accuracy | Matching Accuracy |
82
+ |-------|------|-------------------|-------------------|
83
+ | NSQL-llama-2-7B | 7B | 26.5% | 30.4% |
84
+ | GPT-4 | ~1.8T | 55.1% | 39.1% |
85
+
86
+ *Note: GeoQuery is a narrower benchmark; Spider is the primary industry standard for Text-to-SQL evaluation.*
87
+
88
+ ### NSQL Model Family Comparison
89
+
90
+ | Model | Size | Spider Exec | Spider Match |
91
+ |-------|------|-------------|--------------|
92
+ | NSQL-350M | 350M | 51.7% | 45.6% |
93
+ | NSQL-2B | 2B | 59.3% | 53.2% |
94
+ | NSQL-6B | 6B | 63.6% | 57.4% |
95
+ | **NSQL-llama-2-7B** | **7B** | **75.0%** | **66.3%** |
96
+
97
+ ---
98
+
99
+ ## Evaluation Methodology
100
+
101
+ - **Benchmark:** Spider (Yu et al., 2018)
102
+ - **Metric - Execution Accuracy:** Percentage of queries returning correct results
103
+ - **Metric - Matching Accuracy:** Percentage of queries structurally matching ground truth
104
+ - **Query Type Breakdown:** Join, Nested, Simple categories per Spider schema
105
+
106
+
107
  ## Training Procedure
108
 
109
  NSQL was trained using cross-entropy loss to maximize the likelihood of sequential inputs. For finetuning on text-to-SQL pairs, we only compute the loss over the SQL portion of the pair. The model is trained using 80GB A100s, leveraging data and model parallelism. We pre-trained for 3 epochs and fine-tuned for 10 epochs.