Spaces:
Paused
Paused
Commit History
-
feat(v2): execution-grounded rewards via DuckDB -- the key differentiator
Abhinav SinghTHE CORE INNOVATION: optimized SQL queries are ACTUALLY EXECUTED against a real in-memory DuckDB database. Reward is computed from measured performance, not keyword heuristics. New files: executor.py — DuckDB engine with 4 synthetic tables (users 10k, orders 500k, products 1k, events 1M). Runs both the original and optimized query 3x each, returns median timing, result correctness, and EXPLAIN plan. leaderboard.py — In-memory best-score tracker per task, surfaced via the new /leaderboard endpoint. test_env.py — Integration test confirming real speedup (3-4x on Task 1 measured on local machine). Updated reward function (graders.py): Real Execution Speedup 35% (was: not measured at all) Result Correctness 20% (NEW: both queries must return same data) Issue Detection 25% (was: 60% keyword-only) Approval Correctness 8% Summary Quality 7% …c15d346
-
feat(data): add Pydantic models and task definitions
Abhinav Singhmodels.py: - Observation: task metadata + sql_query + schema_info + dialect - Action: suggestions list + optimized_query + summary + estimated_improvement + approved flag - Reward: score (0-1), per-criterion breakdown dict, feedback str - StepResult and EnvironmentState for REST API responses tasks.py: - task_1_basic_antipatterns (easy, 3 steps): SELECT *, non-SARGable CAST/YEAR() predicates blocking index usage on a 5M-row orders table - task_2_join_optimization (medium, 4 steps): 3 correlated subqueries causing N+1 pattern across users/orders/products (10M+ row tables), missing index on filter column, unindexed ORDER BY - task_3_advanced_optimization (hard, 5 steps): JSONB arrow expression killing index, CTE over-materialization, window function sort cost, implicit ::text cast preventing index use, autovacuum bloat risk, HAVING without pre-filter on 500M-row events table - get_task_list() for /tasks endpoint with full action schemac540c55