Braina Logo

AI Library

DuckDB-NSQL Model Information & Download

Model Tag:
duckdb-nsql 📋
The 7B parameter text-to-SQL model was developed by MotherDuck and Numbers Station.
Model File Size
3.8 GB
Quantization
Q4
License
Not available
Last Updated
2024-02-04 (9 months ago)

DuckDB-NSQL: Transforming Natural Language into SQL Queries

DuckDB-NSQL Model

DuckDB-NSQL is a sophisticated text-to-SQL model comprising 7 billion parameters, meticulously created by MotherDuck and Numbers Station. This model is designed with the specific purpose of generating SQL queries from natural language prompts, making it an invaluable tool for developers and data analysts alike.

Overview of DuckDB-NSQL

DuckDB-NSQL is built upon Meta’s original Llama-2 model, which is a powerful transformer architecture. It has undergone additional pre-training on a comprehensive dataset of general SQL queries and has been fine-tuned on a specialized dataset containing text-to-SQL pairs uniquely relevant to DuckDB.

What Makes DuckDB-NSQL Unique?

This model stands out due to the following features:

Usage of DuckDB-NSQL

To utilize DuckDB-NSQL for SQL generation, users must provide a schema and specific prompts. Here’s a basic example:

Example Prompt

    Provided this schema:
    CREATE TABLE orders (
        OrderID bigint,
        CustomerID bigint,
        OrderDate timestamp,
        ProductName varchar(255),
        Quantity int,
        PricePerUnit double,
        TotalAmount double
    );
    Give me orders placed after January 1, 2023
    

Example Output

    SELECT * FROM orders WHERE OrderDate > '2023-01-01';
    

Training Data and Process

The model has been fine-tuned on a dataset consisting of:

During the training, cross-entropy loss was utilized to maximize the sequential input likelihood while minimizing overfitting on the SQL components of the pairs.

Intended Use

DuckDB-NSQL is primarily designed for generating SQL queries from specified table schemas and natural language instructions. It excels when used with the defined prompt formats and is versatile in producing a range of SQL statements beyond simple SELECT queries.

For those looking to leverage local language models for database querying, DuckDB-NSQL seamlessly integrates into various workflows.

← Back to Model Library