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
- 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.sqlcoder-7b-2-GGUF-IQ3_M
List all available models
lemonade list
output = llm(
"Once upon a time,",
max_tokens=512,
echo=True
)
print(output)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.cppopen-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
3-bit
4-bit
Model tree for SandLogicTechnologies/sqlcoder-7b-2-GGUF
Base model
defog/sqlcoder-7b-2
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="SandLogicTechnologies/sqlcoder-7b-2-GGUF", filename="", )