Datasets:
Reetu Raj Harsh
commited on
Upload Text2SQL dataset with 34 SQLite databases and metadata files
Browse files- .gitattributes +11 -0
- README.md +421 -0
- finch_dataset.json +3 -0
- tables.json +0 -0
- text2sql-db/text2sql/bird/bird.sqlite +0 -0
- text2sql-db/text2sql/bird/debit_card_specializing.sqlite +3 -0
- text2sql-db/text2sql/bird/financial.sqlite +3 -0
- text2sql-db/text2sql/bird/regional_sales.sqlite +3 -0
- text2sql-db/text2sql/bird/retail_world.sqlite +0 -0
- text2sql-db/text2sql/bird/retails.sqlite +3 -0
- text2sql-db/text2sql/bird/sales.sqlite +3 -0
- text2sql-db/text2sql/bird/sales_in_weather.sqlite +3 -0
- text2sql-db/text2sql/book_sql/accounting.sqlite +3 -0
- text2sql-db/text2sql/bull/ccks_fund/ccks_fund.sqlite +3 -0
- text2sql-db/text2sql/bull/ccks_macro/ccks_macro.sqlite +3 -0
- text2sql-db/text2sql/bull/ccks_stock/ccks_stock.sqlite +3 -0
- text2sql-db/text2sql/spider/apartment_rentals/apartment_rentals.sqlite +0 -0
- text2sql-db/text2sql/spider/coffee_shop/coffee_shop.sqlite +0 -0
- text2sql-db/text2sql/spider/customer_deliveries/customer_deliveries.sqlite +0 -0
- text2sql-db/text2sql/spider/customers_and_invoices/customers_and_invoices.sqlite +0 -0
- text2sql-db/text2sql/spider/customers_and_orders/customers_and_orders.sqlite +0 -0
- text2sql-db/text2sql/spider/customers_campaigns_ecommerce/customers_campaigns_ecommerce.sqlite +0 -0
- text2sql-db/text2sql/spider/customers_card_transactions/customers_card_transactions.sqlite +0 -0
- text2sql-db/text2sql/spider/department_store/department_store.sqlite +0 -0
- text2sql-db/text2sql/spider/e_commerce/e_commerce.sqlite +0 -0
- text2sql-db/text2sql/spider/insurance_and_eClaims/insurance_and_eClaims.sqlite +0 -0
- text2sql-db/text2sql/spider/insurance_fnol/insurance_fnol.sqlite +0 -0
- text2sql-db/text2sql/spider/insurance_policies/insurance_policies.sqlite +0 -0
- text2sql-db/text2sql/spider/loan_1/loan_1.sqlite +0 -0
- text2sql-db/text2sql/spider/real_estate_properties/real_estate_properties.sqlite +0 -0
- text2sql-db/text2sql/spider/real_estate_rentals/real_estate_rentals.sqlite +0 -0
- text2sql-db/text2sql/spider/restaurant_1/restaurant_1.sqlite +0 -0
- text2sql-db/text2sql/spider/restaurant_bills/restaurant_bills.sqlite +0 -0
- text2sql-db/text2sql/spider/school_finance/school_finance.sqlite +0 -0
- text2sql-db/text2sql/spider/shop_membership/shop_membership.sqlite +0 -0
- text2sql-db/text2sql/spider/small_bank_1/small_bank_1.sqlite +0 -0
- text2sql-db/text2sql/spider/tracking_orders/tracking_orders.sqlite +0 -0
- text2sql-db/text2sql/spider/tracking_share_transactions/tracking_share_transactions.sqlite +0 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,14 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
finch_dataset.json filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
text2sql-db/text2sql/bird/debit_card_specializing.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
text2sql-db/text2sql/bird/financial.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
text2sql-db/text2sql/bird/regional_sales.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 64 |
+
text2sql-db/text2sql/bird/retails.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 65 |
+
text2sql-db/text2sql/bird/sales.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 66 |
+
text2sql-db/text2sql/bird/sales_in_weather.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 67 |
+
text2sql-db/text2sql/book_sql/accounting.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 68 |
+
text2sql-db/text2sql/bull/ccks_fund/ccks_fund.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
text2sql-db/text2sql/bull/ccks_macro/ccks_macro.sqlite filter=lfs diff=lfs merge=lfs -text
|
| 70 |
+
text2sql-db/text2sql/bull/ccks_stock/ccks_stock.sqlite filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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 |
+
- semantic-parsing
|
| 16 |
+
- nlp
|
| 17 |
+
- sqlite
|
| 18 |
+
- database-schemas
|
| 19 |
+
- finance
|
| 20 |
+
pretty_name: FINCH - Financial Intelligence using Natural language for Contextualized SQL Handling
|
| 21 |
+
size_categories:
|
| 22 |
+
- 10K<n<100K
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# Dataset Card for FINCH - Financial Intelligence using Natural language for Contextualized SQL Handling
|
| 26 |
+
|
| 27 |
+
A comprehensive collection of SQLite databases from the FINCH benchmark, containing **33 databases** with **292 tables** and **75,725 natural language-SQL pairs** across diverse financial domains for Text-to-SQL research and development.
|
| 28 |
+
|
| 29 |
+
## Dataset Details
|
| 30 |
+
|
| 31 |
+
### Dataset Description
|
| 32 |
+
|
| 33 |
+
**Curated by:** [Domyn](https://www.domyn.com/)
|
| 34 |
+
**Authors:** Avinash Kumar Singh, Bhaskarjit Sarmah, Stefano Pasquali
|
| 35 |
+
**Language(s):** English
|
| 36 |
+
**License:** CC-BY-NC-4.0
|
| 37 |
+
|
| 38 |
+
FINCH (Financial Intelligence using Natural language for Contextualized SQL Handling) provides SQLite database files from a carefully curated financial Text-to-SQL benchmark that consolidates and extends existing resources into a unified, finance-specific dataset. Each database preserves original schema structure, relationships, and data while focusing specifically on financial domains and applications.
|
| 39 |
+
|
| 40 |
+
This dataset addresses a critical gap in Text-to-SQL research: despite significant progress in general-domain benchmarks, financial applications remain especially challenging due to complex schemas, domain-specific terminology, and high stakes of error. FINCH provides the first large-scale, finance-oriented Text-to-SQL benchmark suitable for both evaluation and fine-tuning.
|
| 41 |
+
|
| 42 |
+
### Dataset Sources
|
| 43 |
+
|
| 44 |
+
**Paper:** FINCH: Financial Intelligence using Natural language for Contextualized SQL Handling *(coming soon)*
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
## Key Features
|
| 48 |
+
|
| 49 |
+
- **33 SQLite databases** specifically curated for financial applications
|
| 50 |
+
- **292 tables** with **2,233 columns** and **177 relations**
|
| 51 |
+
- **75,725 NL-SQL pairs** for comprehensive training and evaluation
|
| 52 |
+
- **Financial domain focus** including retail, banking, insurance, e-commerce, funds, stocks, and accounting
|
| 53 |
+
- **Direct SQLite format** - ready for SQL queries and analysis
|
| 54 |
+
- **Preserved relationships** - foreign keys and indexes intact
|
| 55 |
+
- **Multi-difficulty coverage** with easy, medium, and hard query complexity levels
|
| 56 |
+
|
| 57 |
+
## Dataset Structure
|
| 58 |
+
|
| 59 |
+
The dataset is organized by financial domain with meaningful database names:
|
| 60 |
+
|
| 61 |
+
### File Organization
|
| 62 |
+
```
|
| 63 |
+
finch/
|
| 64 |
+
├── spider/ # 22 SQLite files (financial subset from Spider)
|
| 65 |
+
├── bird/ # 7 SQLite files (financial subset from BIRD)
|
| 66 |
+
├── bull/ # 3 SQLite files (BULL/CCKS financial data)
|
| 67 |
+
└── book_sql/ # 1 SQLite file (BookSQL accounting data)
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### Financial Domains Covered
|
| 71 |
+
|
| 72 |
+
#### Retail & E-commerce
|
| 73 |
+
- **customers_and_invoices**: E-commerce customer and billing systems
|
| 74 |
+
- **e_commerce**: Online retail transactions and order management
|
| 75 |
+
- **department_store**: Retail chain operations and inventory management
|
| 76 |
+
- **shop_membership**: Customer loyalty and membership programs
|
| 77 |
+
|
| 78 |
+
#### Banking & Financial Services
|
| 79 |
+
- **financial**: Czech bank transactions and loan portfolios (1M+ records)
|
| 80 |
+
- **small_bank**: Banking account management systems
|
| 81 |
+
- **loan_1**: Loan processing and customer account data
|
| 82 |
+
|
| 83 |
+
#### Insurance & Risk Management
|
| 84 |
+
- **insurance_policies**: Insurance claims and policy management
|
| 85 |
+
- **insurance_and_eClaims**: Electronic claims processing systems
|
| 86 |
+
- **insurance_fnol**: First notification of loss handling
|
| 87 |
+
|
| 88 |
+
#### Investment & Trading
|
| 89 |
+
- **ccks_fund**: Mutual fund management and performance data
|
| 90 |
+
- **ccks_stock**: Stock market data and trading information
|
| 91 |
+
- **tracking_share_transactions**: Investment portfolio tracking
|
| 92 |
+
|
| 93 |
+
#### Sales & Marketing
|
| 94 |
+
- **sales**: Large-scale sales transactions (6M+ records)
|
| 95 |
+
- **sales_in_weather**: Sales data correlated with external factors
|
| 96 |
+
- **customers_campaigns_ecommerce**: Marketing campaign effectiveness
|
| 97 |
+
|
| 98 |
+
#### Accounting & Financial Reporting
|
| 99 |
+
- **accounting**: Complete accounting system with 185+ tables covering transactions, customers, vendors, and financial reporting
|
| 100 |
+
- **school_finance**: Educational institution financial management
|
| 101 |
+
|
| 102 |
+
## Dataset Format & Examples
|
| 103 |
+
|
| 104 |
+
### Data Files Structure
|
| 105 |
+
- **`finch_dataset.json`**: Main dataset file with 75,725 NL-SQL pairs (appears in HF dataset viewer)
|
| 106 |
+
- **`tables.json`**: Database schema metadata for all 33 databases (auxiliary file)
|
| 107 |
+
- **`text2sql-db/`**: SQLite database files organized by source (auxiliary files)
|
| 108 |
+
|
| 109 |
+
### Sample Data from finch_dataset.json
|
| 110 |
+
|
| 111 |
+
```json
|
| 112 |
+
[
|
| 113 |
+
{
|
| 114 |
+
"question_id": 1,
|
| 115 |
+
"db_id": "financial",
|
| 116 |
+
"db_name": "bird",
|
| 117 |
+
"question": "How many accounts who choose issuance after transaction are staying in East Bohemia region?",
|
| 118 |
+
"partition": "dev",
|
| 119 |
+
"difficulty": "medium",
|
| 120 |
+
"SQL": "SELECT COUNT(t2.account_id) FROM district AS t1 INNER JOIN account AS t2 ON t1.district_id = t2.district_id WHERE t1.a3 = 'east bohemia' AND t2.frequency = 'poplatek po obratu'"
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"question_id": 2,
|
| 124 |
+
"db_id": "financial",
|
| 125 |
+
"db_name": "bird",
|
| 126 |
+
"question": "How many accounts who have region in Prague are eligible for loans?",
|
| 127 |
+
"partition": "dev",
|
| 128 |
+
"difficulty": "easy",
|
| 129 |
+
"SQL": "SELECT COUNT(t1.account_id) FROM account AS t1 INNER JOIN loan AS t2 ON t1.account_id = t2.account_id INNER JOIN district AS t3 ON t1.district_id = t3.district_id WHERE t3.a3 = 'prague'"
|
| 130 |
+
},
|
| 131 |
+
{
|
| 132 |
+
"question_id": 3,
|
| 133 |
+
"db_id": "financial",
|
| 134 |
+
"db_name": "bird",
|
| 135 |
+
"question": "The average unemployment ratio of 1995 and 1996, which one has higher percentage?",
|
| 136 |
+
"partition": "dev",
|
| 137 |
+
"difficulty": "easy",
|
| 138 |
+
"SQL": "SELECT DISTINCT IIF(AVG(a13) > AVG(a12), '1996', '1995') FROM district"
|
| 139 |
+
}
|
| 140 |
+
]
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
### Schema Information (tables.json)
|
| 144 |
+
|
| 145 |
+
The `tables.json` file contains comprehensive schema metadata for all databases:
|
| 146 |
+
|
| 147 |
+
```json
|
| 148 |
+
{
|
| 149 |
+
"financial": {
|
| 150 |
+
"db_id": "financial",
|
| 151 |
+
"table_names_original": ["account", "card", "client", "disp", "district", "loan", "order", "trans"],
|
| 152 |
+
"table_names": ["account", "card", "client", "disposition", "district", "loan", "order", "transaction"],
|
| 153 |
+
"column_names_original": [
|
| 154 |
+
[-1, "*"],
|
| 155 |
+
[0, "account_id"],
|
| 156 |
+
[0, "district_id"],
|
| 157 |
+
[0, "frequency"],
|
| 158 |
+
[0, "date"]
|
| 159 |
+
],
|
| 160 |
+
"column_types": ["text", "number", "number", "text", "text"],
|
| 161 |
+
"foreign_keys": [[2, 1], [4, 2]],
|
| 162 |
+
"primary_keys": [1]
|
| 163 |
+
}
|
| 164 |
+
}
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
## Example Usage
|
| 168 |
+
|
| 169 |
+
### Loading with Python
|
| 170 |
+
|
| 171 |
+
### Primary Method: Using datasets library (Recommended)
|
| 172 |
+
|
| 173 |
+
```python
|
| 174 |
+
from datasets import load_dataset
|
| 175 |
+
from huggingface_hub import hf_hub_download
|
| 176 |
+
import sqlite3
|
| 177 |
+
|
| 178 |
+
# Load the main dataset using HuggingFace datasets library
|
| 179 |
+
dataset = load_dataset("domyn/finch")
|
| 180 |
+
print(f"Dataset: {dataset}")
|
| 181 |
+
print(f"Number of examples: {len(dataset['train'])}")
|
| 182 |
+
|
| 183 |
+
# Access individual examples
|
| 184 |
+
sample = dataset['train'][0]
|
| 185 |
+
print(f"Question: {sample['question']}")
|
| 186 |
+
print(f"SQL: {sample['SQL']}")
|
| 187 |
+
print(f"Database: {sample['db_id']}")
|
| 188 |
+
print(f"Difficulty: {sample['difficulty']}")
|
| 189 |
+
|
| 190 |
+
# Load schema information for the database
|
| 191 |
+
schema_path = hf_hub_download(repo_id="domyn/finch", filename="tables.json")
|
| 192 |
+
import json
|
| 193 |
+
with open(schema_path, 'r') as f:
|
| 194 |
+
schemas = json.load(f)
|
| 195 |
+
|
| 196 |
+
# Download the corresponding SQLite database
|
| 197 |
+
db_path = hf_hub_download(
|
| 198 |
+
repo_id="domyn/finch",
|
| 199 |
+
filename=f"text2sql-db/text2sql/bird/{sample['db_id']}.sqlite"
|
| 200 |
+
)
|
| 201 |
+
|
| 202 |
+
# Execute the SQL query on the actual database
|
| 203 |
+
conn = sqlite3.connect(db_path)
|
| 204 |
+
cursor = conn.cursor()
|
| 205 |
+
cursor.execute(sample['SQL'])
|
| 206 |
+
results = cursor.fetchall()
|
| 207 |
+
print(f"Query Results: {results}")
|
| 208 |
+
```
|
| 209 |
+
|
| 210 |
+
### Alternative Method: Direct file download
|
| 211 |
+
|
| 212 |
+
```python
|
| 213 |
+
import json
|
| 214 |
+
import sqlite3
|
| 215 |
+
from huggingface_hub import hf_hub_download
|
| 216 |
+
|
| 217 |
+
# Alternative: Load dataset JSON file directly
|
| 218 |
+
samples_path = hf_hub_download(repo_id="domyn/finch", filename="finch_dataset.json")
|
| 219 |
+
with open(samples_path, 'r') as f:
|
| 220 |
+
dataset = json.load(f)
|
| 221 |
+
|
| 222 |
+
sample = dataset[0] # First sample
|
| 223 |
+
print(f"Question: {sample['question']}")
|
| 224 |
+
print(f"SQL: {sample['SQL']}")
|
| 225 |
+
```
|
| 226 |
+
|
| 227 |
+
### Financial Query Examples
|
| 228 |
+
|
| 229 |
+
```python
|
| 230 |
+
# Analyze banking transactions
|
| 231 |
+
cursor.execute("""
|
| 232 |
+
SELECT account_id, SUM(amount) as total_balance
|
| 233 |
+
FROM transactions
|
| 234 |
+
WHERE transaction_date >= '2023-01-01'
|
| 235 |
+
GROUP BY account_id
|
| 236 |
+
ORDER BY total_balance DESC
|
| 237 |
+
""")
|
| 238 |
+
|
| 239 |
+
# Insurance claims analysis
|
| 240 |
+
cursor.execute("""
|
| 241 |
+
SELECT policy_type, COUNT(*) as claim_count, AVG(claim_amount)
|
| 242 |
+
FROM claims c
|
| 243 |
+
JOIN policies p ON c.policy_id = p.policy_id
|
| 244 |
+
WHERE claim_status = 'approved'
|
| 245 |
+
GROUP BY policy_type
|
| 246 |
+
""")
|
| 247 |
+
```
|
| 248 |
+
|
| 249 |
+
### Schema Exploration
|
| 250 |
+
|
| 251 |
+
```python
|
| 252 |
+
# Get all tables
|
| 253 |
+
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
|
| 254 |
+
tables = cursor.fetchall()
|
| 255 |
+
print("Available tables:", tables)
|
| 256 |
+
|
| 257 |
+
# Get detailed schema information
|
| 258 |
+
cursor.execute("PRAGMA table_info(transactions)")
|
| 259 |
+
schema = cursor.fetchall()
|
| 260 |
+
for column in schema:
|
| 261 |
+
print(f"Column: {column[1]}, Type: {column[2]}")
|
| 262 |
+
```
|
| 263 |
+
|
| 264 |
+
## Data Quality & Statistics
|
| 265 |
+
|
| 266 |
+
### Database Statistics
|
| 267 |
+
|
| 268 |
+
**📊 TOTAL DATABASES: 33**
|
| 269 |
+
**📅 FINANCIAL DOMAINS: 8+ specialized areas**
|
| 270 |
+
**🏢 TABLES: 292 across all databases**
|
| 271 |
+
**🔗 RELATIONS: 177 foreign key relationships**
|
| 272 |
+
**💼 NL-SQL PAIRS: 75,725 total examples**
|
| 273 |
+
|
| 274 |
+
| Source | Database Count | Table Count | NL-SQL Pairs | Domain Focus |
|
| 275 |
+
|--------|---------------|-------------|--------------|--------------|
|
| 276 |
+
| Spider (financial) | 22 | 145 | 1,100 | Cross-domain financial |
|
| 277 |
+
| BIRD (financial) | 7 | 48 | 1,139 | Large-scale realistic |
|
| 278 |
+
| BULL/CCKS | 3 | 99 | 4,966 | Chinese financial markets |
|
| 279 |
+
| BookSQL | 1 | 185 | 68,907 | Accounting systems |
|
| 280 |
+
| **TOTAL** | **33** | **292** | **75,725** | **Financial** |
|
| 281 |
+
|
| 282 |
+
### Difficulty Distribution
|
| 283 |
+
|
| 284 |
+
- **Easy queries**: 9,358 examples (12.4%)
|
| 285 |
+
- **Medium queries**: 33,780 examples (44.6%)
|
| 286 |
+
- **Hard queries**: 32,587 examples (43.0%)
|
| 287 |
+
|
| 288 |
+
### Quality Assurance
|
| 289 |
+
|
| 290 |
+
The dataset has undergone extensive validation and cleaning:
|
| 291 |
+
- ✅ **SQL execution verified** for all 75,725 queries
|
| 292 |
+
- ✅ **Schema consistency** maintained across all databases
|
| 293 |
+
- ✅ **Error correction** performed on original datasets:
|
| 294 |
+
- BIRD: 327 queries fixed (column names, table references)
|
| 295 |
+
- BULL: 60 queries corrected (syntax errors, invalid references)
|
| 296 |
+
- BookSQL: 9,526 queries repaired (column names, table references, syntax)
|
| 297 |
+
- ✅ **Financial domain relevance** verified for all included databases
|
| 298 |
+
|
| 299 |
+
## Applications
|
| 300 |
+
|
| 301 |
+
This dataset is specifically designed for:
|
| 302 |
+
|
| 303 |
+
### Financial Research Applications
|
| 304 |
+
- **Financial Text-to-SQL Systems**: Train models specifically for financial database querying
|
| 305 |
+
- **Domain Adaptation Studies**: Research cross-domain transfer from general to financial SQL
|
| 306 |
+
- **Financial Schema Understanding**: Develop models that understand complex financial relationships
|
| 307 |
+
- **Regulatory Compliance**: Build systems for automated financial reporting and compliance checking
|
| 308 |
+
- **Risk Analysis Automation**: Create tools for automated risk assessment query generation
|
| 309 |
+
|
| 310 |
+
### Industry Applications
|
| 311 |
+
- **Financial Analytics Platforms**: Natural language interfaces for financial data analysis
|
| 312 |
+
- **Banking Query Systems**: Customer service and internal analyst tools
|
| 313 |
+
- **Investment Research**: Automated portfolio analysis and market research
|
| 314 |
+
- **Regulatory Reporting**: Compliance and audit report generation
|
| 315 |
+
- **Insurance Processing**: Claims analysis and policy management systems
|
| 316 |
+
|
| 317 |
+
### Educational Applications
|
| 318 |
+
- **Financial SQL Training**: Teach SQL with realistic financial datasets
|
| 319 |
+
- **Business Intelligence Education**: Train on real-world financial database structures
|
| 320 |
+
- **Fintech Development**: Build and test financial technology applications
|
| 321 |
+
|
| 322 |
+
## FINCH Evaluation Metric
|
| 323 |
+
|
| 324 |
+
The dataset introduces the **FINCH Score**, a specialized evaluation metric for financial Text-to-SQL that addresses limitations of traditional exact-match and execution accuracy metrics:
|
| 325 |
+
|
| 326 |
+
### Key Features of FINCH Score
|
| 327 |
+
- **Component-wise Scoring**: Weighted evaluation of SQL clauses (SELECT, WHERE, JOIN, etc.)
|
| 328 |
+
- **Financial Clause Priority**: Higher weights for business-critical clauses (WHERE, JOIN, GROUP BY)
|
| 329 |
+
- **Execution Tolerance**: Materiality-aware tolerance for floating-point differences
|
| 330 |
+
- **Structural Fidelity**: Emphasis on semantic correctness over syntactic matching
|
| 331 |
+
|
| 332 |
+
### Mathematical Formulation
|
| 333 |
+
```
|
| 334 |
+
FINCH Score = S(q̂,q*)^β × (δ + (1-δ)e(q̂,q*))
|
| 335 |
+
```
|
| 336 |
+
Where:
|
| 337 |
+
- S(q̂,q*): Weighted component similarity score
|
| 338 |
+
- e(q̂,q*): Execution accuracy with tolerance τ
|
| 339 |
+
- β: Structural fidelity parameter
|
| 340 |
+
- δ: Execution failure penalty parameter
|
| 341 |
+
|
| 342 |
+
## Benchmark Results
|
| 343 |
+
|
| 344 |
+
Initial benchmarking on FINCH reveals detailed performance across multiple state-of-the-art models:
|
| 345 |
+
|
| 346 |
+
### Model Performance Table
|
| 347 |
+
|
| 348 |
+
| Model | Exact Match | Execution Accuracy | Component Match | FINCH Score |
|
| 349 |
+
|-------|-------------|-------------------|-----------------|-------------|
|
| 350 |
+
| **GPT-OSS-120B** | 1.8% | 27.8% | 16.6% | **11.6%** |
|
| 351 |
+
| **Arctic-Text2SQL-R1-7B** | 0.6% | 2.3% | 3.7% | **1.5%** |
|
| 352 |
+
| **Qwen3-235B-A22B** | 0.7% | 2.5% | 2.8% | **1.2%** |
|
| 353 |
+
| **Qwen3-8B** | 0.5% | 0.8% | 3.5% | 1.2% |
|
| 354 |
+
| **GPT-OSS-20B** | 0.3% | 7.5% | 5.2% | 3.0% |
|
| 355 |
+
| **Phi-4-mini-reasoning** | 0.0% | 0.2% | 1.0% | 0.4% |
|
| 356 |
+
|
| 357 |
+
### SQL Clause-Level Performance
|
| 358 |
+
|
| 359 |
+
Analysis of errors by SQL clause reveals systematic challenges:
|
| 360 |
+
|
| 361 |
+
| Model | SELECT | FROM | WHERE | GROUP BY | HAVING | ORDER BY | LIMIT |
|
| 362 |
+
|-------|--------|------|-------|----------|--------|----------|--------|
|
| 363 |
+
| **GPT-OSS-120B** | 4.7% | **27.3%** | 6.9% | 7.5% | 6.3% | 6.3% | **73.8%** |
|
| 364 |
+
| **Arctic-Text2SQL-R1-7B** | 2.5% | 3.6% | 0.7% | 4.7% | 1.0% | 1.3% | 42.7% |
|
| 365 |
+
| **GPT-OSS-20B** | 1.4% | 6.2% | 1.5% | 8.4% | 3.7% | 1.5% | 65.2% |
|
| 366 |
+
|
| 367 |
+
### Model Performance Hierarchy
|
| 368 |
+
1. **GPT-OSS-120B**: Strongest overall performance (11.6% FINCH Score)
|
| 369 |
+
2. **Arctic-Text2SQL-R1-7B**: Best domain-adapted model despite smaller size (1.5% FINCH Score)
|
| 370 |
+
3. **GPT-OSS-20B**: Solid medium-scale performance (3.0% FINCH Score)
|
| 371 |
+
|
| 372 |
+
### Key Research Findings
|
| 373 |
+
- **Domain adaptation** outperforms scale alone - Arctic-Text2SQL-R1-7B (7B params) rivals much larger models
|
| 374 |
+
- **Schema-sensitive clauses** (SELECT, FROM, WHERE) remain the primary bottleneck
|
| 375 |
+
- **Query difficulty** shows steep performance degradation: easy queries achieve ~26.5% vs hard queries at ~4.5%
|
| 376 |
+
- **Financial complexity** significantly impacts all models, with even SOTA systems achieving modest absolute performance
|
| 377 |
+
- **FINCH Score correlation**: Provides more nuanced assessment than traditional exact-match metrics
|
| 378 |
+
|
| 379 |
+
|
| 380 |
+
## Data Source & Methodology
|
| 381 |
+
|
| 382 |
+
FINCH consolidates financial databases from multiple sources:
|
| 383 |
+
|
| 384 |
+
1. **Careful Domain Selection**: Only financial-relevant databases retained
|
| 385 |
+
2. **Comprehensive Validation**: All SQL queries tested for execution
|
| 386 |
+
3. **Error Correction**: Systematic fixing of syntax and schema errors
|
| 387 |
+
4. **Difficulty Annotation**: Query complexity labeled following established guidelines
|
| 388 |
+
5. **Schema Normalization**: All databases converted to SQLite for consistency
|
| 389 |
+
|
| 390 |
+
The curation process prioritized financial domain relevance while maintaining the diversity and complexity necessary for robust model evaluation.
|
| 391 |
+
|
| 392 |
+
## Ethical Considerations
|
| 393 |
+
|
| 394 |
+
- **Public Domain Data**: All source databases are from publicly available benchmarks
|
| 395 |
+
- **Financial Privacy**: No real customer or proprietary financial data included
|
| 396 |
+
- **Synthetic Data**: Financial amounts and transactions are synthetic or anonymized
|
| 397 |
+
- **Research Purpose**: Intended primarily for academic and research applications
|
| 398 |
+
- **Domain Compliance**: Respects financial data handling best practices
|
| 399 |
+
|
| 400 |
+
## Citation
|
| 401 |
+
|
| 402 |
+
If you use the FINCH dataset in your research, please cite:
|
| 403 |
+
|
| 404 |
+
```bibtex
|
| 405 |
+
@inproceedings{singh2025finch,
|
| 406 |
+
title={FINCH: Financial Intelligence using Natural language for Contextualized SQL Handling},
|
| 407 |
+
author={Singh, Avinash Kumar and Sarmah, Bhaskarjit and Pasquali, Stefano},
|
| 408 |
+
booktitle={Proceedings of Advances in Financial AI: Innovations, Risk, and Responsibility in the Era of LLMs (CIKM 2025)},
|
| 409 |
+
year={2025},
|
| 410 |
+
organization={ACM}
|
| 411 |
+
}
|
| 412 |
+
```
|
| 413 |
+
|
| 414 |
+
## Dataset Card Contact
|
| 415 |
+
|
| 416 |
+
For questions about the FINCH dataset, please contact the research team at Domyn.
|
| 417 |
+
|
| 418 |
+
**Research Team:**
|
| 419 |
+
- Avinash Kumar Singh (avinash.kumarsingh@domyn.com)
|
| 420 |
+
- Bhaskarjit Sarmah (bhaskarjit.sarmah@domyn.com)
|
| 421 |
+
- Stefano Pasquali (stefano.pasquali@domyn.com)
|
finch_dataset.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1e462743e4891fecf0fc10dbc6b0eb554fac56a186bdeedec9ccd662e0a4130
|
| 3 |
+
size 36049442
|
tables.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
text2sql-db/text2sql/bird/bird.sqlite
ADDED
|
Binary file (8.19 kB). View file
|
|
|
text2sql-db/text2sql/bird/debit_card_specializing.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b3d149ad05746dbbe5116e229e17e18f09c39db43cf117d9ef3441753608b691
|
| 3 |
+
size 34635776
|
text2sql-db/text2sql/bird/financial.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d15d89cdb068a202b6f2b99342af44dffc1d52545b39ceaf62efdc0ba570101e
|
| 3 |
+
size 71294976
|
text2sql-db/text2sql/bird/regional_sales.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a098eb5b179d3e4441197e51e3f7eb0b8536093da973a20d158e1d6a2e62d4d8
|
| 3 |
+
size 2277376
|
text2sql-db/text2sql/bird/retail_world.sqlite
ADDED
|
Binary file (73.7 kB). View file
|
|
|
text2sql-db/text2sql/bird/retails.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ad24d912b77dfc042abfbfe493b1c1d23252f31c93cb14f436e60939f07d689
|
| 3 |
+
size 1027772416
|
text2sql-db/text2sql/bird/sales.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:632673acfed3a90241f8992324755fdd5304d282fe26a97db551bab7dfafce8a
|
| 3 |
+
size 130338816
|
text2sql-db/text2sql/bird/sales_in_weather.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:470eb5d25cd281042ef3ced349c2a2fbd7a6c16122a037f5ca391d4bac8a8f89
|
| 3 |
+
size 464236544
|
text2sql-db/text2sql/book_sql/accounting.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eb1f9574ec2c28981aa84ddf818adf5d8adfe4ef0945de61eed1d91d91af5482
|
| 3 |
+
size 169447424
|
text2sql-db/text2sql/bull/ccks_fund/ccks_fund.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:104fe596ba88e6a81c061712e0e4cd668b375e80f8cfbbaadab7a866006ad79f
|
| 3 |
+
size 28618752
|
text2sql-db/text2sql/bull/ccks_macro/ccks_macro.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:024cf58ffd6cf9891b660184d125f21a956fd501dbd288f9f25d3b9b1d242fa7
|
| 3 |
+
size 3776512
|
text2sql-db/text2sql/bull/ccks_stock/ccks_stock.sqlite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a852327b57d8c6795836be9835023d23f6bc2876b79bd1e4deb03521812cc5d1
|
| 3 |
+
size 18227200
|
text2sql-db/text2sql/spider/apartment_rentals/apartment_rentals.sqlite
ADDED
|
Binary file (53.2 kB). View file
|
|
|
text2sql-db/text2sql/spider/coffee_shop/coffee_shop.sqlite
ADDED
|
Binary file (36.9 kB). View file
|
|
|
text2sql-db/text2sql/spider/customer_deliveries/customer_deliveries.sqlite
ADDED
|
Binary file (61.4 kB). View file
|
|
|
text2sql-db/text2sql/spider/customers_and_invoices/customers_and_invoices.sqlite
ADDED
|
Binary file (45.1 kB). View file
|
|
|
text2sql-db/text2sql/spider/customers_and_orders/customers_and_orders.sqlite
ADDED
|
Binary file (24.6 kB). View file
|
|
|
text2sql-db/text2sql/spider/customers_campaigns_ecommerce/customers_campaigns_ecommerce.sqlite
ADDED
|
Binary file (36.9 kB). View file
|
|
|
text2sql-db/text2sql/spider/customers_card_transactions/customers_card_transactions.sqlite
ADDED
|
Binary file (20.5 kB). View file
|
|
|
text2sql-db/text2sql/spider/department_store/department_store.sqlite
ADDED
|
Binary file (86 kB). View file
|
|
|
text2sql-db/text2sql/spider/e_commerce/e_commerce.sqlite
ADDED
|
Binary file (41 kB). View file
|
|
|
text2sql-db/text2sql/spider/insurance_and_eClaims/insurance_and_eClaims.sqlite
ADDED
|
Binary file (36.9 kB). View file
|
|
|
text2sql-db/text2sql/spider/insurance_fnol/insurance_fnol.sqlite
ADDED
|
Binary file (53.2 kB). View file
|
|
|
text2sql-db/text2sql/spider/insurance_policies/insurance_policies.sqlite
ADDED
|
Binary file (24.6 kB). View file
|
|
|
text2sql-db/text2sql/spider/loan_1/loan_1.sqlite
ADDED
|
Binary file (36.9 kB). View file
|
|
|
text2sql-db/text2sql/spider/real_estate_properties/real_estate_properties.sqlite
ADDED
|
Binary file (32.8 kB). View file
|
|
|
text2sql-db/text2sql/spider/real_estate_rentals/real_estate_rentals.sqlite
ADDED
|
Binary file (81.9 kB). View file
|
|
|
text2sql-db/text2sql/spider/restaurant_1/restaurant_1.sqlite
ADDED
|
Binary file (24.6 kB). View file
|
|
|
text2sql-db/text2sql/spider/restaurant_bills/restaurant_bills.sqlite
ADDED
|
Binary file (28.7 kB). View file
|
|
|
text2sql-db/text2sql/spider/school_finance/school_finance.sqlite
ADDED
|
Binary file (28.7 kB). View file
|
|
|
text2sql-db/text2sql/spider/shop_membership/shop_membership.sqlite
ADDED
|
Binary file (36.9 kB). View file
|
|
|
text2sql-db/text2sql/spider/small_bank_1/small_bank_1.sqlite
ADDED
|
Binary file (28.7 kB). View file
|
|
|
text2sql-db/text2sql/spider/tracking_orders/tracking_orders.sqlite
ADDED
|
Binary file (32.8 kB). View file
|
|
|
text2sql-db/text2sql/spider/tracking_share_transactions/tracking_share_transactions.sqlite
ADDED
|
Binary file (36.9 kB). View file
|
|
|