/ Модель

Характеристики

Контекст
262 144 токена
Лицензия
Apache 2.0
Архитектура
qwen3_5 · dense
Базовая модель
Qwen3.5-2B
Библиотека
transformers
Опубликована
4 ноя 2026

Qwen3.5-2B_text2sql

Генерация текстаТекст → текст5 профессий

Дообученная Qwen3.5-2B преобразует вопросы на естественном языке о данных в запросы SQLite.

381скачиваний за 30 дней0лайковвеса обновлены8 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

EuricoGVP разработала Qwen3.5-2B Text-to-SQL — дообученную модель семейства Qwen3.5 для преобразования вопроса о данных в один SQL-запрос к базе SQLite. Модель принимает схему базы данных, вопрос и, при наличии, подсказку; в ответ выдаёт SQL-запрос. Это причинная языковая модель с 2 млрд параметров и визуальным энкодером, который при дообучении не менялся. LoRA-адаптер объединён с весами, поэтому отдельный PEFT не требуется; доступны веса в формате Transformers, заявлена совместимость с Transformers и vLLM.

Модель дообучали один эпохой на примерах из BIRD, Spider и подмножестве SynSQL-2.5M. В оценке автора она показала точность выполнения 43,16% на BIRD dev с одной схемой, 45,11% со схемой и описаниями столбцов и 73,98% на Spider dev; эти результаты относятся к указанным тестам и настройкам. Обучение использовало последовательности до 4096 токенов, а оценка контекста проводилась на длине до 8192 токенов.

Модель рассчитана на англоязычные вопросы и диалект SQLite. Она генерирует запросы, но сама их не запускает и не проверяет; многие ошибочные ответы синтаксически выполняются, но дают неправильные результаты. Поведение на очень больших схемах и других языках или SQL-диалектах не оценивалось. Лицензия модели — Apache-2.0.

Сценарии применения

  • генерация SQLite-запроса по вопросу и схеме базы данных
  • подготовка SQL-запроса с учётом подсказки пользователя
  • ответы на вопросы к базе данных на английском языке
  • создание запросов для аналитических баз SQLite
  • преобразование описаний нужных данных в исполняемый SQL

Ограничения

Генерирует запросы только для SQLite; другие языки и диалекты не оценивались. Модель не запускает и не проверяет запросы, часто выдаёт выполняемые запросы с неверным результатом, а качество на схемах длиннее 4096 токенов изучено недостаточно.

Для каких профессий подходит5

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Также подходит для

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Qwen3.5-2B Text-to-SQL

Collection Sibling Model Sibling Model Sibling Model Base Model Notebooks

[!Note] This repository contains the full model weights and configuration files in the Hugging Face Transformers format. The LoRA adapter is merged into the weights, so PEFT is not needed.

These artifacts are compatible with Hugging Face Transformers and vLLM.

Qwen3.5-2B Text-to-SQL is a fine-tune of Qwen/Qwen3.5-2B that generates one SQLite query from a database schema, an optional hint and a question.

Qwen3.5-2B Text-to-SQL Highlights

Compared with the base model, this fine-tune delivers:

  • Higher Execution Accuracy: 43.16% on BIRD dev with the plain schema, 45.11% with column descriptions and 73.98% on Spider dev, between 16.1 and 18.4 percentage points above the base model.
  • Significant Gain in All Runs: exact McNemar p below 1e-20 in all three runs, with higher accuracy at every difficulty level of both benchmarks.
  • Fewer Execution Errors: from 579 to 185 on BIRD plain, from 569 to 205 on BIRD desc and from 160 to 73 on Spider dev.

For more details, please refer to the notebooks.

Model Overview

  • Type: Causal Language Model with Vision Encoder
  • Task: Text-to-SQL for SQLite
  • Base Model: Qwen/Qwen3.5-2B
  • Language Model
    • Number of Parameters: 2B
    • Hidden Dimension: 2048
    • Number of Layers: 24
    • Hidden Layout: 6 × (3 × (Gated DeltaNet → FFN) → 1 × (Gated Attention → FFN))
  • Fine-Tuning
    • Method: LoRA with Unsloth, merged into the weights
    • Rank and Alpha: 16 and 16
    • Epochs: 1
    • Precision: bf16
    • Scope: language model only, the vision encoder was not changed
  • Max Training Length: 4,096 tokens
  • Evaluated Context Length: 8,192 tokens

Training Data

SourceExamplesLicense
EuricoGVP/birdsql_complete_trainset (BIRD train)5,980CC BY-SA 4.0
EuricoGVP/spider_sql_complete (Spider train), without formula_1, which is also in BIRD dev8,097CC BY-SA 4.0
seeklhy/SynSQL-2.5M subset, with long context and names that need quotes2,105Apache-2.0
llmsql-bench/llmsql-benchmark subset, with columns that need quotes950MIT
Total17,132

Model Family

ModelBase ModelWeights
Qwen3.5-0.8B Text-to-SQLQwen/Qwen3.5-0.8Babout 1.7 GB
Qwen3.5-2B Text-to-SQL (this repository)Qwen/Qwen3.5-2Babout 4.4 GB
Qwen3.5-4B Text-to-SQLQwen/Qwen3.5-4Babout 9 GB
Qwen3.5-9B Text-to-SQLQwen/Qwen3.5-9Babout 19 GB

Benchmark Results

Execution accuracy (EX) in percent, against Qwen/Qwen3.5-2B with the same prompts. BIRD dev has 1,534 questions on 11 databases, with two variants: plain (schema only) and desc (schema with column descriptions). Spider dev has 1,034 questions on 20 databases.

BenchmarkBaseThis ModelOnly This Model CorrectOnly Base CorrectMcNemar p
BIRD dev, plain25.6843.16344768.43e-42
BIRD dev, desc26.7345.11354728.42e-46
Spider dev57.9373.98241751.83e-21

BIRD (dev)

MetricBase, plainThis Model, plainBase, descThis Model, desc
Simple32.7651.2434.8154.81
Moderate15.9532.5416.1632.11
Challenging11.7225.528.9724.83
Execution errors579185569205

Spider (dev)

MetricBaseThis Model
Easy74.6091.13
Medium61.8877.80
Hard40.8065.52
Extra40.3646.99
Execution errors16073

Model Family Comparison

ModelBIRD plainBIRD descSpider dev
Qwen3.5-0.8B base12.3915.3237.14
Qwen3.5-0.8B fine-tuned37.4838.2069.73
Qwen3.5-2B base25.6826.7357.93
Qwen3.5-2B fine-tuned43.1645.1173.98
Qwen3.5-4B base46.22*46.28*77.08
Qwen3.5-4B fine-tuned54.7656.1981.82
Qwen3.5-9B base51.1152.0977.27
Qwen3.5-9B fine-tuned57.1759.3282.01

Values from this repository, EuricoGVP/Qwen3.5-0.8B_text2sql, EuricoGVP/Qwen3.5-4B_text2sql and EuricoGVP/Qwen3.5-9B_text2sql. *Measured with the same benchmark notebook as the fine-tuned models.

[!Note] A query counts as correct when it returns the same result as the gold query on the real database. BIRD compares results as sets, as in the official evaluation.py. Spider follows exec_eval.py from the official test-suite, but runs only on the original database, without the extra test-suite databases, so the official score would be equal or lower.

Quickstart

[!Important] The model was trained and evaluated in non-thinking mode, with the prompt below. Keep enable_thinking=False and this format to reproduce the results.

Prompt Template

Replace None with the hint when you have one. The model answers with a single SQL code block.

SYSTEM_PROMPT = """You are an expert SQLite data analyst.

You will be given a database schema, an optional hint, and a question.
Write a single SQLite query that answers the question.

Rules:
- Use only the tables and columns present in the schema.
- Use the hint when it is provided; it explains domain terms in the question.
- Return exactly the columns the question asks for, nothing more.
- Output only the query, inside a single ```sql code block.
- Do not explain your reasoning and do not write any text outside the code block."""

schema = """CREATE TABLE singer (Singer_ID int PRIMARY KEY, Name text);
CREATE TABLE song (Song_ID int PRIMARY KEY, Title text, Singer_ID int);"""
question = "Show the names of singers that have more than one song."

messages = [
    {"role": "system", "content": SYSTEM_PROMPT},
    {"role": "user", "content": f"Database schema:\n{schema}\n\nHint: None\n\nQuestion: {question}"},
]

Inference with vLLM

# pip install vllm
from vllm import LLM, SamplingParams

llm = LLM(model="EuricoGVP/Qwen3.5-2B_text2sql", max_model_len=8192, language_model_only=True)
sampling = SamplingParams(temperature=0, max_tokens=2048)

outputs = llm.chat([messages], sampling, chat_template_kwargs={"enable_thinking": False})
print(outputs[0].outputs[0].text)

Inference with Transformers

# pip install "transformers>=5.22.1" accelerate
from transformers import AutoModelForImageTextToText, AutoTokenizer

model_id = "EuricoGVP/Qwen3.5-2B_text2sql"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForImageTextToText.from_pretrained(model_id, dtype="auto", device_map="auto")

inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, enable_thinking=False, return_tensors="pt", return_dict=True
).to(model.device)
output = model.generate(**inputs, max_new_tokens=2048, do_sample=False, eos_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Best Practices

To achieve the benchmark performance, we recommend the following settings:

  1. Prompt Format: use the system prompt and the user message above without changes. Other formats were not evaluated.
  2. Greedy Decoding: use temperature=0, as in the benchmarks.
  3. Column Descriptions: include them in the schema when you have them. On BIRD dev they raised EX from 43.16% to 45.11% (exact McNemar p = 0.04).
  4. Read-Only Execution: run the generated queries on a read-only connection and review the results. The model does not run or validate queries.

Limitations

  • The model generates SQLite only. Both benchmarks are in English and use SQLite, so other languages and dialects were not evaluated.
  • Most wrong answers run without error: 687 of 872 on BIRD plain, 637 of 842 on BIRD desc and 196 of 269 on Spider dev.
  • The most common execution error is no such column: 141 of 185 on BIRD plain, 154 of 205 on BIRD desc and 63 of 73 on Spider dev.
  • Examples over 4,096 tokens were not used in training, so behavior on very large schemas is not well measured.

License

  • Model weights: Apache-2.0, the same license as the base model. This is a modified version of Qwen/Qwen3.5-2B: the weights were changed by LoRA fine-tuning.
  • Files in data/: CC BY-SA 4.0, since they contain questions, schemas and queries from BIRD and Spider, with attribution to the original authors. The excerpts from SynSQL-2.5M (Apache-2.0) and LLMSQL (MIT, derived from WikiSQL, BSD-3-Clause) are compatible with this redistribution. Anyone using these data must respect the original license of each dataset.
  • Notebooks: Apache-2.0.

Citation

If you find this work helpful, feel free to cite it.

@misc{pereira2026qwen35text2sql2b,
  title  = {{Qwen3.5-2B Text-to-SQL}},
  author = {Eurico Pereira},
  year   = {2026},
  url    = {https://huggingface.co/EuricoGVP/Qwen3.5-2B_text2sql}
}
@misc{qwen3.5,
    title  = {{Qwen3.5}: Towards Native Multimodal Agents},
    author = {{Qwen Team}},
    month  = {February},
    year   = {2026},
    url    = {https://qwen.ai/blog?id=qwen3.5}
}

@article{li2024can,
  title={Can llm already serve as a database interface? a big bench for large-scale database grounded text-to-sqls},
  author={Li, Jinyang and Hui, Binyuan and Qu, Ge and Yang, Jiaxi and Li, Binhua and Li, Bowen and Wang, Bailin and Qin, Bowen and Geng, Ruiying and Huo, Nan and others},
  journal={Advances in Neural Information Processing Systems},
  volume={36},
  year={2024}
}

@inproceedings{Yu&al.18c,
  title     = {Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task},
  author    = {Tao Yu and Rui Zhang and Kai Yang and Michihiro Yasunaga and Dongxu Wang and Zifan Li and James Ma and Irene Li and Qingning Yao and Shanelle Roman and Zilin Zhang and Dragomir Radev},
  booktitle = "Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing",
  address   = "Brussels, Belgium",
  publisher = "Association for Computational Linguistics",
  year      = 2018
}

@inproceedings{llmsql_bench,
  title={LLMSQL: Upgrading WikiSQL for the LLM Era of Text-to-SQL},
  author={Pihulski, Dzmitry and Charchut, Karol and Novogrodskaia, Viktoria and Koco{\'n}, Jan},
  booktitle={2025 IEEE International Conference on Data Mining Workshops (ICDMW)},
  year={2025},
  organization={IEEE}
}

Acknowledgements

Thanks to the Qwen Team, Unsloth, vLLM and the authors of BIRD, Spider, SynSQL-2.5M, LLMSQL and WikiSQL.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers

Можно запустить

Подбираем GPU…

Класс архитектуры
Qwen3_5ForConditionalGeneration
Ревизия весов
5c4f910

0 моделей