DEV.co
Open-Source Databases · eosphoros-ai

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.

Source: GitHub — github.com/eosphoros-ai/DB-GPT-Hub
2k
GitHub stars
250
Forks
Python
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryeosphoros-ai/DB-GPT-Hub
Ownereosphoros-ai
Primary languagePython
LicenseMIT — OSI-approved
Stars2k
Forks250
Open issues73
Latest releasev0.3.0 (2023-12-08)
Last updated2025-07-02
Sourcehttps://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.

Quickstart

Get the DB-GPT-Hub source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/eosphoros-ai/DB-GPT-Hub.gitcd DB-GPT-Hub# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Building domain-specific SQL generation systems

Fine-tune models on your database schema and question patterns to achieve production-level Text-to-SQL accuracy without relying on closed APIs. CodeLlama-13B-Instruct reaches 74.6% execution accuracy across complexity levels.

Reducing inference costs for natural language database querying

Deploy fine-tuned open-source models (7B-13B parameters) instead of expensive API-based solutions. LoRA/QLoRA adaptation minimizes memory and compute overhead during inference.

Evaluating LLM Text-to-SQL capabilities at scale

Leverage the framework's evaluation pipeline and baseline benchmarks (Easy/Medium/Hard/Extra) to benchmark new models or compare fine-tuning strategies systematically.

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.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityModerate
DEV.co fitGood
Assessment confidenceHigh
Security considerations

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.

Software development agency

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.co

Related 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?
Yes—MIT license allows commercial use. Verify base model licenses (Llama2, Qwen, etc.) and Spider dataset commercial terms. Add query validation and cost controls before deployment. No commercial support available.
What GPU do I need to fine-tune a model?
Minimum ~16GB VRAM for LoRA (single GPU). QLoRA reduces to ~8GB. Exact requirements depend on model size (7B vs 13B) and batch size. Not specified in docs—empirical testing recommended.
How accurate is the fine-tuned output on my custom database?
Baseline shows CodeLlama-13B-Instruct achieves 74.6% execution accuracy on Spider 'all' queries. Real-world accuracy depends on schema complexity, data distribution match, and query style. Transfer learning to new domains may see 10-20% accuracy drop. Evaluate on your test set.
Does this support real-time schema updates?
Not demonstrated. Models are fine-tuned once on a static schema. Dynamic schema changes (new tables, columns) require re-tuning or prompt injection. For live schema evolution, consider RAG or API-based solutions with real-time introspection.

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.