File size: 5,331 Bytes
81ecf47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---

license: cc-by-sa-4.0
language:
    - en
base_model:
    - defog/sqlcoder-7b-2
tags:
    - text-generation
    - text-to-sql
    - sql
    - coding
    - database
    - instruction-following
    - efficient-model
---


## SQLCoder-7B-2

SQLCoder-7B-2 is a specialized code generation model developed by Defog and optimized for Text-to-SQL generation, database querying, and structured data analysis workflows. This repository contains GGUF quantized variants of the model optimized for efficient local inference using llama.cpp.

The model is designed to translate natural language questions into syntactically correct SQL queries across a variety of database schemas. The quantized formats significantly reduce memory requirements while preserving strong SQL generation capability, enabling practical deployment on consumer hardware and edge environments.

---

## Model Overview

- **Model Name**: SQLCoder-7B-2
- **Base Model**: defog/sqlcoder-7b-2
- **Architecture**: Decoder-only Transformer
- **Parameter Count**: 7 Billion
- **Modalities**: Text
- **Primary Languages**: English
- **Developer**: Defog
- **License**: CC BY-SA 4.0

---

## Quantization Formats

This repository provides various GGUF quantized versions of the SQLCoder-7B-2 model, optimized for efficient local inference using `llama.cpp`. Below are the details of the available I-Matrix (IQ) formats.

### IQ3_M



- Size reduction of approx 76.89% (2.90 GB) compared to 16-bit (12.55 GB)

- Aggressive 3-bit quantization optimized for maximum memory reduction

- Suitable for low-memory systems and CPU-based inference

- Enables lightweight deployment of Text-to-SQL workflows on constrained hardware

- SQL generation quality may degrade on highly complex schemas, multi-table joins, and advanced analytical queries



### IQ4_NL

- Size reduction of approx 71.47% (3.58 GB) compared to 16-bit (12.55 GB)
- Advanced 4-bit non-linear quantization designed to better preserve SQL generation quality
- More suitable for structured query generation, schema understanding, and analytical database workflows
- Typically provides stronger consistency and reduced quantization loss compared to lower-bit formats
- Slightly increased computational overhead during inference

### IQ4_XS



- Size reduction of approx 72.91% (3.40 GB) compared to 16-bit (12.55 GB)

- Balanced 4-bit quantization focused on efficiency and stable SQL generation performance

- Good trade-off between model size, inference speed, and query quality

- Suitable for general-purpose Text-to-SQL applications and local database assistants

- Maintains reliable query generation behavior across most practical workloads



---



## Training Background (Original Model)



SQLCoder-7B-2 is trained with a focus on natural language to SQL translation, database reasoning, schema understanding, and structured query generation.



### Pretraining



- Large-scale language model pretraining across diverse textual and code datasets

- Focus on programming, structured reasoning, and database-related knowledge

- Optimized for downstream SQL generation and analytical workflows



### Instruction Tuning



- Refined using Text-to-SQL datasets and schema-aware instruction tuning

- Enhanced for generating syntactically correct SQL queries

- Improved consistency for database querying, filtering, aggregation, and analytical operations



---



## Key Capabilities



- **Text-to-SQL Generation**

  Converts natural language requests into executable SQL queries.



- **Database Schema Understanding**

  Interprets table structures, relationships, and schema context effectively.



- **SQL Query Construction**

  Supports filtering, joins, aggregations, grouping, ordering, and analytical operations.



- **Efficient Local Deployment**

  Quantized variants enable practical offline inference on consumer hardware.



- **Structured Data Analysis**

  Assists with database exploration and business intelligence workflows.



---



## Usage Example



### Using llama.cpp



```bash

./llama-cli \

  -m SandlogicTechnologies/sqlcoder-7b-2_IQ4_NL.gguf \

  -p "Generate a SQL query to find the top 10 customers by total revenue."

```



---



## Recommended Usecases



- **Text-to-SQL Applications**

  Build natural language interfaces for relational databases.



- **Database Assistants**

  Generate and explain SQL queries from user requests.



- **Business Intelligence Workflows**

  Assist with reporting, aggregation, and analytical query generation.



- **Data Exploration**

  Simplify interaction with structured databases through natural language.



- **Research and Experimentation**

  Evaluate Text-to-SQL performance and database reasoning workflows.



---



## Acknowledgments



These quantized models are based on the original work by the **Defog** development team.



Special thanks to:



- The Defog team for developing and releasing the SQLCoder-7B-2 model.



- **Georgi Gerganov** and the `llama.cpp` open-source community for enabling efficient quantization and inference via the GGUF format.



---



## Contact



For questions, feedback, or support, please reach out at [support@sandlogic.com](mailto:support@sandlogic.com) or visit [https://www.sandlogic.com/](https://www.sandlogic.com/)