How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="flintglass/GPT-OSS-20B-PrismSQL")
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("flintglass/GPT-OSS-20B-PrismSQL")
model = AutoModelForCausalLM.from_pretrained("flintglass/GPT-OSS-20B-PrismSQL", device_map="auto")
messages = [
    {"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

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 · GGUF Quantizations: 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)

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
Downloads last month
248
Safetensors
Model size
21B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for flintglass/GPT-OSS-20B-PrismSQL

Finetuned
(583)
this model
Quantizations
1 model

Collection including flintglass/GPT-OSS-20B-PrismSQL