Instructions to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="SandLogicTechnologies/sqlcoder-7b-2-GGUF", filename="sqlcoder-7b-2.fp16.gguf_IQ3_M.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M # Run inference directly in the terminal: llama-cli -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M # Run inference directly in the terminal: llama-cli -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M # Run inference directly in the terminal: ./llama-cli -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
Use Docker
docker model run hf.co/SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
- LM Studio
- Jan
- vLLM
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SandLogicTechnologies/sqlcoder-7b-2-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SandLogicTechnologies/sqlcoder-7b-2-GGUF", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
- Ollama
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with Ollama:
ollama run hf.co/SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
- Unsloth Studio
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SandLogicTechnologies/sqlcoder-7b-2-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SandLogicTechnologies/sqlcoder-7b-2-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for SandLogicTechnologies/sqlcoder-7b-2-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with Docker Model Runner:
docker model run hf.co/SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
- Lemonade
How to use SandLogicTechnologies/sqlcoder-7b-2-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull SandLogicTechnologies/sqlcoder-7b-2-GGUF:IQ3_M
Run and chat with the model
lemonade run user.sql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 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- defog/sqlcoder-7b-2
|
| 7 |
+
tags:
|
| 8 |
+
- text-generation
|
| 9 |
+
- text-to-sql
|
| 10 |
+
- sql
|
| 11 |
+
- coding
|
| 12 |
+
- database
|
| 13 |
+
- instruction-following
|
| 14 |
+
- efficient-model
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## SQLCoder-7B-2
|
| 18 |
+
|
| 19 |
+
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.
|
| 20 |
+
|
| 21 |
+
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.
|
| 22 |
+
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
## Model Overview
|
| 26 |
+
|
| 27 |
+
- **Model Name**: SQLCoder-7B-2
|
| 28 |
+
- **Base Model**: defog/sqlcoder-7b-2
|
| 29 |
+
- **Architecture**: Decoder-only Transformer
|
| 30 |
+
- **Parameter Count**: 7 Billion
|
| 31 |
+
- **Modalities**: Text
|
| 32 |
+
- **Primary Languages**: English
|
| 33 |
+
- **Developer**: Defog
|
| 34 |
+
- **License**: CC BY-SA 4.0
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## Quantization Formats
|
| 39 |
+
|
| 40 |
+
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.
|
| 41 |
+
|
| 42 |
+
### IQ3_M
|
| 43 |
+
|
| 44 |
+
- Size reduction of approx 76.89% (2.90 GB) compared to 16-bit (12.55 GB)
|
| 45 |
+
- Aggressive 3-bit quantization optimized for maximum memory reduction
|
| 46 |
+
- Suitable for low-memory systems and CPU-based inference
|
| 47 |
+
- Enables lightweight deployment of Text-to-SQL workflows on constrained hardware
|
| 48 |
+
- SQL generation quality may degrade on highly complex schemas, multi-table joins, and advanced analytical queries
|
| 49 |
+
|
| 50 |
+
### IQ4_NL
|
| 51 |
+
|
| 52 |
+
- Size reduction of approx 71.47% (3.58 GB) compared to 16-bit (12.55 GB)
|
| 53 |
+
- Advanced 4-bit non-linear quantization designed to better preserve SQL generation quality
|
| 54 |
+
- More suitable for structured query generation, schema understanding, and analytical database workflows
|
| 55 |
+
- Typically provides stronger consistency and reduced quantization loss compared to lower-bit formats
|
| 56 |
+
- Slightly increased computational overhead during inference
|
| 57 |
+
|
| 58 |
+
### IQ4_XS
|
| 59 |
+
|
| 60 |
+
- Size reduction of approx 72.91% (3.40 GB) compared to 16-bit (12.55 GB)
|
| 61 |
+
- Balanced 4-bit quantization focused on efficiency and stable SQL generation performance
|
| 62 |
+
- Good trade-off between model size, inference speed, and query quality
|
| 63 |
+
- Suitable for general-purpose Text-to-SQL applications and local database assistants
|
| 64 |
+
- Maintains reliable query generation behavior across most practical workloads
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
+
|
| 68 |
+
## Training Background (Original Model)
|
| 69 |
+
|
| 70 |
+
SQLCoder-7B-2 is trained with a focus on natural language to SQL translation, database reasoning, schema understanding, and structured query generation.
|
| 71 |
+
|
| 72 |
+
### Pretraining
|
| 73 |
+
|
| 74 |
+
- Large-scale language model pretraining across diverse textual and code datasets
|
| 75 |
+
- Focus on programming, structured reasoning, and database-related knowledge
|
| 76 |
+
- Optimized for downstream SQL generation and analytical workflows
|
| 77 |
+
|
| 78 |
+
### Instruction Tuning
|
| 79 |
+
|
| 80 |
+
- Refined using Text-to-SQL datasets and schema-aware instruction tuning
|
| 81 |
+
- Enhanced for generating syntactically correct SQL queries
|
| 82 |
+
- Improved consistency for database querying, filtering, aggregation, and analytical operations
|
| 83 |
+
|
| 84 |
+
---
|
| 85 |
+
|
| 86 |
+
## Key Capabilities
|
| 87 |
+
|
| 88 |
+
- **Text-to-SQL Generation**
|
| 89 |
+
Converts natural language requests into executable SQL queries.
|
| 90 |
+
|
| 91 |
+
- **Database Schema Understanding**
|
| 92 |
+
Interprets table structures, relationships, and schema context effectively.
|
| 93 |
+
|
| 94 |
+
- **SQL Query Construction**
|
| 95 |
+
Supports filtering, joins, aggregations, grouping, ordering, and analytical operations.
|
| 96 |
+
|
| 97 |
+
- **Efficient Local Deployment**
|
| 98 |
+
Quantized variants enable practical offline inference on consumer hardware.
|
| 99 |
+
|
| 100 |
+
- **Structured Data Analysis**
|
| 101 |
+
Assists with database exploration and business intelligence workflows.
|
| 102 |
+
|
| 103 |
+
---
|
| 104 |
+
|
| 105 |
+
## Usage Example
|
| 106 |
+
|
| 107 |
+
### Using llama.cpp
|
| 108 |
+
|
| 109 |
+
```bash
|
| 110 |
+
./llama-cli \
|
| 111 |
+
-m SandlogicTechnologies/sqlcoder-7b-2_IQ4_NL.gguf \
|
| 112 |
+
-p "Generate a SQL query to find the top 10 customers by total revenue."
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
---
|
| 116 |
+
|
| 117 |
+
## Recommended Usecases
|
| 118 |
+
|
| 119 |
+
- **Text-to-SQL Applications**
|
| 120 |
+
Build natural language interfaces for relational databases.
|
| 121 |
+
|
| 122 |
+
- **Database Assistants**
|
| 123 |
+
Generate and explain SQL queries from user requests.
|
| 124 |
+
|
| 125 |
+
- **Business Intelligence Workflows**
|
| 126 |
+
Assist with reporting, aggregation, and analytical query generation.
|
| 127 |
+
|
| 128 |
+
- **Data Exploration**
|
| 129 |
+
Simplify interaction with structured databases through natural language.
|
| 130 |
+
|
| 131 |
+
- **Research and Experimentation**
|
| 132 |
+
Evaluate Text-to-SQL performance and database reasoning workflows.
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
+
|
| 136 |
+
## Acknowledgments
|
| 137 |
+
|
| 138 |
+
These quantized models are based on the original work by the **Defog** development team.
|
| 139 |
+
|
| 140 |
+
Special thanks to:
|
| 141 |
+
|
| 142 |
+
- The Defog team for developing and releasing the SQLCoder-7B-2 model.
|
| 143 |
+
|
| 144 |
+
- **Georgi Gerganov** and the `llama.cpp` open-source community for enabling efficient quantization and inference via the GGUF format.
|
| 145 |
+
|
| 146 |
+
---
|
| 147 |
+
|
| 148 |
+
## Contact
|
| 149 |
+
|
| 150 |
+
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/)
|