Upstream sampling is generating several responses from a model and picking the best one, rather than taking a single answer. Because generation involves random sampling, the same prompt produces different outputs. This method turns that variety into an advantage.
The selection step can rest on different criteria. A reward model can score the responses, a validator can check whether the output obeys formal rules, or the responses can be compared against each other for consistency. On verifiable tasks like maths and code, producing several solutions and taking the answer the majority converges on gives a clear gain.
The same idea appears on the training side. After candidate responses are ranked, the best ones become supervised fine-tuning data, so the model learns from its own strongest outputs.
A concrete case: a code assistant writes a function. Instead of one response, five are generated, each is run against the existing test suite, and the first solution that passes is shown to the user. From the user's side there is one answer, while five attempts happened behind it.
Cost rises directly. Five responses means five times the tokens, so the method tends to be used where the cost of an error is high and verification is cheap.

