A 4B text-to-SQL model that writes SQL, repairs its own failing queries and checks its own candidates. It scores 75.68 EX on the hidden BIRD test set.
flash-sqlite-4b is Qwen3.5-4B, fully fine-tuned for SQLite text-to-SQL. It is the successor of flash-sqlite (2B, 73.73 on test). One set of weights does three jobs:
All three roles use the same checkpoint. There is no auxiliary model, no embedding model and no external API. Repair feedback comes only from running the model's own SQL on the given database. Under the BIRD organisers' ruling, this qualifies for the single-model track.
Key facts
enable_thinking=False) for generation, repair and judging. It writes a short structured analysis followed by the SQL; the judge outputs a single token.The BIRD team scored the model on the hidden test set: 32 candidates per question, execution repair and self-judge, on a single A100 80 GB.
| metric | total (1,789) |
|---|---|
| Execution Accuracy (EX) | 75.68 (simple 82.93 / moderate 72.79 / challenging 57.19) |
| Soft F1 | 76.86 |
| R-VES | 68.10 |
On the single-model leaderboard it shares 8th place with Databricks RLVR 32B and is ahead of 57 of the 65 other entries. On the overall leaderboard, which includes multi-model pipelines and proprietary systems, it is ahead of 105 entries. Among entries with 4B parameters or fewer, only Native mini (4B) scores higher.
All scores are BIRD test-set execution accuracy from the single-model leaderboard at bird-bench.github.io, taken at the time of writing. Markers show how many candidates each entry samples per question, using the leaderboard's own categories: no marker = one candidate, * Few = 2–7, ** Many = 8–32.
Frontier and large general-purpose LLMs:
| model | size | test EX |
|---|---|---|
| flash-sqlite-4b (this model) | 4B | 75.68** |
| GPT-5.5-xhigh | proprietary | 72.55 |
| Claude Opus 4.6 | proprietary | 70.15 |
| Qwen3-Coder-480B-A35B | 480B MoE | 68.14 |
| Claude 4.5 Sonnet | proprietary | 66.85 |
| GLM-4.7 | large open-weight | 62.94 |
| DeepSeek-R1 | 671B MoE | 60.93 |
| Kimi-K2-Thinking | ~1T MoE | 59.87 |
Specialised text-to-SQL models (selection):
| model | size | test EX |
|---|---|---|
| SiriusAI-SQL-9B (Tencent) | 9B | 77.08** |
| Native mini | 4B | 76.86** |
| flash-sqlite-4b (this model) | 4B | 75.68** |
| Databricks RLVR 32B | 32B | 75.68* |
| Sophon-Text2SQL-32B (ByteDance) | 32B | 74.79** |
| Arctic-Text2SQL-R1-32B (Snowflake) | 32B | 73.84* |
| flash-sqlite (our 2B) | 2B | 73.73** |
| Arctic-Text2SQL-R1-7B (Snowflake) | 7B | 70.43* |
| XiYanSQL-QwenCoder-32B (Alibaba) | 32B | 69.03* |
Dev revision bird-sql-dev-1106: 1,532 questions with executable gold SQL, execution accuracy with set comparison. All rows come from the same run of the inference package.
| inference | EX | simple | moderate | challenging |
|---|---|---|---|---|
| 32 candidates + repair + self-judge | 71.41 | 80.79 | 70.88 | 37.39 |
| 16 candidates + repair + self-judge | 71.15 | 80.44 | 70.43 | 37.83 |
| majority vote over 32 repaired candidates, no judge | 69.13 | 78.46 | 67.49 | 37.39 |
Without the repair step, the same model reaches 70.54 with 32 candidates + self-judge and 68.32 with plain majority voting. Repair adds about 0.6–0.9 EX on dev; the self-judge adds about 2.3 EX over majority voting.
For each question:
1 == 1.0. Candidates that still fail are dropped. A group's votes are the number of candidates in it.On BIRD dev this costs on average 39.1 model calls per question: 32 generations, 4.7 repair calls (only 592 of 1,534 questions needed any repair; identical candidates share one repair) and 2.4 judge calls (54 % of questions needed no judge call because all executable candidates agreed).
n=32); with prefix caching, the long schema prompt is prefilled once and shared by all samples and by the judge prompts of the same question.Training is supervised fine-tuning only. Every SQL target is execution-verified: a chain-of-thought trace was only kept if its final SQL, run on the real database, returned the gold result set. The traces were rejection-sampled from a Qwen 27B teacher and follow a structured chain of thought: question and hint mapping, schema selection, join path, filters, aggregation, edge-case checks, then the final SQL.
Stage 1: structured-CoT SFT from Qwen3.5-4B on 20,940 traces: BIRD train 6,779, Spider 4,046 and 10,115 synthetic examples over generated databases (schema-linking traps, expert-style, noisy-hint and formula questions). The best checkpoint (epoch 1.75) was kept.
Stage 2: joint generator + judge SFT on 40,452 rows:
Hyperparameters for stage 2: full fine-tune in bf16, learning rate 2e-5 (cosine schedule), 50 warmup steps, effective batch size 32, NEFTune α = 5, maximum sequence length 16,384. The released checkpoint is step 3,476 (about 2.75 of 3 planned epochs).
The prompts contain per-column descriptions read from each BIRD database's database_description/*.csv files. No BIRD dev or test data was used for training.
The model expects the OmniSQL-style prompt below and answers with its reasoning followed by a fenced SQL block. Always take the last ```sql block. Use non-thinking mode (enable_thinking=False).
Task Overview:
You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question.
Database Engine:
SQLite
Database Schema:
{db_details}
This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints.
Question:
{question}
Hint: {evidence}
Instructions:
- Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more.
- The generated query should return all of the information asked in the question without any missing or extra information.
- Before generating the final SQL query, please think through the steps of how to write the query.
Output Format:
In your answer, please enclose the generated SQL query in a code block:
```sql
-- Your SQL query
Take a deep breath and think step by step to find the correct SQL query.
`{db_details}` is the schema as `CREATE TABLE` statements, with the column descriptions as comments and three example rows per table.
### Quick start (vLLM)
```python
from vllm import LLM, SamplingParams
llm = LLM("AlioLeuchtmann/flash-sqlite-4b", max_model_len=32768)
tok = llm.get_tokenizer()
prompt = tok.apply_chat_template([{"role": "user", "content": PROMPT}], tokenize=False,
add_generation_prompt=True, enable_thinking=False)
# greedy single answer
out = llm.generate([prompt], SamplingParams(temperature=0.0, max_tokens=2048))
sql = out[0].outputs[0].text.split("```sql")[-1].split("```")[0].strip()
# 32 candidates for repair + voting + self-judge
cands = llm.generate([prompt], SamplingParams(n=32, temperature=1.0, top_p=0.95, top_k=20, max_tokens=2048))
vLLM ≥ 0.25 is required for the Qwen3.5 hybrid architecture.
Apache 2.0, the same as the base model Qwen/Qwen3.5-4B.