flintglass's picture
Release Flintglass GPT-OSS-20B-PrismSQL BF16 (82.20% SQLite Exec, +3.49 pts Complex SQL, +11.76 pts Multi-Joins)
da8638e verified
|
Raw History Blame Contribute Delete
3.52 kB
---
language:
- en
license: apache-2.0
library_name: transformers
pipeline_tag: text-generation
base_model: openai/gpt-oss-20b
tags:
- flintglass
- prismsql
- gpt-oss
- moe
- text-to-sql
- sql
- sqlite
- rlvr
- grpo
- apache-2.0
---
# Flintglass GPT-OSS-20B-PrismSQL
**Pure On-Policy Live-SQLite Execution-Verified Text-to-SQL RLVR on Apache-2.0 `openai/gpt-oss-20b` (21B Total / 3.6B Active MoE)** — achieving **`82.20%` Overall SQLite Execution Accuracy (+1.90 pts)**, **`73.64%` Complex SQL (+3.49 pts)**, **`63.89%` Macro Complexity (+3.02 pts)**, **`+11.76 pts` on Multi-Joins**, **`+6.12 pts` on Subqueries**, **`+5.00 pts` on Single Joins**, and **`-36%` output tokens (`65.6 -> 42.1`)**!
> **Part of the [Flintglass Prism Open-Source Agent & RAG Stack](https://huggingface.co/collections/flintglass/flintglass-prism-open-agent-and-rag-stack-6b0df22104aefbb7e8d4fe11)** · **GGUF Quantizations:** [`flintglass/GPT-OSS-20B-PrismSQL-GGUF`](https://huggingface.co/flintglass/GPT-OSS-20B-PrismSQL-GGUF) (`Q4_K_M`, `Q5_K_M`)
---
## Verified Zero-Leakage Live-SQLite Execution Results (1,000 Held-Out Schemas)
Every prediction is executed against an isolated in-memory SQLite database populated with schema DDL + sample rows, and verified by normalized result-set equivalence against gold SQL:
| SQL Category | Tasks | `openai/gpt-oss-20b` (Base) | **`flintglass/GPT-OSS-20B-PrismSQL`** | Delta |
|---|---:|---:|---:|---:|
| **Overall SQLite Execution Accuracy** | **1,000** | 80.30% | **82.20%** | **+1.90 pts** |
| **Complex SQL (Non-Basic, 459 tasks)** | **459** | 70.15% | **73.64%** | **+3.49 pts** |
| **Macro Complexity Avg (7 cats)** | **1,000** | 60.87% | **63.89%** | **+3.02 pts** |
| `basic SQL` | 541 | 88.91% | **89.46%** | +0.55 pts |
| `aggregation` | 224 | 72.32% | **74.55%** | **+2.23 pts** |
| `single join` | 140 | 76.43% | **81.43%** | **+5.00 pts** |
| `subqueries` | 49 | 67.35% | **73.47%** | **+6.12 pts** |
| `multiple_joins` | 17 | 47.06% | **58.82%** | **+11.76 pts** |
| `set operations` | 7 | 28.57% | 28.57% | 0.00 pts |
| `window functions` | 22 | **45.45%** | 40.91% | -4.54 pts |
| **Avg Output Tokens** | 1,000 | 65.6 | **42.1** | **-36% (1.56× faster)** |
---
## Quickstart (`transformers`)
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "flintglass/GPT-OSS-20B-PrismSQL"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "system", "content": "Return ONLY a valid SQLite SELECT query."},
{"role": "user", "content": "Schema:\nCREATE TABLE orders(id INT, customer_id INT, total REAL, created_at TEXT);\nCREATE TABLE customers(id INT, country TEXT);\n\nQuestion: Top 5 countries by total revenue in 2026."},
]
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True, reasoning_effort="low")
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=False))
```
## Training & Provenance
- **Base Model:** `openai/gpt-oss-20b` (Apache-2.0, 21B total / 3.6B active MoE, dequantized cleanly from MXFP4 to native BF16 with all 336/336 LoRA tensors merged).
- **Algorithm:** Pure On-Policy PPO-Clipped GRPO (`r=32`, `alpha=32`, 40 steps, `K=8` rollouts/prompt, live in-memory SQLite execution reward).
- **License:** Apache-2.0