sqlcoder2

Maintained By
defog

SQLCoder2

PropertyValue
Model Size15B parameters
LicenseCC BY-SA 4.0
Base ModelStarCoder
Performance77.5% accuracy on SQL generation

What is SQLCoder2?

SQLCoder2 is a state-of-the-art language model specifically designed for converting natural language questions into SQL queries. Built by Defog, this 15B parameter model represents a significant advancement in natural language to SQL generation, outperforming GPT-3.5-turbo and approaching GPT-4's capabilities in specific scenarios.

Implementation Details

The model was trained on over 20,000 human-curated questions across 10 different database schemas. It's built on the StarCoder architecture and has been fine-tuned specifically for SQL generation tasks. The model supports various deployment options, including 8-bit and 4-bit quantized versions for consumer GPUs with 20GB+ memory.

  • Achieves 77.5% accuracy on novel datasets
  • Trained on diverse schema patterns
  • Supports multiple quantization options
  • Hardware requirement: A100 40GB GPU or equivalent

Core Capabilities

  • Exceptional performance on date-related queries (80% accuracy)
  • Strong handling of GROUP BY operations (82.9% accuracy)
  • Advanced JOIN query generation (74.3% accuracy)
  • Complex ratio calculations (74.3% accuracy)
  • Precise WHERE clause formulation (77.1% accuracy)

Frequently Asked Questions

Q: What makes this model unique?

SQLCoder2 stands out for its ability to match and sometimes exceed the performance of proprietary models like GPT-3.5-turbo in SQL generation tasks. When fine-tuned on specific schemas, it can even outperform GPT-4.

Q: What are the recommended use cases?

The model is ideal for converting natural language questions into SQL queries, particularly in scenarios involving complex database operations, data analysis, and automated query generation. It's especially effective for applications requiring date manipulation, grouping operations, and multi-table joins.

The first platform built for prompt engineering