Basis Lab

Models That Use Tools

Several Steps and a Budget

Last timeWhen a Tool Fails

A loop with no limit is not a capability, it is an invoice. Bounding the steps, the time and the money is what makes a multi step system safe to run.

Three budgets, not one

The step limit in the second lesson is the obvious bound and on its own it is the weakest of the three.

Twenty steps might be two seconds of fast lookups or two minutes of web fetches. It might be a tenth of a penny or several pounds, depending on how long the history has grown and which model is being used. A limit expressed in steps says almost nothing about the two things people actually care about, which are how long they wait and what it costs.

FIG 1What a step limit costs, at four tenths of a penny of model and fifteen hundredths of tools per step
stepthe step limitone taska thousand tasks a daya million tasks a daywhat happened
14 steps2.2 pence£22 a day£22,000 a dayFour tenths plus fifteen hundredths is fifty five hundredths of a penny a step, and that figure is the whole of the arithmetic here.
212 steps6.6 pence£66 a day£66,000 a daySix and a half pence a task sounds like nothing, which is exactly the trouble with reading the second column on its own.
320 steps11.0 pence£110 a day£110,000 a dayThe step limit mentioned at the top of this lesson. Twenty steps says nothing about money until this sum is done, and then it says rather a lot.
424 steps13.2 pence£132 a day£132,000 a dayDoubling the limit from twelve doubles this row, which is the comforting version. The section below is where that stops being true.
4 steps
This is the arithmetic that should set a step limit, rather than a round number, and the two right hand columns are why: twelve steps is fine at a thousand tasks a day and is sixty six thousand pounds a day at a million. Run the division the other way, from an acceptable cost per task, and the limit comes out with a reason behind it. One warning about every row here: a flat cost per step understates the bill, because the history grows, and the plot further down shows by how much.

So three budgets, all checked in the loop. Steps, because it is the cheapest to enforce and catches runaway behaviour immediately. Time, because somebody is waiting and a correct answer after four minutes is often worth less than an admission after thirty seconds. And money, because a loop with no cost limit has no upper bound on a bad day and bad days are when it will run.

FIG 2The three budgets and what each one catches
catches a stuck loopprotects the person waitingprotects the billcheap to enforce
a step limit1001
a time budget1101
a cost budget0010
all three together1111
A one means that budget does what the heading says, a zero that it does not. No single row other than the last has three ones, which is the argument for having all three: they fail in different directions. A cost budget is the awkward one to enforce because the cost of a step is only known after it has been taken, so it is enforced by accumulating as the loop runs and stopping when the total passes the limit, which means a task can exceed its budget by at most one step.

Why the cost grows faster than the length

The second lesson showed the curve and this is the reasoning behind it.

At step one the model reads the question. At step two it reads the question, the first request and the first result. At step three it reads all of that again plus one more exchange. Nothing is ever read once.

If each step adds about the same amount to the history, then the total read across a task of many steps is the sum of one plus two plus three and so on, which is about half the square of the number of steps. Twice as many steps is roughly four times the reading.

The lesson stops here

3 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 contents

This 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

The rest of this course

  1. 01Saying Something and Doing Something
  2. 02The Loopopening only
  3. 03Describing a Tool Wellopening only
  4. 04Checking What the Model Asked Foropening only
  5. 05When a Tool Failsopening only
  6. 06Several Steps and a Budgetyou are here
  7. 07Text From Outside Is Not an Instructionopening only
  8. 08Judging Whether the Whole Thing Workedopening only

Read alongside