# defog-ai/sqlcoder

SoTA LLM for converting natural language questions to SQL queries

Repository: https://github.com/defog-ai/sqlcoder
Canonical: https://ross.abutalabs.com/products/sqlcoder
Language: Jupyter Notebook
License: Apache-2.0
License Family: permissive
Last push: 2024-05-23T03:06:26+00:00

## Health v2 (maintenance only)
Score: 28/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 79
- inputs: {"age_days": 1112, "days_push": 832, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4044, forks 276 (observed 2026-08-28T04:08:33.578112+00:00)

## What it is
SQLCoder is a family of fine-tuned open-weight LLMs that convert natural language questions into SQL queries, outperforming GPT-4 on text-to-SQL benchmarks. It ships as a pip-installable package with a CLI launcher for connecting to databases and querying them visually.

## Use cases
- convert natural language questions to SQL queries
- let non-technical users query a database in plain English
- self-host a text-to-SQL model instead of calling GPT-4
- generate SQL for novel database schemas
- run text-to-SQL locally on a GPU or Apple Silicon

## When to choose
- you need high-accuracy text-to-SQL generation with open weights you can self-host
- you want to avoid sending schema data to closed LLM APIs
- you have a GPU with 16GB+ VRAM or Apple Silicon for local inference

## When to avoid
- you need a general-purpose chat or coding assistant rather than SQL generation
- you cannot run local models and lack budget for GPU inference
- you need guaranteed-correct SQL without validation, since LLM output can still be wrong

## Facets
- artifact type: library
- maturity: active
- function: llm-inference, machine-learning, nlp, database
- domain: large-language-models, databases
- platform: python, windows
- tags: text-to-sql, sql-generation, fine-tuned-llm, llama, open-weights, natural-language-processing, gpu, macos, linux

## Member repositories
- defog-ai/sqlcoder (main) score 28

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:33.578112+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:23:44.456152+00:00, confidence not recorded.
  - readme: https://github.com/defog-ai/sqlcoder (fetched 2026-08-28T04:08:33.578112+00:00, sha 09e0b471e58d)
  - registry_pypi: https://pypi.org/pypi/sqlcoder/json (fetched 2026-08-29T09:16:06.749868+00:00, sha 4c19cb3a364c)
- Data as of 2026-08-30T08:39:29.467469+00:00.
