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

./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 or visit https://www.sandlogic.com/

Downloads last month
152
GGUF
Model size
7B params
Architecture
llama
Hardware compatibility
Log In to add your hardware

3-bit

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for SandLogicTechnologies/sqlcoder-7b-2-GGUF

Quantized
(25)
this model