Introduction
Large Language Models (LLMs) have shown remarkable capabilities in various natural language tasks. However, when tasked with listwise ranking—ordering a set of items based on specific criteria—they exhibit significant "positional bias." This phenomenon, often described as being "lost in the middle," occurs when models favor items at the very beginning or end of a prompt while performing poorly on those in the center. Consequently, the presentation order of items, which should be irrelevant, drastically affects the model's output, making listwise ranking unreliable for production environments.
Permutation Self-Consistency (PSC)
To address these biases, we introduce Permutation Self-Consistency (PSC). This method leverages the diversity of model outputs generated by varying the input order rather than increasing output randomness (temperature).
The PSC strategy consists of three main steps:
- Shuffling: The input list is shuffled into $m$ (typically 20) different random permutations, each serving as a unique prompt.
- Inference: Each shuffled prompt is processed by the LLM at zero temperature. The diversity in results stems entirely from the different input arrangements.
- Aggregation: The resulting $m$ rankings are aggregated using the Kemeny-Young optimal ranking method. This mathematical approach identifies the permutation that minimizes the total Kendall tau distance across all samples, effectively marginalizing out individual positional biases to find a "true" consensus.
Experimental Evaluation
The effectiveness of PSC was evaluated across synthetic sorting tasks (MathSort, WordSort, GSM8KSort) and passage reranking benchmarks (TREC-DL19 and TREC-DL20).
Key Results
PSC consistently outperformed individual ranking runs across all tested models, including Mistral-7B, LLaMA v2, GPT-3.5, and GPT-4.
- Sorting Accuracy: On the MathSort task, Mistral-7B's performance improved by 52% in Kendall tau correlation. Even highly capable models like GPT-4 saw a ~7% improvement.
- Passage Reranking: On TREC-DL20, GPT-4’s nDCG@10 score jumped from 71.97 to 78.52, a significant increase for a high-performing model.
- Model Scaling: Smaller models (7B-13B parameters) showed the most dramatic gains, sometimes doubling their scores and becoming competitive with much larger proprietary models.
Analysis and Insights
A critical finding is that shuffling the input is more effective than increasing output temperature. While standard self-consistency in reasoning tasks benefits from high temperature, ranking tasks suffer from it. PSC demonstrates that the "noise" introduced by input permutations provides a superior signal for error correction. Furthermore, visualization via "reversion" heatmaps confirmed that models are most likely to misorder items located in the middle of a prompt, validating the "lost in the middle" hypothesis.
Conclusion and Future Work
While PSC significantly improves ranking reliability, it introduces a 20x increase in computational cost. Future research may focus on making the PSC process differentiable to train models for inherent order-invariance or optimizing the aggregation process for lower latency. Despite the cost, PSC provides a robust framework for achieving state-of-the-art ranking performance with existing LLMs.
Summary updated