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