The Loop That Will Not Settle, and the Loop That Settles on Something Wrong
Last timeChecking Before Passing It On
A retry loop that fixes a draft six times in ten takes 1.56 passes on average, and the cap you put on it moves the worst case rather than that average.
The service answers a customer's written question about an order in four steps.
It sorts the request, finds the matching order and the policy that applies,
drafts the reply, and checks the draft against that policy. The first three
steps run once each. The fourth is different, because it can say no, and the
only sensible thing to do when it says no is to draft again.
That turns a chain into a loop, and a loop has a property the chain did not.
Where it stops is no longer a fact about the system. It is a decision somebody
has to make, and if nobody makes it the loop stops when the money runs out.
The loop and the three numbers that control it
Write for the chance that one pass through draft and check produces a draft
the checker accepts. Measured on this service, is 0.6. Write ,
which is 0.4, for the chance a pass does not settle it. Write for the cap,
the number of passes allowed before the loop gives up, and let .
The prices are the ones every step in this service is charged at. Each step
sends 1,500 words of instruction and context and gets 300 back, input is 3 units
per million words and output is 15, so a step costs $1500 \times 3 / 10^6 =
0.0045$ for what it sends and for what it
returns, which is 0.009 a step, and takes 0.8 seconds. Drafting and checking are
two steps, so one pass of the loop is 0.018 and 1.6 seconds. Sorting and finding
are the other two, also 0.018 and 1.6 seconds, and they happen once.
Three passes, written out
The cleanest way to get the pass count is to run a thousand requests through on
paper, assuming for now that the checker is perfect, so that it rejects a draft
exactly when the draft is wrong.
The lesson stops here
7 more paragraphs to go
You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.
The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.
See the planThe contentsThis is the reading half
Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.
The contents