Place the example most similar to the query last. In long prompts, relevant information is harder to use when buried in the middle; deliberate ordering can outperform random ordering even with the same number of examples. section 4.3.4 section 4.8.1
Ordering a many-shot prompt
Compare two 100-shot prompts: one orders examples randomly, while the other puts the most query-similar examples at the end. The deliberately ordered prompt can perform better. More examples are not automatically better if relevant ones land in the middle or added context only increases cost. section 4.3.4 section 4.8.1
Figure 4.3 Lost-in-the-middle U-shape (illustrative): accuracy is high when the relevant content sits near the start or end of the context window and drops in the middle, so put your highest-signal examples at the boundaries, not the trough.

The U-shaped accuracy illustration shows why high-signal examples belong near the beginning or end, not in the middle. section 4.3.4
