Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Query your data in plain English with a fine-tuned Text2SQL model
| Date | Stars |
|---|---|
| 2026-07-31 | 287 |
| 2026-08-06 | 287 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Text2SQirreL 🐿️ : **Query your data in plain English**

*Turn natural language questions into SQL queries with a small, local model that matches cloud LLM accuracy.*
We fine-tuned a small language model to convert plain English questions into executable SQL queries. Because it's small, you can run it locally on your own machine, no API keys, no cloud dependencies, full privacy. Load your CSV files, ask questions, get answers.
| Model | Parameters | LLM-as-a-Judge | Exact Match | Model Link |
| --- | --- | --- | --- | --- |
| DeepSeek-V3 (teacher) | 685B | 80% | 48% | |
| **Qwen3-4B (tuned)** | **4B** | **80%** | **60%** | [huggingface](https://huggingface.co/distil-labs/distil-qwen3-4b-text2sql) |
| **Qwen3-0.6B (tuned)** | **0.6B** | **74%** | **40%** | [huggingface](https://huggingface.co/distil-labs/distil-qwen3-0.6b-text2sql) |
| Qwen3-4B (base) | 4B | 62% | 16% | |
| Qwen3-0.6B (base) | 0.6B | 36% | 24% | |
The tuned 4B model **matches the 685B teacher** on LLM-as-a-Judge accuracy and **exceeds it on exact match** while being **170x smaller**. The 0.6B model achieves **74% accuracy** with a **2x improvement** over its base model - ideal for edge deployment.
## Quick Start
### 1. Install Ollama
Install [Ollama](https://ollama.com/) following the instructions on their website.
### 2. Set up the environment
```bash
python -m venv .venv
. .venv/bin/activate
pip install huggingface_hub openai pandas
```
### 3. Download and build the model
```bash
# Download the 4-bit quantized model (recommended, ~2.5GB)
huggingface-cli download distil-labs/distil-qwen3-4b-text2sql-gguf-4bit --local-dir distil-model
cd distil-model
ollama create distil-qwen3-4b-text2sql -f Modelfile
cd ..
```
### 4. Run Text2SQL
```bash
python app.py --csv example_data/employees.csv \
--question "How many employees are in each department?"
```
## Usage Examples
Text2SQL loads your CSV data, converts your question to SQL, executes it, and returns the results. Use `--show-sql` to see the generated query.
### Single table queries
```bash
> python app.py --csv example_data/employees.csv \
--question "How many employees are in each department?" --show-sql
Generated SQL: SELECT department, COUNT(*) FROM employees GROUP BY department;
department COUNT(*)
Engineering 4
Marketing 3
Sales 3
```
### Multi-table queries (JOINs)
```bash
> python app.py --csv example_data/employees.csv --csv example_data/projects.csv \
--question "What is the total project budget per employee?" --show-sql
Generated SQL: SELECT e.name, SUM(p.budget) FROM employees e JOIN projects p ON e.id = p.lead_id GROUP BY e.name;
name SUM(p.budget)
Alice Johnson 50000
Bob Smith 45000
Carol Williams 120000
David Brown 35000
Henry Chen 80000
```
## How We Trained Text2SQL
### The Problem
Asking questions about data shouldn't require knowing SQL. We wanted to build a local assistant that could translate plain English questions into correct SQL queries. The key requirements:
- **Runs locally:** no API calls, works offline, keeps your data private
- **Fast:** responds in under 2 seconds on a laptop
- **Accurate:** matches the quality of much larger cloud models
- **Executes queries:** actually runs the SQL and returns results
This is exactly the kind of narrow, well-defined task where small language models can shine, if properly trained.
### Validating the Base Model Fails
Before investing in training, we needed to confirm that off-the-shelf small models can't already do this. We tested [Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) on our test set of 50 Text2SQL queries.
The base model achieved **62% on LLM-as-a-Judge and only 16% exact match**,
far below usable accuracy. Common failure modes (more in evaluation section
below):
- Generating invalid SQL syntax
- Using wrong column or table names
- Missing WHERE clauExcerpt of 13,319 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:413e4fda973fa9ce, llm:Repository description: 'Query your data in plain English with a fine-tuned Text2SQL model' (Text2SQL fine-tuned model)
matched fp:413e4fda973fa9ce, llm:Repository description: 'Query your data in plain English with a fine-tuned Text2SQL model' (Text2SQL fine-tuned model)
matched fp:413e4fda973fa9ce, llm:Repository description: 'Query your data in plain English with a fine-tuned Text2SQL model' (Text2SQL fine-tuned model)