Run this model with HF Jobs

Run Netra-Lab/Netra-Text2SQL-Reviser on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Netra-Lab/Netra-Text2SQL-Reviser. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Netra-Lab/Netra-Text2SQL-Reviser on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/Netra-Lab/Netra-Text2SQL-Reviser. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/Netra-Lab/Netra-Text2SQL-Reviser. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Darayut's picture
Release reviser LoRA adapters (bird, bird-spider1)
d1852b9 verified
|
Raw History Blame Contribute Delete
5.09 kB
metadata
license: other
license_name: qwen-research
license_link: https://huggingface.co/Netra-Lab/Netra-Text2SQL-Reviser/blob/main/LICENSE
base_model: Qwen/Qwen2.5-Coder-3B-Instruct
library_name: peft
pipeline_tag: text-generation
language:
  - en
tags:
  - text-to-sql
  - lora
  - netra-lab

Netra Text2SQL Reviser

Two LoRA adapters (rank 32) for Qwen2.5-Coder-3B-Instruct that do one job in the Netra Text2SQL harness. When the writer's 8 sampled SQL queries disagree, the reviser is shown the two largest groups of queries, each with the rows it actually returned, and writes the final query.

Built with Qwen. Non-commercial use only: see License.

Code: github.com/netra-ai-lab/Netra-Text2SQL, with the harness, the prompt the reviser expects, and the evaluation scripts.

Folder Trained on Use it for
bird/ BIRD train BIRD-style databases (best measured on BIRD dev and Spider 2.0-Lite)
bird-spider1/ BIRD train + Spider 1.0 train Spider-style databases (best measured on Spider 1.0)

Results

Execution accuracy. The writer is stock Qwen2.5-Coder-7B-Instruct-AWQ, sampling 8 queries at temperature 0.8; only the reviser changes between rows. One run per row unless stated.

Benchmark No adapter (writer revises itself) bird/ bird-spider1/
BIRD dev (1,534) 54.6% 56.1%, 54.8% (two runs) 55.0%
Spider 1.0 dev (1,034), official test-suite not measured 72.0% 76.2%
Spider 2.0-Lite, SQLite subset (135), official not measured 5.9% not measured
  • On BIRD, the gain over no adapter is within noise. Two identical runs with bird/ scored 56.1% and 54.8%, so run-to-run spread is about 1.4 points, larger than the 0.2–1.5 point gain.
  • On Spider 1.0, training on Spider 1.0 matters. bird-spider1/ beats bird/ by 4.2 points on the official test-suite score.
  • There's a trade-off. bird-spider1/ is 1.1 points below bird/ on BIRD (one run each, within noise), and lower on BIRD's 145 challenging questions (40.7% vs 45.5%).

How it was made

  1. Training targets from execution, not imitation. Revision prompts were built from the writer's real disagreeing samples on BIRD (and Spider 1.0) train questions. The target is the candidate whose result matches the gold answer, so the adapter learns to pick and fix rather than to copy gold SQL text. The training corpora had 1,326 prompts (bird/) and 4,128 (bird-spider1/). The corpus builder isn't published yet.
  2. QLoRA supervised fine-tuning. 4-bit NF4 base, LoRA rank 32, alpha 64, dropout 0.05 on all attention and MLP projections; loss on the assistant turn only; 2 epochs, learning rate 1e-4 with a cosine schedule, effective batch 16, sequences up to 7,168 tokens, bf16, seed 0.

Usage

The adapters are meant to be served with vLLM next to the writer and called by the harness, which builds the revision prompt (merge_revision_prompt in src/writer/ddl_writer.py). Other prompts are out of distribution.

git clone https://github.com/netra-ai-lab/Netra-Text2SQL.git && cd Netra-Text2SQL && uv sync
uv run hf download Netra-Lab/Netra-Text2SQL-Reviser --include "bird/*" --local-dir reviser
ADAPTER=reviser/bird GPU=1 PORT=8001 bash scripts/serve_reviser_sft.sh   # served as "reviser"

Then pass --reviser-model reviser --reviser-urls http://localhost:8001 to the benchmark runners.

Files

File Contents
bird/adapter_model.safetensors, bird-spider1/adapter_model.safetensors LoRA weights
*/adapter_config.json LoRA configuration (base model, rank, target modules)
*/tokenizer.json, */tokenizer_config.json, */chat_template.jinja Tokenizer and chat template saved by the training run
LICENSE The Qwen RESEARCH LICENSE AGREEMENT
NOTICE Attribution notice required by that licence

Limitations

  • Two-candidate prompts only. The adapters were trained on prompts with exactly two candidate groups. Showing three made revisions worse in our tests.
  • A narrow job. They choose and repair between candidate queries. They aren't general text-to-SQL models.
  • SQLite. All training and evaluation databases are SQLite.

License and attribution

  • Weights: derivative works of Qwen/Qwen2.5-Coder-3B-Instruct, distributed under the Qwen RESEARCH LICENSE AGREEMENT (LICENSE), for non-commercial use only. Commercial use needs a licence from Alibaba Cloud. "Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved." (see NOTICE).
  • Training data: questions and databases from BIRD and Spider 1.0, both CC BY-SA 4.0.
  • Harness code: Apache-2.0, at netra-ai-lab/Netra-Text2SQL.