PEFT
Safetensors
text-to-sql
grpo
lora
reward-hacking
counterfactual-rewards
How to use from the
Use from the
PEFT library
# Gated model: Login with a HF token with gated access permission
hf auth login
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-grpo-cf")

You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

tiny-aya-global-sql-grpo-cf

LoRA adapter (r = 16) for CohereLabs/tiny-aya-global: GRPO, 60 steps, counterfactual-database reward, mean form (R_cf_mean), seed 0.

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 路 Data 路 Demo 路 Adapters: sft 路 grpo-single-db 路 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.0% [7.9, 10.1]
Single-DB accuracy 14.0% [12.8, 15.4]
Silent-error rate 61.2% [59.3, 63.0]

Seeds 1-2 and the pooled comparison are in the paper and in results/seeds_eval.json.

Use

Accept the base model's licence, then:

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-grpo-cf")
tok = AutoTokenizer.from_pretrained("counterfactual-sql/tiny-aya-global-sql-grpo-cf")

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.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 馃檵 Ask for provider support

Model tree for counterfactual-sql/tiny-aya-global-sql-grpo-cf

Adapter
(444)
this model

Dataset used to train counterfactual-sql/tiny-aya-global-sql-grpo-cf