Reward Atlas
All field guidesEsc to close
Sign in
LLM / AgenticPublicPublishedv1.0Advanced

SQL-Detective-v1

A multi-turn agent answers analytics questions by querying a read-only SQLite sandbox. Tool use, verifiable rewards, 12-turn budget. Maintained by Bhaskar & Jaswanth · updated 28 Aug 2026.

Dataset
2,400 q · 12 DBs
Action
tool call | final answer
Turn cap
12
Best baseline
GRPO-7B 61.4%
11

Baselines & results

Results

modelmethodexact matchavg turns
7BGRPO, 800 steps61.4%5.8
7BSFT on 2k traces49.0%4.1
7BBase (no training)38.2%3.2
Eval split (400 questions), mean over 3 seeds
Eval exact match during GRPO training
View as table
training stepsGRPO 7B
038.2
5042.9
10045.5
15047.8
20050.9
25053
30053.7
35055
40056.9
45057.5
50057.4
55058.5
60059.7
65059.4
70059.2
75060.3
80060.9

Inspect a complete example trajectory

Aggregate scores tell you whether a policy works. This run shows how it worked: every visible decision, tool call, environment response, correction and verifier receipt in order.

Run trace · sample-0241 / rollout-03pass

Find the three product categories with the largest revenue drop from Q1 to Q2 2024.

Model
GRPO-7B · seed 2
Reward
1.0
Duration
18.4 s
Tokens
2.8k
Cost
$0.006
Input
24 tokens

Find the three product categories with the largest revenue drop from Q1 to Q2 2024. Return category and revenue_drop.

Output
41 tokens

Outdoor — 27,144.80

Kitchen — 19,802.35

Books — 12,110.00

Workflow map

  1. Orient

    Read the task and inspect available tables.

  2. Ground

    Resolve keys, prices and category names from schema.

  3. 3Correct

    Notice that positive deltas rank growth, then reverse the ordering.

  4. Verify

    Submit exact rows and preserve the grader receipt.

Observable trace

Messages, tool calls, results and scoring—not hidden reasoning.

  1. 01 · TaskEvaluation prompt

    Which three product categories had the largest drop in revenue between Q1 and Q2 2024? Return category and revenue_drop.

  2. 02 · AgentChoose schema-first exploration 0.9 s184 tok$0.0004

    The requested metric spans products, categories and dated orders. Inspecting the schema before querying avoids guessing join keys or date fields.

  3. 03 · ToolList database tables 42 ms

    Discover the available relations.

    list_tables()
    ["orders", "order_items", "products", "categories", "customers"]
  4. 04 · ToolInspect the three relevant schemas 71 ms

    Confirm the foreign keys, order timestamp and revenue inputs.

    describe_table("orders"); describe_table("order_items"); describe_table("products")
    orders(id, ordered_at) order_items(order_id, product_id, quantity, unit_price) products(id, category_id)
  5. 05 · AgentForm the comparison query 1.6 s421 tok$0.0009

    Aggregate quantity × unit_price by category and quarter, then compare Q1 with Q2. The first ordering is kept visible because it led to a useful correction.

  6. 06 · ToolRun the first query 84 ms

    The query is valid, but the sign and ordering expose growth rather than decline.

    SELECT c.name, q2.revenue - q1.revenue AS delta
    FROM quarterly q1 JOIN quarterly q2 USING (category_id)
    JOIN categories c ON c.id = q1.category_id
    ORDER BY delta DESC LIMIT 3;
    Home office | 18420.70 Audio | 9250.10 Accessories | 6118.40
    warn
  7. 07 · AgentCorrect the ranking direction 0.7 s163 tok$0.0003

    A revenue drop is Q1 − Q2, so positive values should be ranked descending. Reversing the subtraction fixes both the meaning and the sort without changing the joins.

  8. 08 · ToolRun the corrected query 79 ms

    Execute the corrected comparison and retain the exact rows for submission.

    SELECT c.name, ROUND(q1.revenue - q2.revenue, 2) AS revenue_drop
    FROM quarterly q1 JOIN quarterly q2 USING (category_id)
    JOIN categories c ON c.id = q1.category_id
    ORDER BY revenue_drop DESC LIMIT 3;
    Outdoor | 27144.80 Kitchen | 19802.35 Books | 12110.00
    pass
  9. 09 · ToolSubmit the result rows 31 ms

    End the episode with the three grounded rows.

    submit_answer([["Outdoor",27144.80],["Kitchen",19802.35],["Books",12110.00]])
  10. 10 · VerifierExact multiset match 12 ms

    The submitted categories and values match the reference result. Row ordering is ignored; numeric tolerance is 1e-6.

    passreward +1.0

Run artifacts

Final answerjson
[["Outdoor", 27144.80], ["Kitchen", 19802.35], ["Books", 12110.00]]
Verifier receiptjson
{
  "exact_match": true,
  "matched_rows": 3,
  "invalid_queries": 0,
  "reward": 1.0
}
Guide details
Version
Type
LLM / Agentic
API
OpenEnv
License
Apache-2.0
Seeds
3
Domains
tool-usedatacoding
Install
pip install reward-atlas-sql-detective

Issue with this step? Suggest an edit