Skip to content

houssem-moslah/Houssem_SQL-generation-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”₯ Natural Language to SQL Generation using Open-Source LLMs

A two-stage generative AI system that converts natural language questions into SQL queries, using schema-linking and fine-tuned Large Language Models (LLMs). Built during my final-year project at AxeFinance.

πŸš€ Features

  • Two-stage architecture:
    • Schema Linking Model: Identifies correct tables & columns.
    • SQL Generation Model: Generates SQL queries.
  • Fine-tuned open-source models (Mistral, LLaMA).
  • API endpoint built using FastAPI.
  • Dataset: Spider benchmark.
  • Achieved 83.46% execution accuracy on Spider.

πŸ“· Demo

demo

πŸ“¦ Technologies Used

  • Python
  • Hugging Face Transformers
  • PEFT / LoRA
  • PyTorch
  • FastAPI
  • SQL Server (for testing)
  • Google Colab (for training)

πŸ“Š Results

  • Execution Accuracy: 83.46%
  • Schema Linking Accuracy: 91.66%
  • Ranked 3rd on Spider Benchmark

πŸ”— Models on Hugging Face

πŸš€ How to Run

pip install -r requirements.txt
uvicorn src.api:app --reload

About

SQL generation solution based on two stages large language models

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors