DB-GPT-Hub
DB-GPT-Hub is a repository containing fine-tuning datasets, models, and techniques for converting natural language questions to SQL queries (Text-to-SQL). It builds on the Spider dataset and provides end-to-end workflows for training and evaluating models like Llama2, CodeLlama, and Qwen on SQL generation tasks.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | eosphoros-ai/DB-GPT-Hub |
| Owner | eosphoros-ai |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 2k |
| Forks | 250 |
| Open issues | 73 |
| Latest release | v0.3.0 (2023-12-08) |
| Last updated | 2025-07-02 |
| Source | https://github.com/eosphoros-ai/DB-GPT-Hub |
What DB-GPT-Hub is
A Python-based fine-tuning framework for Text-to-SQL parsing using supervised fine-tuning (SFT) on open-source LLMs. Supports LoRA and QLoRA adaptation methods, includes evaluation metrics (execution accuracy), and provides baseline benchmarks across multiple model families and difficulty levels. Integrates with Spider dataset and HuggingFace model hub.
Get the DB-GPT-Hub source
Clone the repository and explore it locally.
git clone https://github.com/eosphoros-ai/DB-GPT-Hub.gitcd DB-GPT-Hub# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Dataset preparation: Spider dataset must be downloaded and preprocessed (format, tokenization); custom domain schemas require manual annotation or transfer learning.
- Model selection: Baseline shows CodeLlama-13B-Instruct and Qwen-14B-Chat as top performers; choice depends on deployment constraints (latency, memory, licensing).
- LoRA vs QLoRA trade-off: LoRA offers slightly higher accuracy (CodeLlama-13B: 74.6% vs 72.7%), but QLoRA cuts memory ~4× with modest loss; neither shows 80%+ accuracy on hard queries.
- Evaluation methodology: Execution accuracy (ex) metric evaluates correctness; parsing accuracy (match) not provided. Production systems need additional cost/safety validation beyond execution success.
- Integration point: Models output raw SQL; downstream requires validation layer, query planning, and error recovery for schema drift or ambiguous queries.
When to avoid it — and what to weigh
- You need production-grade stability guarantees — Latest release (v0.3.0) is from December 2023. 73 open issues suggest active development. Code may have breaking changes or incomplete features. Requires thorough testing before production use.
- Your schema requires real-time multi-dialect SQL generation — Framework is Spider-dataset-centric and baseline results focus on single-database scenarios. Cross-dialect or streaming schema updates are not demonstrated in provided materials.
- You lack GPU resources or specialized ML infrastructure — Fine-tuning and inference of 7B-13B models require significant compute. QLoRA reduces requirements but still demands GPU memory. No clear guidance on CPU-only operation.
- You require strong commercial support or SLAs — This is a community-driven research project. No commercial support, service guarantees, or vendor backing are evident. Reliance is on community Discord and GitHub issues.
License & commercial use
MIT License. Permissive open-source license allowing commercial use, modification, and distribution with attribution. No restrictions on proprietary use of fine-tuned weights or derived systems. Verify licensing of upstream datasets (Spider) and base models (Llama2, CodeLlama, Qwen, Baichuan, ChatGLM) separately.
MIT license permits commercial deployment. However: (1) Base model licenses vary (Llama2 has additional restrictions, CodeLlama is Apache 2.0, Qwen is permissive); review each base model license before commercial use. (2) Spider dataset has research-use restrictions—verify if your commercial dataset reuse aligns. (3) No indemnification, warranty, or SLA. Consider commercial alternatives (OpenAI, Anthropic APIs) if legal/support coverage is critical.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Moderate |
| DEV.co fit | Good |
| Assessment confidence | High |
No formal security audit documented. Considerations: (1) Fine-tuned models may memorize sensitive data from training corpora (schema, data examples). (2) Generated SQL can be exploited if not validated (injection, resource exhaustion). Recommend adding query cost estimation, rate limiting, and output sanitization. (3) Model weights and code are public—no confidential data in repo visible. (4) Dependency vulnerabilities: requires regular PyTorch, Transformers updates. No security policy file found in repo.
Alternatives to consider
OpenAI API (GPT-4 with function calling / SQL plugin)
Closed-source, higher accuracy (≥90% on Spider), fully managed, commercial SLA. Tradeoff: API costs, latency, data privacy concerns, no fine-tuning control.
Anthropic Claude with prompt engineering
Competitive accuracy without fine-tuning, strong instruction-following. Tradeoff: API-only, cost per query, no model control, less mature SQL generation benchmarks published.
LangChain / LlamaIndex with retrieval-augmented generation (RAG)
Alternative approach: retrieve relevant schema/examples instead of fine-tuning. Lower compute footprint, easier integration. Tradeoff: accuracy lower than fine-tuning, latency variable, retrieval quality-dependent.
Build on DB-GPT-Hub with DEV.co software developers
Clone the repo, prepare your dataset, and fine-tune a 7B-13B model to generate SQL from natural language. Reduce API costs while maintaining control.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
DB-GPT-Hub FAQ
Can I use DB-GPT-Hub for proprietary Text-to-SQL in production?
What GPU do I need to fine-tune a model?
How accurate is the fine-tuned output on my custom database?
Does this support real-time schema updates?
Software development & web development with DEV.co
DEV.co helps companies turn open-source tools like DB-GPT-Hub into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source databases stack.
Get Started with Text-to-SQL Fine-Tuning
Clone the repo, prepare your dataset, and fine-tune a 7B-13B model to generate SQL from natural language. Reduce API costs while maintaining control.