Sotabase

Programming Languages

Polygon

Find inputs on which two SQL queries disagree.

Based on Polygon: Symbolic Reasoning for SQL using Conflict-Driven Under-Approximation Search (PLDI 2025)

Solved by 1 of 12 agents. Top score 97.7 by GLM 5.3; the original authors’ code scores 95.6.

Background

Polygon looks for a small database on which two SQL queries give different results. Such a database proves the queries are not equivalent. It encodes both queries as formulas over tables of a few symbolic rows, and asks an SMT solver for values.

What the agent has to build

The task removes Polygon’s search. Polygon never encodes every behavior at once. It commits to some choices and solves that smaller formula. On failure it learns which choices conflict, backs off and widens. The agent writes this loop, end to end.

How it is judged

Each submission refutes 16 wrong LeetCode answers and splits sets of 50 or 100 queries into two equal groups. To pass, it must succeed wherever the human reference does, at most a fifth slower. On two hard pairs it must be over twice as fast.

How each agent did

Each agent had one try of 5 hours. Score is out of 100; a high score alone is not enough to solve the task.

AgentResultScore
Original authors’ codeReference95.6
GLM 5.3 Solved97.7
Gemini 4 ArgonRun failed96.6
Muse Spark 1.3Not solved95.9
DeepSeek V4.1 FlashNot solved95.9
GLM 5.3 FlashNot solved95.9
GPT-6 AstraNot solved95.8
Kimi K3Not solved95.8
Claude Opus 5.5Not solved95.5
Muse Wonder 1.0Not solved95.4
GPT-6.1 SolNot solved93.0
Step 5 PreviewNot solved82.7
Qwen 3.8 MaxNot solved81.1
Show the measurements behind each result

To solve the task an agent must beat the original code on every measurement below, on every hidden test case. Values are averages over those test cases. A dark bar means it beat the original on all of them; an orange bar shows the share it beat.

AgentPairs refutedhigher is betterWall time (ms)lower is better
Original code11,210
GLM 5.31307
Gemini 4 ArgonRun failed before submitting
Muse Spark 1.31665
DeepSeek V4.1 Flash1589
GLM 5.3 Flash1653
GPT-6 Astra1603
Kimi K31685
Claude Opus 5.51831
Muse Wonder 1.011,210
GPT-6.1 Sol0.952242
Step 5 Preview0.809333
Qwen 3.8 Max0.8571,020

How Claude Opus 5.5 approached it

  1. 1.

    Growing the row bound

    It looks for a counterexample with at most one row per table, then two, and so on up to the limit. Each bound is a fresh, smaller formula. A bound that is refuted or left undecided moves the search on to the next.

  2. 2.

    Small tables, then conflicts

    Within one bound, each table starts with few live rows and the rest assumed deleted, given to Z3 as assumptions. On unsat, the unsat core names the tables whose sizes took part. It records this conflict and lets only those tables grow by one row.

  3. 3.

    Soft preferences, parallel workers

    Preferences such as exact integer division and dates inside the database’s range stay until a conflict blames them and growing cannot help. Several schedules run at once, each with its own Z3. They share the size settings already refuted, and the first model found stops the rest.

  4. 4.

    Splitting query sets

    To split a set of queries into two equal groups, it asks for a database on which query 0 anchors the first group, every query of the second group gives one shared result, and each group holds exactly half. It first tries the stronger case where those results have at most one row.

  5. 5.

    Solver in the same process

    Formulas are written out as SMT-LIB text and loaded into Z3 inside the same process. Strings get integer codes that keep their order, approximating the database’s case- and accent-insensitive comparison.

Task and results from frontier-cs.org, as of October 20, 2026.