Text Generation
PEFT
Safetensors
MLX
English
text-to-sql
sql
sqlite
lora
bird
spider
Eval Results (legacy)
Instructions to use Felamity-Technologies/sqlant-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Felamity-Technologies/sqlant-1b with PEFT:
Task type is invalid.
- MLX
How to use Felamity-Technologies/sqlant-1b with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # if on a CUDA device, also pip install mlx[cuda] # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("Felamity-Technologies/sqlant-1b") prompt = "Once upon a time in" text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use Felamity-Technologies/sqlant-1b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Generate some text mlx_lm.generate --model "Felamity-Technologies/sqlant-1b" --prompt "Once upon a time"
- Atomic Chat
|
Download code/README.md from Felamity-Technologies/sqlant-1b: direct link, hf CLI and curl.
- Browser
- Download file 4.36 kB
-
https://huggingface.co/Felamity-Technologies/sqlant-1b/resolve/main/code/README.md
- Command line
-
hf download hf://Felamity-Technologies/sqlant-1b/code/README.md
-
curl -L -o README.md https://huggingface.co/Felamity-Technologies/sqlant-1b/resolve/main/code/README.md
4.36 kB
| # SQLant-1B: BIRD submission (Track 1, single GPU) | |
| SQLant-1B is a 1.5B text-to-SQL system: **one** base model, [`Qwen/Qwen2.5-Coder-1.5B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct), with two LoRA adapters (about 18M parameters each) that are switched at runtime: | |
| - **generator**: writes SQL; | |
| - **verifier**: answers "yes" or "no" to "is this candidate SQL correct?", given the question, schema and the candidate's first result rows. | |
| Total weights in memory: 1.54B (base) + 2 × 18M (adapters). | |
| **BIRD dev (full, 1,534 questions): 58.3 EX.** | |
| ## Resources | |
| | | | | |
| |---|---| | |
| | GPU | 1 × A100 80 GB. Any GPU with 8 GB or more works; peak memory is about 5 GB. | | |
| | Time | About 20–25 s per question on an Apple M5 Pro (PyTorch, MPS). Expected to be considerably faster on an A100. 1,789 test questions ≈ 10–12 h on the M5 Pro. | | |
| | Disk | 3.1 GB base model + 140 MB adapters | | |
| | Network | Only to download the base model from Hugging Face on first run. Inference makes **no** network calls and sends no data anywhere. | | |
| | `column_meaning.json` | **Not used.** | | |
| | Gold SQL | Not used. Only `question`, `evidence` and `db_id` are read from the input file. | | |
| ## Setup | |
| ```bash | |
| python -m venv venv && source venv/bin/activate | |
| pip install -r requirements.txt | |
| ``` | |
| The adapters are in `adapters/generator` and `adapters/verifier` (PEFT format) in the submission zip, or in `../generator` and `../verifier` in the Hugging Face repository; `run.py` finds either automatically. The base model downloads automatically from Hugging Face. Alternatively, pass a local copy with `--base /path/to/Qwen2.5-Coder-1.5B-Instruct`. | |
| ## Run | |
| ```bash | |
| python run.py --data test.json --db_root test_databases --out predict_test.json | |
| ``` | |
| - **Output:** `predict_test.json` maps each question's index in `test.json` to `"<SQL>\t----- bird -----\t<db_id>"`. | |
| - **Log:** `predict_test.log`. | |
| - **Resume:** progress is appended to `predict_test.json.progress.jsonl` after every question. If the run stops for any reason, re-run the **same command**: finished questions are skipped and it continues from the first unfinished one. | |
| - **Errors:** if one question raises an exception, the traceback is logged, `SELECT 1` is written for it, and the run continues. The final log line reports how many questions failed. | |
| - **Cache:** a per-database value index is built on first use, under `.sqlant_cache/` next to the output file, or `$SQLANT_CACHE` if set. | |
| To reproduce our dev result: | |
| ```bash | |
| python run.py --data dev.json --db_root dev_databases --out predict_dev.json | |
| python compare.py --data dev.json --db_root dev_databases predict_dev.json.progress.jsonl | |
| ``` | |
| ## Method (per question) | |
| 1. **Draft:** the generator writes a greedy SQL from the full schema (`CREATE TABLE` statements + 3 example rows per table), the hint and the question. | |
| 2. **Schema pruning:** keeps tables matched by name, by database values mentioned in the question or hint, by the draft SQL, plus foreign-key bridges. Falls back to the full schema when unsure. | |
| 3. **Candidates:** 1 greedy + 15 sampled (temperature 0.8, top-p 0.95) SQL queries from the pruned prompt (16 in total). | |
| 4. **Repair and value snapping** (no model): fixes `T1.col` pointing to a table that lacks `col`, and replaces literals that don't occur in their column with the stored spelling (for example `'Non-essential'` → `'Non-Essential'`). | |
| 5. **Execute** each candidate (read-only, 15 s timeout) and group candidates by result. | |
| 6. **Verify:** if there are two or more groups, the verifier scores one SQL per group, `v = logit(yes) − logit(no)`. | |
| 7. **Pick** the group with the highest `v + 1.0·log(votes)`. If that group returns no rows and another returns rows, the best such group is taken instead. | |
| ## Files | |
| ``` | |
| run.py entry point (logging, resume, BIRD output format) | |
| compare.py accuracy / parity check on dev | |
| convert_adapters.py MLX -> PEFT adapter conversion (already applied) | |
| sqlant/pipeline.py prompts, execution, grouping, selection | |
| sqlant/schema_tools.py schema pruning, value index, SQL repair, value snapping | |
| sqlant/schema_format.py prompt schema format | |
| sqlant/backend_torch.py PyTorch backend (base + 2 PEFT adapters) | |
| sqlant/backend_mlx.py MLX backend (Apple Silicon, reference implementation) | |
| adapters/generator, adapters/verifier PEFT LoRA adapters | |
| ``` | |