Skip to content

Check your work

Read · 1 of 2

Generator and checker

Models are much better at checking an answer than at getting it right first time. So pair them: one step generates an answer, another verifies it against clear rules, and a failed check (with its reason) goes back for another try.

The best checkers are code, not opinions: does it parse, do the tests pass, are the numbers the same ones you started with? Use a model as a judge only for what code can't check.

Read this lesson as text

Generate, verify, retry. A checker makes a weak answer strong.

Generator and checker

Models are much better at checking an answer than at getting it right first time. So pair them: one step generates an answer, another verifies it against clear rules, and a failed check (with its reason) goes back for another try.

The best checkers are code, not opinions: does it parse, do the tests pass, are the numbers the same ones you started with? Use a model as a judge only for what code can't check.

Exercise: Verify, then retry

Line 1: a list of numbers the model was asked to sort. Then up to 3 lines: the model's attempts, in order.

Check each attempt: rejected: wrong numbers if it isn't the same numbers, else rejected: not sorted if it isn't ascending, else accepted. Print attempt i: … and stop at the first accepted one.

If none is accepted, finish with gave up.