
SQLCoder
Defog's open text-to-SQL model family that claims to beat GPT-4 at turning plain English into SQL.
About
SQLCoder is a family of models from Defog.ai built for one job: converting natural language questions into SQL queries. The line runs from early 15B StarCoder and CodeLlama variants up to the current sqlcoder-7b-2, trained on 20,000+ human-curated questions across ten schemas that were kept out of the evaluation set. The flagship 7B-2 runs on a CodeLlama-7B base with a 16K context window and supports beam search for harder queries.
Defog's claim is that SQLCoder outperforms GPT-4 and GPT-4-turbo on their sql-eval framework of 200 questions on novel schemas, and it materially beats every other popular open-source model they tested. The weights carry a CC BY-SA 4.0 license with extra responsible-use restrictions, which means commercial use is allowed but fine-tuned derivatives must be shared under the same terms. It ships with a small pip package, an Apple Silicon build, and a demo that wires it straight to your database.
Specs
Context window
Pricing
Free quota
API access
Weights
Released
Benchmarks
- Defog sql-eval (200 questions on novel schemas): claimed to outperform GPT-4 and GPT-4-turbo (provider-reported)
- Spider: ~83% execution accuracy claimed by third-party tables (unverified; not Defog's official metric)
Provider-reported unless a source says otherwise. Benchmarks are marketing-adjacent by nature — treat them as directional.
Use cases
Trust score — 7/10
Scored 7/10 (metrics tier, metrics-v1). Evidence: official Defog repo and HF cards document training (20k human-curated questions, held-out eval schemas) and the CC BY-SA 4.0 license; the sql-eval framework is public. Strengths: focused, well-maintained text-to-SQL line with pip packaging and multi-platform builds. Docked for: (1) the headline GPT-4 comparison is vendor-run on their own 200-question benchmark with no independent replication; (2) share-alike license plus responsible-use restrictions complicate commercial reuse; (3) line has not had a major release since early 2024.
How the trust score is built
Full methodology →- Adoption · stars/downloads, log-scaled vs peers
- 7.0/10
- Maintenance · recency, releases, issue load
- 6.0/10
- Openness · license + docs
- 7.0/10
- Manual review · sanity read + red-flag check
- 7.0/10
- · Public sql-eval framework; training on 20k held-out-schema questions
- · GPT-4 comparison is vendor-run on own 200-question benchmark; no major release since early 2024