Instructions to use counterfactual-sql/tiny-aya-global-sql-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use counterfactual-sql/tiny-aya-global-sql-sft with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global") model = PeftModel.from_pretrained(base_model, "counterfactual-sql/tiny-aya-global-sql-sft") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from counterfactual-sql/tiny-aya-global-sql-sft: direct link, hf CLI and curl.
- Browser
- Download file 2.69 kB
-
https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-sft/resolve/main/README.md
- Command line
-
hf download hf://counterfactual-sql/tiny-aya-global-sql-sft/README.md
-
curl -L -H "Authorization: Bearer $HF_TOKEN" -o README.md https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-sft/resolve/main/README.md
2.69 kB
| base_model: CohereLabs/tiny-aya-global | |
| library_name: peft | |
| license: cc-by-nc-4.0 | |
| license_link: https://cohere.com/c4ai-cc-by-nc-license | |
| tags: [text-to-sql, grpo, lora, reward-hacking, counterfactual-rewards] | |
| datasets: [counterfactual-sql/counterfactual-sql-data] | |
| # tiny-aya-global-sql-sft | |
| LoRA adapter (r = 16) for [CohereLabs/tiny-aya-global](https://huggingface.co/CohereLabs/tiny-aya-global): SFT warm start on scripted trajectories (3 training templates held out for GRPO); the initialisation of both GRPO adapters. | |
| Paper: *Single-Database Rewards Are Hackable: Counterfactual Execution for Trustworthy Text-to-SQL RL* | |
| (Shreshth Rai, Rishii Kumar Singh, Aksh Aggarwal; AIMS-DTU, Delhi Technological University). | |
| [Code and paper](https://github.com/RishiiGamer2201/counterfactual-sql-rewards) 路 [Data](https://huggingface.co/datasets/counterfactual-sql/counterfactual-sql-data) 路 [Demo](https://huggingface.co/spaces/counterfactual-sql/counterfactual-sql-demo) 路 | |
| Adapters: [sft](https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-sft) 路 [grpo-single-db](https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-grpo-single-db) 路 [grpo-cf](https://huggingface.co/counterfactual-sql/tiny-aya-global-sql-grpo-cf) | |
| Test set: 331 questions x 8 samples, T = 0.7, fresh databases from a different generator. Verified = correct on the | |
| original database and all 4 hidden test copies. | |
| | Metric | Value (95% Wilson CI) | | |
| |---|---| | |
| | Verified accuracy | 9.4% [8.4, 10.6] | | |
| | Single-DB accuracy | 14.5% [13.2, 15.9] | | |
| | Silent-error rate | 65.4% [63.6, 67.2] | | |
| Seeds 1-2 and the pooled comparison are in the paper and in `results/seeds_eval.json`. | |
| ## Use | |
| Accept the [base model's licence](https://huggingface.co/CohereLabs/tiny-aya-global), then: | |
| ```python | |
| from peft import PeftModel | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| base = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global", dtype="bfloat16", device_map="auto") | |
| model = PeftModel.from_pretrained(base, "counterfactual-sql/tiny-aya-global-sql-sft") | |
| tok = AutoTokenizer.from_pretrained("counterfactual-sql/tiny-aya-global-sql-sft") | |
| ``` | |
| It is a multi-turn SQL agent with one `run_sql` tool (prompt and parser: `sqlcf/agent.py`, `evaluate.py gen`). | |
| For vLLM, merge first (`python train.py merge --init <adapter> --out merged`), since vLLM LoRA fails on the tied embeddings. | |
| ## Licence | |
| This adapter is a derivative of CohereLabs/tiny-aya-global and is released under the same terms: | |
| CC-BY-NC-4.0 (full text in LICENSE) with Cohere's acceptable-use addendum, https://cohere.com/c4ai-cc-by-nc-license. | |
| Non-commercial use only. You also need access to the gated base model. | |