Find eval tasks where a candidate model scores below the baseline with a self join
Why it matters Release gates for LLMs compare a candidate against the current model task by task, often from one long scores table.
Before shipping a new model you check every task where it got worse than the current one. Both models live in the same scores table, so you join the table to itself.
Write query() returning a SQLite SQL string. Table scores(model TEXT, task TEXT, score REAL), at most one row per (model, task).
Compare model 'cand' against model 'base'. Return (task, base_score, cand_score) for every task that BOTH models have and where cand's score is strictly lower than base's. Order by the drop (base_score - cand_score) descending, then task ascending.
def query()Example
base qa 0.8, cand qa 0.7, base math 0.5, cand math 0.6, base code 0.4 (no cand row) give [('qa', 0.8, 0.7)].
Understand the idea
A self join joins a table to itself under two different aliases. It is how you compare rows of the same table, such as two models on the same task or a checkpoint with the one before it.
Worked example: alias b keeps base rows, alias c keeps cand rows, joined on task. qa pairs (0.8, 0.7) and math pairs (0.5, 0.6). code has no cand row, so the inner join drops it. Only qa has c.score < b.score, with a drop of 0.1.
Rule: FROM t AS b JOIN t AS c ON c.key = b.key WHERE b.kind = 'x' AND c.kind = 'y'. Each alias acts like its own copy of the table.
Model release checks, regression reports between checkpoints and pairwise preference tables all use self joins.