Skip to content

, Subspecialty

Teaching an open model a benchmark retailer's data rules

How supervised fine tuning, and fine tuning followed by reinforcement learning, compare with the untuned model and with general models on a benchmark retailer’s 25 data rules. From the schema alone, Qwen3.6-35B-A3B fine tuned then trained with RL scored 99.3% on 600 held out questions, against 100.0% for Gemini 4 Carbon, 100.0% for GPT-6.2 Sol and 99.3% for Claude Sonnet 5.5, at 8 to 19 times lower cost per query.

Level with Claude Sonnet 5.5, within a point of Gemini 4 Carbon and GPT-6.2 Sol
99.3%
Fine tuning then RL, on all 600 test questions; 100.0% on familiar types and 99.7% on a fresh set only our model was scored on
Same model, untuned
57.3%
Qwen3.6-35B-A3B with the full data guide in its prompt; 56.2% on the fresh set
Gained in training
+42.0
Points over the untuned model: +41.3 from fine tuning, +0.7 from RL
Lower cost per query
15x
$0.88 against $12.97 per 1,000 for Claude Sonnet 5.5

Rules that live outside the database

Every company keeps rules for its numbers outside the schema: which orders count, what net sales means, when the fiscal year starts, which accounts are tests. An analyst learns them over months. A general model has to be handed them in the prompt on every call, and a query that skips one returns a plausible number that is wrong.

We tested whether a small open model can carry those rules in its weights: answer from the schema and the question alone, as accurately as a general model reading the full rulebook, and for much less per query.

A benchmark retailer

We built Hollis & Pine, a benchmark retailer, for this study: a warehouse, a written data guide and a sealed set of questions, with every reference answer compiled from the rules.

The warehouse and its rules

The warehouse holds 52,248 orders, 103,435 order lines, 3,991 refunds and 6,500 customers across 12 regions and 22 stores, from February 2023 to June 2026, under terse table names (ord_hdr, ord_ln, rfnd, cust_mstr). Its data guide sets 25 rules, for example:

  • Order status. Only shipped and delivered orders count.
  • Excluded accounts. Test accounts and employee purchases are left out of every metric.
  • Net sales. Discounts and refunds come off, and a refund counts against the date of its original order.
  • Calendar and regions. The fiscal year starts on 1 February. A store order belongs to the store’s region, an online order to the customer’s.

Of 300 validation questions, 299 return a different answer when at least one of five core rules is ignored, so generic SQL does not score. By rule:

Validation questions whose answer changes when one rule is ignored
Rule ignoredValidation questions that change
Test accounts284 of 300
Order status267 of 300
Employee purchases232 of 300
Refunds136 of 300
Order region54 of 300

Familiar and new question types

Questions ask for totals, breakdowns, rankings, growth between fiscal years and shares, across nine metrics. The test has two halves of 300. Familiar types are kinds of questions seen in training, asked about new periods, filters and wording. New types are combinations held out of training, such as refunds by market or units by store, so the model has to compose rules it learned separately. The test set was frozen and hashed before any training.

Scoring

Each answer is one SQLite query, run against the warehouse. It counts as correct when it returns exactly the rows of the reference query, in any order: execution match, the rule the BIRD benchmark uses. The grader is a program, not a model, and each reference query is compiled from the rules and checked to run and return rows before it is kept. The training queries come from the same compiler, so our model learned to write the reference form: its query is the reference query word for word in 553 of 600 answers, against 0 for Claude Sonnet 5.5. The general models write their own SQL, and the grade compares rows, not text.

Models and prompts

  • Our model. The schema and the question, about 746 tokens; greedy decoding, up to 1,024 output tokens. The rules have to come from training.
  • General models. GPT-6.2 Sol, Claude Sonnet 5.5, Gemini 4 Carbon, Qwen4 Max and Inkling, each given the schema, the full data guide and the question, at the provider’s default settings and up to 16,000 output tokens.
  • Reference point. Qwen3.6-35B-A3B before training, with the general models’ prompt and output cap, and our model’s greedy decoding and chat template without a thinking phase.

Statistics

We registered the comparison with Claude Sonnet 5.5, the claim words and the fine tuning checkpoint rule before any training. The other general models were added after the first fine tuning run and Claude Sonnet 5.5 had been scored, and the RL checkpoint rule before RL. Each model and setting was recorded before it ran, except the untuned model on the fresh set, a reference added afterwards. Every model answered each test question once. Differences are our model minus the other, with a paired bootstrap over questions (10,000 resamples) for the 95% confidence interval and an exact McNemar test:

Claim words, set before training
Claim wordWhen it applies
beatsthe whole 95% confidence interval is above zero
matchesthe lower end of the 95% confidence interval is above minus two points
trails by Xotherwise

Training in two stages

We compared three setups of the same model: untuned, given the full data guide; supervised fine tuning, which teaches it the company’s rules from correct queries; and fine tuning followed by reinforcement learning, which rewards it for queries that return the right rows. Both trained setups answer from the schema and the question alone. Untuned, the model scored 0% on the first 100 validation questions from that short prompt, often without returning a query, and 61% with the full guide in its prompt.

Supervised fine tuning

A LoRA adapter (rank 32) on Qwen3.6-35B-A3B, batches of 32 at a learning rate of 0.000375, with loss on the query only. Each example is the short prompt and the correct query, so the rules exist only in the training signal. The training set held 3,150 question and query pairs; the chosen checkpoint, step 50, had seen 1,600 of them, once each.

Accuracy on the first 100 validation questions; step 0 is the untuned model on the short prompt. Dashed lines are Claude Sonnet 5.5 and the untuned model, each given the full guide.

The checkpoint rule, set before training, takes the first check at the best validation accuracy: step 50, at 100%. The run stopped at step 52 of 196 when the hosting service’s checkpoint storage filled; a later check could at best tie, and ties go to the earliest, so the pick is the same.

Reinforcement learning

Starting from the fine tuned checkpoint, we ran GRPO for 40 steps: each step took 32 training questions and sampled 8 queries for each at temperature 1. A query earned 1 when its rows matched the reference, 0.1 when it ran but returned other rows and 0 otherwise; the PPO loss and a learning rate of 0.00004 turned those rewards into updates. Only training questions were rewarded. We checked greedy accuracy on all 300 validation questions every 10 steps and tested the first checkpoint at the best score.

Accuracy on all 300 validation questions by RL step; step 0 is the fine tuned model, before RL. The scale starts at 95%. The checkpoint was chosen on these questions, so the curve flatters it; the test results below are on questions the model never saw.

Validation rose from 99.0% to 100.0% by step 30, the tested checkpoint. Most questions were already answered correctly at every sample, which gives no learning signal, so the gains came from the few questions the model still got wrong some of the time.

Results

Over all 600 held out questions, fine tuning then RL scored 99.3%, and 100.0% on familiar types. By the claim words we set before training it matches GPT-6.2 Sol (−0.7 points, 95% confidence interval −1.3 to −0.2), matches Claude Sonnet 5.5 (0.0 points, 95% confidence interval −1.0 to 1.0), matches Gemini 4 Carbon (−0.7 points, 95% confidence interval −1.3 to −0.2), beats Qwen4 Max (+2.0 points, 95% confidence interval 0.7 to 3.5) and beats Inkling (+10.0 points, 95% confidence interval 7.5 to 12.7), at 3 to 19 times lower cost per query.

Fine tuning against fine tuning then RL

Fine tuning alone scored 98.7%: it trails GPT-6.2 Sol by 1.3 points, matches Claude Sonnet 5.5, trails Gemini 4 Carbon by 1.3 points, matches Qwen4 Max and beats Inkling. Adding RL took it to 99.3%, +0.7 points (95% confidence interval −0.3 to 1.7), with the whole gain on familiar question types (98.7% to 100.0%).

To check the result on questions that no training or checkpoint choice used, we scored every setup of our model on a second set of 600 questions from the same generator (the general models were not rerun):

Each setup of our model on the test and on a second, fresh set
SetupPromptTestFresh set
UntunedSchema, data guide and question57.3%56.2%
Fine tuningSchema and question98.7%98.8%
Fine tuning then RLSchema and question99.3%99.7%

On the fresh set RL added +0.8 points over fine tuning alone (0.0 to 1.7). The step from RL is small and, at this sample size, not significant on either set by itself, but it moved the same way on both.

Accuracy against cost

Our model (schema and question only)General models, by lab (schema, data guide and question)Fine tuning onlyThe same model untuned (schema, data guide and question)Cost line: no cheaper model is more accurateUp and to the left is better. Hover or tap a point for its numbers.

Familiar and new question types

Accuracy by model on familiar and on new question types

Familiar types

Secondary analysis. 300 questions of kinds seen in training

  1. Gemini 4 Carbon100.0%
  2. GPT-6.2 Sol100.0%
  3. Our model100.0%
  4. Claude Sonnet 5.599.3%
  5. Fine tuning only98.7%
  6. Qwen4 Max97.7%
  7. Inkling89.3%
  8. Untuned67.3%

New types

Secondary analysis. 300 questions of kinds held out of training

  1. Gemini 4 Carbon100.0%
  2. GPT-6.2 Sol100.0%
  3. Claude Sonnet 5.599.3%
  4. Fine tuning only98.7%
  5. Our model98.7%
  6. Qwen4 Max97.0%
  7. Inkling89.3%
  8. Untuned47.3%
Bars start at zero. Hover or tap a model for its cost and our model’s paired difference on that half. The lighter bar is fine tuning only; the hatched bar is the same model before training, given the full guide.

What each stage added

The same model untuned, after fine tuning and after RL
QuestionsUntuned, with the full data guideFine tuned, schema and question onlyFine tuned then RL, schema and question onlyGain in points
Familiar types
67.3%98.7%100.0%
+32.7
New types
47.3%98.7%98.7%
+51.3
All 600
57.3%98.7%99.3%
+42.0
Untuned, with the full data guideFine tuned, schema and question onlyFine tuned then RL, schema and question onlyTotal gain in points on the right; 95% confidence interval on all 600: 38.0 to 46.0.

Given the whole data guide, the untuned model scored 57.3%. Fine tuning took it to 98.7% with no guide, and RL to 99.3%. We first ran the untuned model with our model’s cap of 1,024 output tokens. It reasons at length before writing a query, so 202 of its 600 answers were cut off and it scored 39.7%. We recorded the change and ran it again with the general models’ cap; that run is the one reported.

One question, two answers

A question from the familiar half, answered by the same model before and after training: with the guide in its prompt the untuned model applied the wrong region rule; with no guide our model applied the right one.

Question

“Give me the number of customers who bought in the NA market for the last 30 days.”

The rule it turns on

Rule 20 of the data guide. Which region an order belongs to: a store order belongs to the store's region (str.rgn_id); a Web or App order belongs to the customer's home region (cust_mstr.home_rgn_id). Sales metrics (gross, net, refunds, units, orders, AOV) use the order's region. Customer counts (buying, new and active customers) use the customer's home region.

Untuned

Schema, full data guide and question

Wrong: 794
WITH OrderRegions AS (    SELECT         oh.ord_id,        oh.cust_id,        CASE             WHEN oh.chnl_cd = 'S' THEN s.rgn_id            ELSE cm.home_rgn_id        END AS order_rgn_id    FROM ord_hdr oh    JOIN cust_mstr cm ON oh.cust_id = cm.cust_id    LEFT JOIN str s ON oh.str_id = s.str_id    WHERE oh.sts IN (3, 4)      AND cm.tst_flg = 0      AND cm.seg_cd != 'E'      AND date(oh.ord_ts) >= '2026-06-01'      AND date(oh.ord_ts) <= '2026-06-30')SELECT COUNT(DISTINCT or_.cust_id) AS buying_customersFROM OrderRegions or_JOIN rgn r ON or_.order_rgn_id = r.rgn_idWHERE r.mkt = 'NA';

Our model

Schema and question only

Correct: 797
WITH ln AS (  SELECT h.ord_id, h.cust_id, date(h.ord_ts) AS d, h.chnl_cd, h.str_id,         l.qty, l.unit_px_c, l.disc_amt_c, COALESCE(r.rf_c, 0) AS rf_c,         ct.cat_desc, ct.dept_nm, c.seg_cd, c.home_rgn_id,         CASE WHEN h.chnl_cd = 'S' THEN s.rgn_id ELSE c.home_rgn_id END AS ord_rgn_id  FROM ord_ln l  JOIN ord_hdr h ON h.ord_id = l.ord_id  JOIN cust_mstr c ON c.cust_id = h.cust_id  JOIN prod p ON p.sku = l.sku  JOIN cat ct ON ct.cat_cd = p.cat_cd  LEFT JOIN str s ON s.str_id = h.str_id  LEFT JOIN (SELECT ord_id, ln_no, SUM(rfnd_amt_c) AS rf_c FROM rfnd GROUP BY ord_id, ln_no) r    ON r.ord_id = l.ord_id AND r.ln_no = l.ln_no  WHERE h.sts IN (3, 4) AND c.tst_flg = 0 AND c.seg_cd <> 'E')SELECT COUNT(DISTINCT cust_id) FROM ln JOIN rgn g ON g.rgn_id = ln.home_rgn_id WHERE d BETWEEN '2026-06-01' AND '2026-06-30' AND g.mkt = 'NA'
The correct answer is 797. The untuned model counted customers by the order’s region; a customer count uses the customer’s home region. Claude Sonnet 5.5, given the guide, also answered correctly. Our model’s query is the reference query word for word, as in 553 of its 600 answers.

Full results

Every model on the 600 test questions
ModelAll 600Familiar typesNew typesCost per 1,000Ours minus model (95% CI)
Our modelQwen3.6-35B-A3B, fine tuned then RL99.3%100.0%98.7%$0.88·
Fine tuning onlyQwen3.6-35B-A3B, fine tuned98.7%98.7%98.7%$0.89+0.7 (−0.3 to 1.7)RL minus fine tuning only
GPT-6.2 SolOpenAI100.0%100.0%100.0%$7.25−0.7 (−1.3 to −0.2)matches, McNemar p = 0.13
Claude Sonnet 5.5Anthropic99.3%99.3%99.3%$12.970.0 (−1.0 to 1.0)matches, McNemar p = 1.00
Gemini 4 CarbonGoogle100.0%100.0%100.0%$17.12−0.7 (−1.3 to −0.2)matches, McNemar p = 0.13
Qwen4 MaxAlibaba97.3%97.7%97.0%$2.98+2.0 (0.7 to 3.5)beats, McNemar p = 0.01
InklingThinking Machines89.3%89.3%89.3%$8.25+10.0 (7.5 to 12.7)beats, McNemar p below 0.001
UntunedQwen3.6-35B-A3B with the data guide57.3%67.3%47.3%$2.31+42.0 (38.0 to 46.0)reference, no claim

Where it falls short

Fine tuning then RL missed four of 600: three on units and one on gross sales, all on new question types held out of training. Units by store, a held out combination, accounts for most of them. Claude Sonnet 5.5 missed four of 600, all filtering by the Apparel department.

What it costs

Costs are measured: every token each model read and wrote on the 600 questions, at list prices on 27 November 2026. Ours is the list price of the service that hosted it for this study, not a price we charge. Our prompt averages 746 tokens; the general models’ prompts, with the guide, average 1,833 to 3,083 (tokenizers differ).

  1. Our model$0.88
  2. Untuned$2.313x
  3. Qwen4 Max$2.983x
  4. Claude Sonnet 5.5, cached and batched$3.874x
  5. GPT-6.2 Sol$7.258x
  6. Claude Sonnet 5.5, cached$7.759x
  7. Inkling$8.259x
  8. Claude Sonnet 5.5$12.9715x
  9. Gemini 4 Carbon$17.1219x
Measured cost per 1,000 queries, and each model’s multiple of ours. Hatched: the untuned model, and estimates for Claude Sonnet 5.5 with prompt caching, and with caching and batch pricing, assuming every part of the prompt but the question is read from the cache at a tenth of the input price.

The same base model given the guide costs $2.31 per 1,000, from its longer prompts and answers; the rest of the gap to the general models is the price of a model with 3B active parameters.

Limits

  • Training data. The model we registered before training was a first fine tuning run on 3,000 questions. On this same test it scored 98.0%, which by our claim words trails Claude Sonnet 5.5 by 1.3 points, and eleven of its twelve misses were shares broken out by month, a question form training never showed. We then added 150 such questions for sales metrics and trained both setups reported here, so each was built after that test result was known. No test question entered training. On the fresh set, which no training or checkpoint choice used, the two setups scored 98.8% and 99.7%; the general models ran on the first test set only.
  • Cost at matched accuracy, by design. With the 25 rules written down, Claude Sonnet 5.5 scores 100% on the first 100 validation questions, so this study tests cost at matched accuracy, not an accuracy win.
  • One benchmark company. One warehouse and one SQL dialect. Real warehouses have more tables, and rules that are only partly written down.
  • Template wording. The questions follow templates with varied wording; analysts ask in more ways.
  • One attempt. Each model answered once, without running its query first. No latency was measured.
  • Harder rules. On a harder set (costs that change over time, cohort retention, repeat rates), Claude Sonnet 5.5 with the rules written down scored 100% on 100 validation questions. General models follow written rules very well.
  • No contamination. The warehouse was built after every general model’s training cutoff, so none could have seen it; our model saw only its training questions, never a test question.