AI Engineering, story 11Let it run the numbers

A year of orders

1 of 10

Let it run the numbers: AI Engineering, story 11

HM Nayem uploads a year of orders and asks for the total spent on boots. The model is bad at arithmetic, so it does something smarter.

The model writes code, a locked box runs it, and the result comes back.

The story, step by step

  1. A year of orders

    HM Nayem uploads a spreadsheet of last year's orders, 214 rows of them, and asks one question: how much went on boots? The answer is a single exact number.

  2. What is in the file

    The file is a plain table: one row for each item bought, with a date, an item, a type and a price. Somewhere in those 214 rows are the boots. The answer means finding every one and adding the prices exactly.

  3. Arithmetic is not its strength

    Hand the model all 214 rows and it will give a number. But a model predicts text. It does not calculate. Adding dozens of prices by prediction drifts, and the result looks every bit as confident as a correct one.

  4. A better idea: write a program

    So the server offers a different kind of tool: run this code. Now the model does not try to add anything. It writes a short program that would add it, which is something models are very good at.

  5. Not on the shop's own server

    That program was written by a model, about a file a stranger uploaded. It could do anything a program can do. So the server never runs it itself. It goes into a sandbox: a sealed, throwaway computer.

  6. It fails the first time

    The program crashes. It looked for a column called “category”, and this spreadsheet calls it “type”. The sandbox does not hide that. It sends the error message straight back.

  7. It reads the error and fixes it

    The model reads the error like a programmer would, sees the real column names, and writes the program again with one word changed. Nobody at the shop had to step in.

  8. An exact answer

    This time it runs. The number is not a prediction. A computer added the prices, so it is simply correct. The result travels back to the model.

  9. Words around the number

    The model turns the bare number into a sentence, and it streams to HM Nayem. The model did the thinking and the writing. The computer did the sums. Each did what it is good at.

  10. Now at real speed

    Write, run, fail, fix, run, answer. The same loop lets a model make charts, clean data and analyse files far too big to read. All of it inside a box that cannot hurt anything.

The model writes the program. A locked box runs it.

Ideas in this story