build and test a challenge solver with machine learning in a lab · lesson 6 of 7 · sources checked 2026-11-30
evaluate a solver
This lesson measures a lab solver with two rates and their intervals, a positive control, and one result for each scheme version.
purpose
A correct answer to a challenge is not yet a pass. The origin checks the token later, and that check can refuse a correct answer. A person who designs or buys a challenge must read a solver result at the token, not at the task.
objectives
- Separate the solve rate from the token-accept rate for each attempt.
- Report each rate with its Wilson interval, for each scheme version alone.
- Add a positive control that proves that the origin can accept a token.
- Calculate the success after k attempts with the retry formula.
- Explain what a gap between the two rates shows the designer of a gate.
new terms
how it works
Each test goes to your own lab: a challenge generator that you host, your own gate, and your own token server. No test goes to a commercial challenge or to a site of a third party.
two rates, not one
An attempt of a lab solver ends at two checks. First, the gate checks the answer. Then the client presents the token, and the origin checks it.
A solve is a correct answer for which the gate issues a challenge token. For example, a correct answer to a text task gets a token, and a wrong answer gets none.
Thus I use two rates:
- The solve rate: the solves divided by the attempts.
- The token-accept rate: the tokens that the origin accepts, divided by the solves.
example A solver makes 400 attempts and gets 240 solves. The origin accepts 180 of the 240 tokens. The solve rate is 60%, and the token-accept rate is 75%. Only 180 of 400 attempts, or 45%, get the real content.
the four outcomes of one attempt
Each attempt has one of four outcomes. The diagram shows them as a table:
- A solve, and the origin accepts the token: a success.
- A solve, and the origin refuses the token. The cause is a check at the origin, for example session binding or the token lifetime.
- No solve, and the origin accepts a token: a false pass. The gate or the test has a fault.
- No solve, and the origin refuses: the expected fail.
A third check at the origin is the spent list: the origin accepts each token one time only.
A gap between the two rates shows the checks of the origin at work. For example, the gate issues a token to web session A, and the client presents it from web session B. The binding check refuses it. More detail on the binding is in Token binding and attestation.
A solver measurement follows one chain from the attempt to the accepted token. More detail is in How to measure a solver, and why the solver axis was never measured (not yet published).
the interval
Each rate is a share of a count. A small count permits a wide range of true rates. The Wilson interval gives that range at a stated level, for example 95%. It stays valid near 0% and 100%.
For example, the code example gives 156 accepted tokens in 208 solves. That is 75.0%, with a 95% interval of 68.7% to 80.4%. A report gives the count, the rate, and the interval together. More detail is in Trials as Bernoulli events and the Wilson interval (not yet published).
one result for each scheme version
A scheme version has its own task set and its own difficulty. A mean over versions depends on the mix of attempts, not only on the solver.
example A solver gets 90% on 100 attempts of version A and 10% on 300 attempts of version B. The pooled rate is 120 of 400, or 30%. No version has that rate. Thus a report gives each version alone, with its interval.
the positive control
A test page can show no pass for a long time. Then you cannot know if the solver fails, or if the page cannot issue a valid token at all.
A positive control closes this question. Before the solver attempts, the test presents tokens that the gate issued for known correct answers. The origin must accept each of them.
For example, the test presents 10 such tokens, and the origin must accept 10 of 10. If it refuses one, the measurement stops. A refusal of a solver token then gives no information about the solver.
retries
A client can try again after a fail. With independent attempts and a success rate p for one attempt, the success after k attempts is 1 - (1 - p)^k. For example, p = 0.3 and k = 3 give 1 - 0.343 = 0.657, or 65.7%.
The formula holds only for independent attempts. A gate can decide one time for each web session. Then a second attempt in the same web session gets the same result, and the formula gives a value that is too high.
For the designer of a gate, the formula gives the value of a free retry. A low rate for one attempt with free retries is not a strong gate. A limit of attempts for each web session, or a new task after each fail, stops the attempts from adding up.
the two charts
The first chart in the section "Data" shows the two rates for four scheme versions of my lab generator.
A real gate with more checks at the origin can give a gap. The second chart shows the retry formula for three rates of one attempt.
the two sides
| automation side | detection side |
|---|---|
| Count only a solve with an accepted token. Report each rate with its interval. Give one result for each scheme version, and do not pool them. Run a positive control first. | The defender sees the same chain from the other end: a token issued, presented, accepted, or refused. A gap between the solve rate and the token-accept rate shows the checks of the origin at work. A limit of attempts for each web session lowers the value of a retry. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| Report the solve rate only | The test is simple. | It hides each refusal at the origin. | Never as the result of a solver |
| Report the two rates with intervals | Each check shows its own effect. | The test must log the gate and the origin. | For each evaluation |
| Pool all scheme versions | One number | The number depends on the mix of attempts. | Never |
| One result for each scheme version | Each value has one meaning. | Each version must have sufficient attempts. | For each report |
| A positive control first | A fail of the solver is real. | One more step before each test | For each test |
| Give the success after k attempts | It shows the value of a retry. | It holds only for independent attempts. | When the gate permits retries |
diagram
A table of the four outcomes of one attempt: a solve or no solve, against the origin accepts or refuses the token. Only a solve with an accepted token is a success. No solve with an accepted token is a false pass.
| result at the gate | the origin accepts the token | the origin refuses the token |
|---|---|---|
| Solve: correct answer, token issued | Success: count it | Binding, lifetime, or spent list |
| No solve: no token issued | False pass: fault in gate or test | Expected fail |
code example
The example evaluates two scheme versions. The counts are invented. No count comes from a real gate or from a real product. The example first checks the positive control, then gives the two rates with Wilson intervals for each version, and then the retry formula.
Check a positive control. Then give the two rates with 95% Wilson intervals for each scheme version, and the success after k attempts.
// INVENTED attempt counts for this example. No value comes from a real gate.
type Version = { version: string; attempts: number; solves: number; accepted: number };
const RECORDS: Version[] = [
{ version: "scheme version A", attempts: 400, solves: 360, accepted: 342 },
{ version: "scheme version B", attempts: 400, solves: 208, accepted: 156 },
];
// Positive control: tokens that the gate issued for known correct answers.
const CONTROL = { presented: 20, accepted: 20 };
const Z = 1.96; // 95% interval
function wilson(k: number, n: number): [number, number] {
const p = k / n;
const d = 1 + (Z * Z) / n;
const c = (p + (Z * Z) / (2 * n)) / d;
const h = (Z * Math.sqrt((p * (1 - p)) / n + (Z * Z) / (4 * n * n))) / d;
return [Math.max(0, c - h), Math.min(1, c + h)];
}
function line(name: string, k: number, n: number): string {
const [lo, hi] = wilson(k, n);
const pct = (x: number) => `${(100 * x).toFixed(1)}%`;
return ` ${name}: ${k}/${n} = ${pct(k / n)}, 95% interval ${pct(lo)} to ${pct(hi)}`;
}
// 1. The positive control comes first. If it fails, no result stands.
if (CONTROL.accepted !== CONTROL.presented) {
console.log(`positive control: ${CONTROL.accepted}/${CONTROL.presented} accepted; stop, the origin cannot accept a token`);
process.exit(1);
}
console.log(`positive control: ${CONTROL.accepted}/${CONTROL.presented} accepted; the measurement can go on`);
// 2. Two rates for each scheme version, never one pooled value.
for (const r of RECORDS) {
console.log(r.version);
console.log(line("solve rate", r.solves, r.attempts));
console.log(line("token-accept rate", r.accepted, r.solves));
console.log(line("accepted for each attempt", r.accepted, r.attempts));
}
console.log("pooled value: not reported, because the scheme versions differ");
// 3. The retry formula: success after k independent attempts.
const b = RECORDS[1];
const p = b.accepted / b.attempts;
for (let k = 1; k <= 3; k++) {
console.log(`${b.version}, ${k} attempt(s): ${(100 * (1 - (1 - p) ** k)).toFixed(1)}%`);
}output
The result of the positive control, three rates with intervals for each version, the pooled-value line, and the success after 1 to 3 attempts.
positive control: 20/20 accepted; the measurement can go on
scheme version A
solve rate: 360/400 = 90.0%, 95% interval 86.7% to 92.6%
token-accept rate: 342/360 = 95.0%, 95% interval 92.2% to 96.8%
accepted for each attempt: 342/400 = 85.5%, 95% interval 81.7% to 88.6%
scheme version B
solve rate: 208/400 = 52.0%, 95% interval 47.1% to 56.9%
token-accept rate: 156/208 = 75.0%, 95% interval 68.7% to 80.4%
accepted for each attempt: 156/400 = 39.0%, 95% interval 34.3% to 43.9%
pooled value: not reported, because the scheme versions differ
scheme version B, 1 attempt(s): 39.0%
scheme version B, 2 attempt(s): 62.8%
scheme version B, 3 attempt(s): 77.3%The output shows a larger gap between the two rates for version B than for version A. It also shows that a retry raises the success of version B when the attempts are independent.
data
solve rate and token-accept rate for each scheme version
status of this figure: measured by me
lines: interval, level 0.95
source: Lab result of this course: my lab solver against my own gate and token server; date 2026-11-13; sample of 200; condition: Own generator, gate, and token server; one host. Each model has 200 attempts, trained 2,000 steps. Interval bounds have at most 4 decimals. Teaching values; they do not transfer.
data table
| series | scheme version | % | interval |
|---|---|---|---|
| solve rate | scheme version 1 | 96 | 92.3068 to 97.9594 (level 0.95) |
| solve rate | scheme version 2 | 59.5 | 52.5797 to 66.0622 (level 0.95) |
| solve rate | scheme version 3 | 2.5 | 1.0724 to 5.7179 (level 0.95) |
| solve rate | scheme version 4 | 74 | 67.5093 to 79.5862 (level 0.95) |
| token-accept rate | scheme version 1 | 96 | 92.3068 to 97.9594 (level 0.95) |
| token-accept rate | scheme version 2 | 59.5 | 52.5797 to 66.0622 (level 0.95) |
| token-accept rate | scheme version 3 | 2.5 | 1.0724 to 5.7179 (level 0.95) |
| token-accept rate | scheme version 4 | 74 | 67.5093 to 79.5862 (level 0.95) |
success after k attempts for three success rates of one attempt
status of this figure: example
source: My model: success after k attempts, from the formula 1 - (1 - p)^k; date 2026-11-16; condition: The model has independent attempts. Each value is the exact result of the formula, with at most 3 decimal places. This is a calculation, not a measurement.
data table
| series | attempts | % |
|---|---|---|
| success of one attempt 20% | 1 attempt | 20 |
| success of one attempt 20% | 2 attempts | 36 |
| success of one attempt 20% | 3 attempts | 48.8 |
| success of one attempt 20% | 4 attempts | 59.04 |
| success of one attempt 20% | 5 attempts | 67.232 |
| success of one attempt 40% | 1 attempt | 40 |
| success of one attempt 40% | 2 attempts | 64 |
| success of one attempt 40% | 3 attempts | 78.4 |
| success of one attempt 40% | 4 attempts | 87.04 |
| success of one attempt 40% | 5 attempts | 92.224 |
| success of one attempt 60% | 1 attempt | 60 |
| success of one attempt 60% | 2 attempts | 84 |
| success of one attempt 60% | 3 attempts | 93.6 |
| success of one attempt 60% | 4 attempts | 97.44 |
| success of one attempt 60% | 5 attempts | 98.976 |
failure modes
| problem | cause | correction |
|---|---|---|
| A solver with a high solve rate gets little real content. | The report counts the solves, and the origin refuses many tokens. | Report the solve rate and the token-accept rate as two metrics. |
| Two reports of one solver give different values. | Each report pooled a different mix of scheme versions. | Give one result for each scheme version, with its interval. |
| A test page never gives a pass, and nobody knows why. | The test had no positive control. | Present known good tokens first. Stop when the origin refuses one. |
| A rate of 2 in 10 looks like a real difference from 4 in 10. | The report gives no interval. | Give the count, the rate, and the Wilson interval together. |
| The success after retries is lower than the formula gives. | The gate decides one time for each web session, so the attempts are not independent. | Use the formula only for independent attempts, and measure the retries. |
| A false pass enters the success count. | The origin accepts a token for which the gate had no solve. | Log the gate and the origin, and examine each false pass as a fault. |
check questions
A lab solver makes 400 attempts and gets 300 solves. The origin accepts 240 of the tokens. What is the token-accept rate?
- 60%
- 80%
- 75%
answer
b. 80%
The token-accept rate is the accepted tokens divided by the solves: 240 of 300 is 80%. The solve rate is 300 of 400, or 75%.
A report gives one solve rate for all scheme versions together. What is the problem?
- The value depends on the mix of attempts across the versions, not only on the solver.
- A Wilson interval cannot be given for a pooled count.
- The token-accept rate is then always higher.
answer
a. The value depends on the mix of attempts across the versions, not only on the solver.
Each scheme version has its own difficulty. A pooled rate changes when the mix of attempts changes, thus the report gives each version alone, with its interval.
A test page gives no pass in 500 attempts. What must you add before you report that the solver fails, and why?
sample answer
Add a positive control: present tokens that the gate issued for known correct answers, and check that the origin accepts each of them. If the origin refuses one, the page cannot accept a valid token, and the 500 fails give no information about the solver.
One attempt succeeds with p = 0.5. The attempts are independent. What is the success after 2 attempts?
- 100%
- 50%
- 75%
answer
c. 75%
The formula gives 1 - (1 - 0.5)^2 = 1 - 0.25 = 0.75, or 75%.
Explain what a gap between the solve rate and the token-accept rate shows the designer of a gate.
sample answer
The gap shows the checks of the origin at work. The gate issued a token for a correct answer, but the origin refused it. Examples are the binding check, the token lifetime, and the spent list. The answer to the task alone did not give a pass.
exercise
exercise Do this task on paper, with the invented counts of the table. They come from no real gate.
| item | scheme version c | scheme version d |
|---|---|---|
| Attempts | 100 | 100 |
| Solves | 80 | 40 |
| Tokens that the origin accepts | 60 | 36 |
| Positive control | 10 of 10 accepted | 10 of 10 accepted |
- Write if the measurement can go on, from the positive control.
- Calculate the solve rate and the token-accept rate of each version.
- Calculate the share of attempts that get the real content for each version.
- Write why the report does not give one pooled rate.
- Calculate the success of version D after 2 independent attempts, from the share of step 3.
sample answer
The answer uses the counts of the table.
The positive control accepts 10 of 10 tokens for each version, thus the measurement can go on. Version C has a solve rate of 80 of 100, or 80%, and a token-accept rate of 60 of 80, or 75%. Version D has a solve rate of 40% and a token-accept rate of 36 of 40, or 90%.
For version C, 60% of the attempts get the real content. For version D, 36% get it. The two versions differ, thus a pooled rate depends on the mix of attempts. The report gives each version alone. For version D, p = 0.36 and k = 2 give 1 - 0.64 x 0.64 = 1 - 0.4096 = 0.5904, or about 59%.
sources
- My model of the two rates, the four outcomes of one attempt, the positive control, and the retry formula, 2026-11 (not public).
- Lab result of this course: the two rates of my lab solver against my own gate and token server, in the first chart (not public).