Non Determinism.mp4

Non Determinism

I want to take a quick detour and talk about what you might expect from the outputs of your agents during this course.

When I ran this course the first time, the exercise we've just done is actually the most talked about exercise. So many people were saying, "why didn't my agents do the thing that yours did?" They'd say, "Surely, given the same inputs, the same codebase, I repeated your steps exactly, surely it would act exactly the same."

Understanding Non-Determinism

I want to hammer this idea into your head: agents are non-deterministic.

Agents are essentially next token machines, or rather, LLMs are next token chooser machines. What they do is choose their next token based on a set of probabilities. It's not the same every single time.

This means that you can ask the same question to the LLM twice and it will give you two different answers.

The Probability Distribution of Responses

The responses you're going to get from your agent at any point in time are going to fall somewhere on a probability distribution curve.

Probability distribution curve showing agent response variability

Some of the answers you're going to get are really good. Most will group towards the middle, the most sensible route. But sometimes you will get weird responses, weird little outliers.

When I first taught this course, I taught it to around 2,500 students. A couple of them had really strange experiences on some exercises, where the agent was doing something completely different to what I was showing.

What I'm here to say is this: this is a normal part of working with agents. The non-determinism is baked in.

Making Agents More Consistent

So what you have to do is ride the wave.

You can definitely make agents more consistent, especially when we get to the AFK phase, when we start talking about feedback loops. But you will always get a little bit of this behavior where it just sometimes does something odd.

Hopefully that sets your expectations for the rest of the course and for working with agents in general.

Nice work, and I will see you in the next one.