--- language: - en license: apache-2.0 base_model: Qwen/Qwen2.5-Coder-32B-Instruct library_name: transformers pipeline_tag: text-generation tags: - sql - text-to-sql - bird-sql - qwen2.5-coder - mubit --- # Mubit-Qwen2.5-Coder-32B-SQL ## Overview **Mubit-Qwen2.5-Coder-32B-SQL** is a 32B-parameter Text-to-SQL model derived from `Qwen/Qwen2.5-Coder-32B-Instruct` for complex multi-join relational query generation with strict executable SQLite syntax and schema adherence. ## Key Highlights - **Beats `XiYanSQL-QwenCoder-32B-2504`:** Achieves **`91.7%`** execution accuracy on `BIRD-SQL Hard` vs. `87.5%` for `XiYanSQL-QwenCoder-32B-2504` (**`+4.2 pp`**). - **`12.7×` lower off-topic drift:** Holds median off-topic KL to **`0.0061` nats** (`0.1254` P95) vs. `0.0777` (`1.0705` P95) for `XiYanSQL-QwenCoder-32B-2504`. - **General coding & safety preserved:** Retains **`100%` `LongHealth`**, **`100%` `HarmBench` refusal**, **`0.0%` over-refusal**, and `0.864` `CUAD` F1 in drop-in BF16 weights. ## Evaluation (`BIRD-SQL Hard` + 5 General & Safety Canaries) | Model | SQL Exec Accuracy | `CUAD` F1 | `IFEval` | `LongHealth` | `HarmBench` Refuse | Off-Topic `KL` (Med / P95) | | --- | ---: | ---: | ---: | ---: | ---: | ---: | | **Mubit-Qwen2.5-Coder-32B-SQL** | **`91.7%`** | `0.864` | `0.812` | **`1.000`** | **`1.000`** | **`0.0061 / 0.1254`** | | Base `Qwen2.5-Coder-32B-Instruct` | `91.7%` | `0.880` | `0.812` | `1.000` | `1.000` | `0.0000 / 0.0000` | | `XGenerationLab/XiYanSQL-QwenCoder-32B-2504` | `87.5%` | `0.864` | `0.938` | `1.000` | `1.000` | `0.0777 / 1.0705` | ## Quickstart ```bash vllm serve MubitLabs/Mubit-Qwen2.5-Coder-32B-SQL --dtype bfloat16 --max-model-len 32768 ``` ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer model_id = "MubitLabs/Mubit-Qwen2.5-Coder-32B-SQL" tok = AutoTokenizer.from_pretrained(model_id, trust_remote_code=False) model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=False) msgs = [{"role": "user", "content": "Schema: accounts(id, region), invoices(id, account_id, amount_cents). Write a SQLite query for the top 5 EMEA accounts by total invoice dollars."}] ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device) print(tok.decode(model.generate(ids, max_new_tokens=256, do_sample=False)[0][ids.shape[-1]:], skip_special_tokens=True)) ``` ## Intended Use & Limitations - **Intended for:** Natural-language-to-SQL interfaces, BI copilots, and automated analytics queries. - **Not intended for:** Direct execution against production write databases without read-only sandboxing and query validation. - **License:** **Apache 2.0**.