Yes, it is a stochastic system, that's the whole point tough. There are two things at play here, one is that the model does prediction based on the context of the current data it's looking at rather than just whatever data it was trained on. That's what the article is highlighting. The second part is the feedback loop such as what you see in agentic coding. The model makes a prediction, that prediction is tested against the environment, the model gets feedback, and it iterates. And that's what grounds it in reality addressing the issue of it producing meaningless outputs. The system as a whole behaves similarly to a genetic algorithm where the solution evolves through the cycle of trial and error.
Incidentally, this is true for humans as well. This is why we need tools like the scientific method and peer review in science. People hallucinate things all the time, and when we loose the connection between the predictions the brain generates and sensory feedback we call that schizophrenia.