Found in the Middle: Permutation Self-Consistency Improves Listwise Ranking in Large Language Models

Raphael Tang, Xinyu Zhang, Xueguang Ma, Jimmy Lin, Ferhan Ture

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 Permutation Self-Consistency (PSC) pipeline: multiple shuffled input prompts are processed by the LLM, and their outputs are aggregated into a final consensus ranking.

The PSC strategy consists of three main steps:

  1. Shuffling: The input list is shuffled into $m$ (typically 20) different random permutations, each serving as a unique prompt.
  2. Inference: Each shuffled prompt is processed by the LLM at zero temperature. The diversity in results stems entirely from the different input arrangements.
  3. 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.

Comparison of individual score distributions versus the PSC aggregate. PSC (marked with 'x') consistently exceeds the median and often the maximum performance of individual runs.
  • 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

BibTeX
@inproceedings{tang2024found,
  author = {Raphael Tang and Xinyu Zhang and Xueguang Ma and Jimmy Lin and Ferhan Ture},
  title = {{Found in the Middle: Permutation Self-Consistency Improves Listwise Ranking in Large Language Models}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.naacl-long.129},
}
Figure