When you rank a list of things with an LLM, do not feed it long uuids. Give it short integer ids instead.
Two reasons. It is faster, because short ids burn fewer tokens. And the model cannot hallucinate an id that was not in the list, because the numbers are small and you can check them in one pass.
The rule I follow: treat the model output as a sort key, never as the source of truth for which items exist. The model tells you the order. Your own code decides what is on the list. If the model returns an id you never sent, you drop it.
This sounds small. It removes a whole class of bugs where a ranking step quietly invents results.