DayTrader-2B-SQL
DayTrader-2B-SQL is a 2.5B-parameter model based on MiniCPM5-2B-SFT, fine-tuned to work with PostgreSQL. It focuses on generating SQL from natural-language questions, correcting queries using database errors, and interpreting query results.
Lineage
Fine-tuned from openbmb/MiniCPM5-2B-SFT through project continuation stages to V4 amplified_100 (this release). The final stage was a full-weight BF16 continuation; this is a complete standalone model, not an adapter. It is not derived from OpenBMB's final RL+OPD checkpoint.
Training data
The V4 continuation used 800 training and 524 development records.
| Cohort | Train rows |
|---|---|
| SQL completion | 360 |
| SQL transfer | 120 |
| SQL repair / first-shot SQL | 40 / 40 |
| Arithmetic, finance reasoning, finance sizing | 40 each |
| General instruction / multiturn dialogue | 40 / 40 |
| Live-state grounding, file, shell, error recovery | 16 / 8 / 8 / 8 |
Sources are project-authored executable fixtures (440 rows), project finance/direct tasks (280 rows), and OpenAssistant-derived dialogue (80 rows). An earlier 1,600-instance stage produced the intermediate checkpoint; only the V4 continuation above produced this checkpoint.
Training recipe
Full-weight fine-tuning in BF16 with SDPA attention: AdamW (learning rate 2e-5, betas 0.9/0.999, epsilon 1e-8, weight decay 0.01), micro-batch 1 with 8 accumulation steps, seed 3411, 100 optimizer updates, checkpoints at 25/50/100. Supervision covered assistant tool calls and final answers only; user, system, and tool messages were masked, and incorrect tool calls were excluded from supervision.
Evaluation
Internal frozen evaluation, greedy decoding, thinking disabled:
| Scope | Result |
|---|---|
| All tasks (349) | 337/349 (96.6%) |
| Shared-schema tasks | 328/328 (100%) |
| Held-out-schema tasks | 6/18 (33.3%) |
| Real-error-first repairs | 3/3 |
This is an internal specialized evaluation, not a public benchmark or general SQL-accuracy claim. The headline number is driven by shared-schema tasks; held-out-schema composition is narrow and unseen aggregation/absence families fail. General assistant and financial reasoning performance is not established by the SQL evaluation; separate internal diagnostics showed mixed results, including finance regressions. Use it for SQL assistance, not autonomous financial decisions.
Usage
The model wraps its SQL in native XML tool-call markup (<function name="...">). In an agentic harness, supply the matching tool definition; with a plain prompt it still emits the same markup, as below.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "snsnc/DayTrader-2B-SQL"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=False)
model = AutoModelForCausalLM.from_pretrained(
model_id, dtype=torch.bfloat16, trust_remote_code=False
).eval()
messages = [
{"role": "system", "content": "Write one PostgreSQL query for the question."},
{"role": "user", "content": "Schema: invoices(id, account_id, amount). Question: total amount for account 1."},
]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer(prompt, return_tensors="pt")
with torch.inference_mode():
output = model.generate(
**inputs, do_sample=False, max_new_tokens=256,
eos_token_id=[tokenizer.eos_token_id, 130073],
)
print(tokenizer.decode(output[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
# <function name="postgres_read"><param name="sql">SELECT SUM(amount) FROM invoices WHERE account_id = 1;</param></function>
License and attribution
Released under Apache-2.0; see LICENSE. Base model © OpenBMB (openbmb/MiniCPM5-2B-SFT, Apache-2.0). Training dialogue includes OpenAssistant-derived rows under Apache-2.0.
- Downloads last month
- -
Model tree for snsnc/DayTrader-2B-SQL
Base model
openbmb/MiniCPM5-2B-SFT