skip to content

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 source

purpose

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

  1. Name the seven stages of a solver pipeline, and the residual tell and the design answer of each stage.
  2. Build a lab guard that refuses each host outside the lab.
  3. Build a pipeline skeleton with a type gate, a time ceiling, and a time log for each stage.
  4. 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.

stagewhat it doesresidual telldesign answer
DetectFinds the challenge and its typeA fetch of the challenge with no page view before itIssue the challenge only in a web session that loaded the page
CaptureCopies the task dataA task that nobody shows on a real screenThe environment check
PerceiveReads the taskNone: a correct answer is the expected outputDo not rest the security on the task
SearchFinds the answer, or the nonce of a proof-of-work taskCPU timeA difficulty schedule
ActGives the answer as a click, a pointer path, or typed textThe path and its timingThe behavior check
CheckReads if the gate issued a tokenThe token chain at the originThe token server
RouteGives the token to the client that uses itA token from a different identitysession 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 sidedetection 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

optiongaincostwhen it is correct
A lab guard with a list of permitted hostsEach host that is not on the list failsYou must add each new lab host to the listFor each pipeline in the lab
A list of forbidden hostsShort to writeEach host that you forgot passesNever
A type gate before the perceive stageNo perception call for a type with no imageOne more step in the codeWhen the generator has more than one class
A time ceiling for each attemptA slow attempt ends with a clear resultA slow correct answer counts as a timeoutFor each attempt
A time log for each stageYou see which stage meets which checkMore log dataFor each lab measurement

diagram

the shared lab of the solver modules, inside one boundary

  1. GeneratorYour own challenge generator, with a seed and a scheme version for each challenge.no result
  2. Gate and token serverThe gate of the defender lab. It issues each token and checks it at the origin.no result
  3. Solver hostThe solver pipeline. Each stage writes its time to a log.no result
  4. RecorderStores the time log and the path of each attempt.no result
  5. Lab guardReads the host of each request before the request leaves. It permits only loopback and the lab hosts.pass
  6. 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 lab has no route to a third party. The lab guard is the one path out of the solver host, and it permits only lab hosts.source: Course design: the shared lab of the solver modules

the seven stages of a solver pipeline, with the residual tell and the design answer of each stage

Each stage of the pipeline leaves a residual tell, and each tell has a design answer in the gate.source: My model of the solver pipeline

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.

lab-guard.tstypescript

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.

pipeline.tstypescript

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

time for each stage of my lab solver pipelinedetect1: 1.772: 2.413: 0.82capture1: 0.822: 0.843: 0perceive1: 12: 1.013: 0search1: 0.012: 0.013: 7.07act1: 0.82: 0.773: 0.95check1: 0.772: 0.773: 0.84route1: 0.00132: 0.0013: 0.0013unit: ms1. text version 12. text version 33. proof-of-work class

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
time for each stage of my lab solver pipeline
seriesstagems
text version 1detect1.77
text version 1capture0.82
text version 1perceive1
text version 1search0.01
text version 1act0.8
text version 1check0.77
text version 1route0.0013
text version 3detect2.41
text version 3capture0.84
text version 3perceive1.01
text version 3search0.01
text version 3act0.77
text version 3check0.77
text version 3route0.001
proof-of-work classdetect0.82
proof-of-work classcapture0
proof-of-work classperceive0
proof-of-work classsearch7.07
proof-of-work classact0.95
proof-of-work classcheck0.84
proof-of-work classroute0.0013
Median wall time for each stage, on my own generator, on one host, over loopback. The stage values do not add up to the total. The check stage counts only attempts with a token.

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

problemcausecorrection
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

  1. 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.

  2. The lab list holds the host of the lab gate. Which request host passes the lab guard?

    1. A longer name that starts with the host of the lab gate
    2. The host of the lab gate with a port number
    3. A host that the guard cannot read
    4. 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.

  3. A challenge of the proof-of-work class comes to the pipeline. What does the type gate do?

    1. It sends the challenge to the perceive stage first.
    2. It stops the attempt with the result timeout.
    3. It skips the capture and the perceive stages, and the challenge goes to the search stage.
    4. 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.

  4. 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?

    1. A harder image task slows the solver much.
    2. The security of the gate must come from the checks of the other stages.
    3. The solver cannot read the task.
    4. 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.

attemptclassdetectcaptureperceivesearchactcheckroute
e1text3 ms1 ms2 ms0 ms1 ms1 ms0 ms
e2proof of work3 msskippedskipped40 ms1 ms1 ms0 ms

The time ceiling of the pipeline is 30 ms.

  1. Add the stage times of each attempt.
  2. Write the result of each attempt: done, or timeout.
  3. For each attempt, write the stage with the largest time.
  4. 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

  1. Inaccessibility of CAPTCHA (Group Draft Note, 2021-12-16), W3C, draft, read 2026-11-22
  2. My model of the seven stages of a solver pipeline, their residual tells, and their design answers, 2026-11 (not public).
  3. Course design: the shared lab, the lab guard, and the pipeline skeleton, 2026-11 (not public).