/ Модель

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

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

Qwen3.5-4B_text2sql

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

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

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

Бенчмарки

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

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

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

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

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

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

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

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

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

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

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

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

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

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

EuricoGVP/Qwen3.5-4B_text2sql — дообученная модель семейства Qwen3.5 от EuricoGVP для преобразования вопроса о данных в SQL-запрос SQLite. Она принимает схему базы данных, необязательную подсказку и вопрос на естественном языке и генерирует один запрос. Модель основана на Qwen/Qwen3.5-4B, содержит около 4 млрд параметров; LoRA-дообучение языковой модели объединено с весами, а визуальный энкодер не изменялся. Модель доступна в формате Transformers и совместима с vLLM.

На тестовых выборках BIRD и Spider модель показала более высокую точность выполнения запросов, чем базовая Qwen3.5-4B: 54,76% на BIRD с одной схемой, 56,19% со схемой и описаниями столбцов и 81,82% на Spider. Для воспроизведения результатов рекомендованы шаблон запроса из карточки, режим без рассуждений и жадная генерация; оценённая длина контекста — 8192 токена. Модель предназначена прежде всего для английских запросов и диалекта SQLite. Она не исполняет и не проверяет SQL; многие ошибочные ответы синтаксически выполняются, а работа с очень большими схемами проверена ограниченно. Лицензия — Apache-2.0.

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

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

Ограничения

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

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

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

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

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

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

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

Открыть на Hugging Face

Qwen3.5-4B 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-4B Text-to-SQL is a fine-tune of Qwen/Qwen3.5-4B that generates one SQLite query from a database schema, an optional hint and a question.

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

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

  • Higher Execution Accuracy: 54.76% on BIRD dev with the plain schema, 56.19% with column descriptions and 81.82% on Spider dev, between 4.7 and 9.9 percentage points above the base model.
  • Significant Gain in All Runs: exact McNemar p below 1e-04 in all three runs, with higher accuracy at every difficulty level of both benchmarks.
  • Fewer Execution Errors on BIRD: from 246 to 80 on BIRD plain and from 223 to 76 on BIRD desc. On Spider dev they went from 26 to 28.

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-4B
  • Language Model
    • Number of Parameters: 4B
    • Hidden Dimension: 2560
    • Number of Layers: 32
    • Hidden Layout: 8 × (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-SQLQwen/Qwen3.5-2Babout 4.4 GB
Qwen3.5-4B Text-to-SQL (this repository)Qwen/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-4B 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, plain46.2254.76230993.75e-13
BIRD dev, desc46.2856.19245936.34e-17
Spider dev77.0881.8295464.49e-05

BIRD (dev)

MetricBase, plainThis Model, plainBase, descThis Model, desc
Simple54.4961.0853.1962.27
Moderate35.5647.2037.9348.28
Challenging27.5938.6228.9742.76
Execution errors2468022376

Spider (dev)

MetricBaseThis Model
Easy90.7392.34
Medium82.9687.22
Hard67.8274.14
Extra50.6059.64
Execution errors2628

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-2B_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-4B_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-4B_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 54.76% to 56.19%, although this difference alone is not statistically significant (exact McNemar p = 0.08).
  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: 614 of 694 on BIRD plain, 596 of 672 on BIRD desc and 160 of 188 on Spider dev.
  • The most common execution error is no such column: 65 of 80 on BIRD plain, 64 of 76 on BIRD desc and 25 of 28 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-4B: 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{pereira2026qwen35text2sql4b,
  title  = {{Qwen3.5-4B Text-to-SQL}},
  author = {Eurico Pereira},
  year   = {2026},
  url    = {https://huggingface.co/EuricoGVP/Qwen3.5-4B_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
Ревизия весов
31c2faf

0 моделей