build and test a challenge solver with machine learning in a lab · lesson 2 of 7 · sources checked 2026-11-30
the solver pipeline in the lab
This lesson builds a solver pipeline in your own lab against your own generator, and reads each stage from the side of the defender.
status of this lesson: from a public sourcepurpose
A person who designs or buys a challenge must know where a solver spends its time and where it leaves a trace. The visible task is only one part of that path. When you build each part against your own generator, you can see which check of your gate each part meets.
objectives
- Name the seven stages of a solver pipeline, and the residual tell and the design answer of each stage.
- Build a lab guard that refuses each host outside the lab.
- Build a pipeline skeleton with a type gate, a time ceiling, and a time log for each stage.
- Read the time of each stage as a defender reads it.
new terms
- solver pipeline
- The stages of a solver: detect, capture, perceive, search, act, check, and route.
- lab guard
- Code that refuses each request to a host outside the lab.
- type gate
- The stage that skips a challenge type with no task to perceive, before a paid call.
- action stage
- The stage that turns a solution into a pointer path, a click, or typed text.
how it works
A solver pipeline is the set of stages that a solver goes through for one challenge. I use seven stages.
Six of the seven stages leave a residual tell. That is a signal that stays when the stage works as designed. The gate has a design answer to each of them.
| stage | what it does | residual tell | design answer |
|---|---|---|---|
| Detect | Finds the challenge and its type | A fetch of the challenge with no page view before it | Issue the challenge only in a web session that loaded the page |
| Capture | Copies the task data | A task that nobody shows on a real screen | The environment check |
| Perceive | Reads the task | None: a correct answer is the expected output | Do not rest the security on the task |
| Search | Finds the answer, or the nonce of a proof-of-work task | CPU time | A difficulty schedule |
| Act | Gives the answer as a click, a pointer path, or typed text | The path and its timing | The behavior check |
| Check | Reads if the gate issued a token | The token chain at the origin | The token server |
| Route | Gives the token to the client that uses it | A token from a different identity | session binding |
For example, a pipeline gives a correct answer to a text task of your generator. Perception passes. The act stage, the route stage, and the token chain still meet checks of the gate.
the lab boundary
All work of this module stays in your own lab. A lab guard is the first part of the pipeline code. It reads the host of each request before the request leaves, and it refuses each host that is not on the lab list.
The lab list holds the loopback name and the names of the lab network. For example, a request to the address of the lab gate passes. A request to any other host fails before a byte leaves the solver host. The guard uses the rule fail closed: a host that it cannot read is a refusal.
The first diagram shows the shared lab. The generator, the gate, and the token server are yours. No route goes to a third party.
the type gate and the time ceiling
The generator of the lab has two classes. A text class shows an image of a short string. A proof of work (PoW) class gives a puzzle with no image.
A type gate reads the type after the detect stage. A type with no task to perceive skips the capture and the perceive stages. For example, the proof-of-work class goes from detect to search. No perception call starts for it.
A time ceiling stops an attempt after a fixed time. The pipeline then writes the result "timeout" for that attempt. A timeout is a result of the attempt, not a failure of the lab.
Each stage writes its time to a log. The act stage is the action stage. Its time and its path are a part of the record, and the later lessons read them.
what the public record says
claim of a publisher In 2021, a W3C note stated that methods with image tasks, logic problems, or audio "can be largely cracked" by computer algorithms. It also stated that the use of a CAPTCHA as a security solution is becoming increasingly ineffective W3C, source 1.
My model starts from this point. A pipeline in the lab passes the perceive stage. The question for the defender is which other stage meets a check that it cannot pass.
read the time as a defender
The section "Data" shows the time of each stage in my lab. For a text task, the perceive stage is a small part of the time. For the proof-of-work class, the perceive stage is skipped, and the search stage takes the time.
Thus a defender reads two points. The time of perception is a small part of the time of the lab solver. A proof-of-work task puts its price in the search stage, and that price falls on each client.
The act stage leaves a path and its timing. More detail is in The action stage and its timing (not yet published). The origin checks each token before it accepts it. More detail is in Token binding and attestation.
the two sides
| automation side | detection side |
|---|---|
| A pipeline with a type gate skips a type that has no task to perceive, so no perception call starts. Each stage adds time, and the time ceiling ends a slow attempt. | Each stage leaves a residual tell. Examples are a challenge fetch with no page view, the path of the act stage, and a token from a different identity. The design answers are the token server, the behavior check, and session binding. |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| A lab guard with a list of permitted hosts | Each host that is not on the list fails | You must add each new lab host to the list | For each pipeline in the lab |
| A list of forbidden hosts | Short to write | Each host that you forgot passes | Never |
| A type gate before the perceive stage | No perception call for a type with no image | One more step in the code | When the generator has more than one class |
| A time ceiling for each attempt | A slow attempt ends with a clear result | A slow correct answer counts as a timeout | For each attempt |
| A time log for each stage | You see which stage meets which check | More log data | For each lab measurement |
diagram
the shared lab of the solver modules, inside one boundary
- GeneratorYour own challenge generator, with a seed and a scheme version for each challenge.no result
- Gate and token serverThe gate of the defender lab. It issues each token and checks it at the origin.no result
- Solver hostThe solver pipeline. Each stage writes its time to a log.no result
- RecorderStores the time log and the path of each attempt.no result
- Lab guardReads the host of each request before the request leaves. It permits only loopback and the lab hosts.pass
- Third-party hostsNo route. A request to a host outside the lab list fails before it leaves the solver host.fail
No route leaves the labpass
the seven stages of a solver pipeline, with the residual tell and the design answer of each stage
The second diagram is the map of the table in "How it works".
code example
The first example is the lab guard. The host names are invented lab names with a reserved example domain.
A lab guard that refuses each request host that is not on the lab list.
// A lab guard: the solver calls labGuard() before each request.
// Only the loopback name and the invented lab hosts pass. All else is refused.
const LAB_HOSTS = new Set(["localhost", "gate.lab.example", "tokens.lab.example"]);
export function labGuard(target: string): { ok: boolean; host: string; why: string } {
// The target is a host name with an optional port, for example "localhost:8080".
const m = /^([a-z0-9.-]+)(?::\d{1,5})?$/i.exec(target);
if (!m) return { ok: false, host: "(unreadable)", why: "the target cannot be read" };
const host = m[1].toLowerCase();
if (LAB_HOSTS.has(host)) return { ok: true, host, why: "on the lab list" };
return { ok: false, host, why: "not on the lab list" };
}
// Synthetic targets come from the arguments. No request is sent.
if (process.argv[1]?.endsWith("lab-guard.ts")) {
for (const t of process.argv.slice(2)) {
const r = labGuard(t);
console.log(`${r.host}: ${r.ok ? "pass" : "refuse"} (${r.why})`);
}
}output
One line for each synthetic host: the host, and the result with its reason.
gate.lab.example: pass (on the lab list)
localhost: pass (on the lab list)
shop.example.com: refuse (not on the lab list)
gate.lab.example.other.example: refuse (not on the lab list)
(unreadable): refuse (the target cannot be read)The run has five synthetic hosts as its arguments: gate.lab.example:8080, localhost:9000, shop.example.com, gate.lab.example.other.example, and the text gate lab. The output shows that only exact lab hosts pass. A longer name that only starts with a lab name fails, and a host that the guard cannot read is a refusal.
The second example is the pipeline skeleton. It holds the rule of the lab guard in a short form. Each stage is an interface. The perceive stage is empty, and it holds no model. A synthetic clock gives each stage a fixed time, so that the output is the same in each run.
A pipeline skeleton with one interface for each stage, a type gate, a time ceiling, and a time log for each stage.
// The rule of the lab guard example, in short form: only lab hosts pass.
const LAB_HOSTS = new Set(["localhost", "gate.lab.example", "tokens.lab.example"]);
const labGuard = (host: string) => LAB_HOSTS.has(host.toLowerCase())
? { ok: true, why: "on the lab list" } : { ok: false, why: "not on the lab list" };
type Challenge = { id: string; kind: "text" | "pow"; gate: string };
type Stage = "detect" | "capture" | "perceive" | "search" | "act" | "check" | "route";
// Each stage returns its synthetic time in ms. The perceive stage is empty on purpose.
const STAGES: Record<Stage, (c: Challenge) => number> = {
detect: () => 2, capture: () => 1, perceive: () => 0,
search: (c) => (c.kind === "pow" ? 7 : 0), act: () => 1, check: () => 1, route: () => 0,
};
const CEILING_MS = 10;
function run(c: Challenge): void {
const guard = labGuard(c.gate);
if (!guard.ok) { console.log(`${c.id}: refused by the lab guard (${guard.why})`); return; }
let total = 0;
const log: string[] = [];
for (const s of Object.keys(STAGES) as Stage[]) {
// Type gate: a type with no task to perceive skips capture and perceive.
if (c.kind === "pow" && (s === "capture" || s === "perceive")) { log.push(`${s}=skipped`); continue; }
const ms = STAGES[s](c);
total += ms;
log.push(`${s}=${ms}`);
if (total > CEILING_MS) { console.log(`${c.id}: ${log.join(" ")} -> timeout at ${total} ms`); return; }
}
console.log(`${c.id}: ${log.join(" ")} -> done in ${total} ms`);
}
// Argument 1: the host of the lab gate. Argument 2: a host outside the lab.
const [labGate, outside] = process.argv.slice(2);
run({ id: "text-1", kind: "text", gate: labGate });
run({ id: "pow-1", kind: "pow", gate: labGate });
run({ id: "pow-2", kind: "pow", gate: outside });output
The time log of two synthetic challenges, one of each class, and the result of each.
text-1: detect=2 capture=1 perceive=0 search=0 act=1 check=1 route=0 -> done in 5 ms
pow-1: detect=2 capture=skipped perceive=skipped search=7 act=1 check=1 -> timeout at 11 ms
pow-2: refused by the lab guard (not on the lab list)The run has two arguments: gate.lab.example and shop.example.com. The output shows the type gate and the ceiling. The proof-of-work challenge skips two stages, and the check stage takes its total over the ceiling of 10 ms. The third challenge names a host outside the lab, and the guard stops it before the first stage.
data
time for each stage of my lab solver pipeline
status of this figure: measured by me
source: Lab result of this course: stage times of my lab pipeline against my own generator; date 2026-11-13; sample of 1,000; condition: Own generator, own gate, loopback, one shared host, no browser. 5 repeats of 200 attempts for each class. Medians of the repeat medians. Teaching values; they do not transfer.
data table
| series | stage | ms |
|---|---|---|
| text version 1 | detect | 1.77 |
| text version 1 | capture | 0.82 |
| text version 1 | perceive | 1 |
| text version 1 | search | 0.01 |
| text version 1 | act | 0.8 |
| text version 1 | check | 0.77 |
| text version 1 | route | 0.0013 |
| text version 3 | detect | 2.41 |
| text version 3 | capture | 0.84 |
| text version 3 | perceive | 1.01 |
| text version 3 | search | 0.01 |
| text version 3 | act | 0.77 |
| text version 3 | check | 0.77 |
| text version 3 | route | 0.001 |
| proof-of-work class | detect | 0.82 |
| proof-of-work class | capture | 0 |
| proof-of-work class | perceive | 0 |
| proof-of-work class | search | 7.07 |
| proof-of-work class | act | 0.95 |
| proof-of-work class | check | 0.84 |
| proof-of-work class | route | 0.0013 |
The chart is a lab result of this course, against my own generator and gate. It shows where the time of each class goes, not how fast a solver is on a real gate.
failure modes
| problem | cause | correction |
|---|---|---|
| A lab request reaches a host outside the lab. | The pipeline sends a request before the lab guard reads the host. | Call the lab guard before each request, and fail closed. |
| A host with a lab name at its start passes the guard. | The guard compares the start of the name, not the full host. | Compare the full host with the lab list. |
| The pipeline starts a perception call for a proof-of-work challenge. | The pipeline has no type gate. | Add a type gate after the detect stage. |
| A slow attempt stays open, and the log has no result. | The pipeline has no time ceiling. | Stop each attempt at the ceiling, and write "timeout". |
| A defender adds a harder image task, and the pipeline time does not change. | The perceive stage is a small part of the time. | Put the security in the checks of the other stages. |
check questions
Name the seven stages of a solver pipeline. For the act stage and the route stage, name the residual tell and the design answer.
sample answer
The stages are detect, capture, perceive, search, act, check, and route. The act stage leaves the path and its timing, and the design answer is the behavior check. The route stage can give a token from a different identity, and the design answer is session binding.
The lab list holds the host of the lab gate. Which request host passes the lab guard?
- A longer name that starts with the host of the lab gate
- The host of the lab gate with a port number
- A host that the guard cannot read
- Each host of the lab network, also when it is not on the list
answer
b. The host of the lab gate with a port number
The guard compares the full host with the lab list. A port does not change the host. A longer name and a host that the guard cannot read fail.
A challenge of the proof-of-work class comes to the pipeline. What does the type gate do?
- It sends the challenge to the perceive stage first.
- It stops the attempt with the result timeout.
- It skips the capture and the perceive stages, and the challenge goes to the search stage.
- It sends the challenge to a host outside the lab.
answer
c. It skips the capture and the perceive stages, and the challenge goes to the search stage.
A type with no task to perceive skips the capture and the perceive stages. The time ceiling, not the type gate, gives a timeout.
In a lab time log, the perceive stage is a small part of the time of a text challenge. What does a defender read from this?
- A harder image task slows the solver much.
- The security of the gate must come from the checks of the other stages.
- The solver cannot read the task.
- The lab values transfer to each real gate.
answer
b. The security of the gate must come from the checks of the other stages.
When perception takes little time, a harder image task changes little for the solver. The lab values come from one host and do not transfer.
exercise
exercise Do this task on paper. Use the synthetic time log of two attempts on a lab gate of your own. No row comes from a real gate.
| attempt | class | detect | capture | perceive | search | act | check | route |
|---|---|---|---|---|---|---|---|---|
| e1 | text | 3 ms | 1 ms | 2 ms | 0 ms | 1 ms | 1 ms | 0 ms |
| e2 | proof of work | 3 ms | skipped | skipped | 40 ms | 1 ms | 1 ms | 0 ms |
The time ceiling of the pipeline is 30 ms.
- Add the stage times of each attempt.
- Write the result of each attempt: done, or timeout.
- For each attempt, write the stage with the largest time.
- For that stage, write the design answer of the gate from the table of "How it works".
sample answer
The answer uses the synthetic time log and the ceiling of the task.
Attempt e1 takes 3 + 1 + 2 + 0 + 1 + 1 + 0 = 8 ms, below the ceiling, thus it is done. Its largest stage is detect. The design answer is to issue the challenge only in a web session that loaded the page.
Attempt e2 takes 3 + 40 + 1 + 1 + 0 = 45 ms. That is over the ceiling of 30 ms, thus its result is a timeout. Its largest stage is search, and the design answer is the difficulty schedule. The perceive stage of e1 is a small part of its time, thus a harder image task does not change much for the solver.
sources
- Inaccessibility of CAPTCHA (Group Draft Note, 2021-12-16), W3C, draft, read 2026-11-22
- My model of the seven stages of a solver pipeline, their residual tells, and their design answers, 2026-11 (not public).
- Course design: the shared lab, the lab guard, and the pipeline skeleton, 2026-11 (not public).