01 · part 1, conceptsconcept
Why you can't unit-test this, and what you can do instead
An ordinary program gives the same output for the same input, so a test that passes today passes tomorrow. A system built around a language model doesn’t have that property, and the reason isn’t only that the model is random.
Four things decide an answer
Nothing in this scene is measured.
| part | who changes it | do you hear about it? |
|---|---|---|
| prompt | your team | yes: you released it |
| code | your team | yes: you released it |
| index | a scheduled job, every night | only if the job reports what it changed |
| model | the provider | often not, if you call it by name without a version |
The index, the documents the system retrieves from, is rebuilt on a schedule whether or not anything went wrong. The model is whatever the provider currently serves under the name you asked for. A test you ran before your last release says nothing about a change that arrived after it, from someone who isn’t on your team.
What you can do instead
| practice | what it gives you | step |
|---|---|---|
| record what produced every answer | the ability to explain and reproduce a bad answer | 2, 3 |
| test before releasing | a chance to catch your own changes before anyone sees them | 4, 5 |
| watch signals all the time | a chance to notice changes nobody released | 6 |
| keep a way back for each part | the ability to undo each kind of change | 7 |
The rest of this volume takes those four in order. The first one, recording what produced every answer, is the one every other practice depends on: without it a problem can be noticed and still not explained.
Try it. In the labs folder, run:
python3 run.py
The three incidents, when each starts and how many answers it broke, then how many users got a broken answer as each practice is added.