TL;DR
Large language models are notoriously sensitive to the order of answer choices in multiple-choice questions. While Set-Based Prompting (SBP) mechanically forces order invariance by stripping positional encodings and unmasking attention across options, applying it out-of-the-box degrades model accuracy due to severe distribution shift. This paper demonstrates that fine-tuning models on SBP-formatted data using a margin-based contrastive loss eliminates ordering bias, recovers lost accuracy, and generalizes well to unseen tasks without harming general language modeling capabilities.
What Problem Does This Paper Address?
Transformer-based LLMs often exhibit severe order dependence: permuting or reversing the multiple-choice options of an identical question can flip the model’s prediction from correct to incorrect.
Prior work introduced Set-Based Prompting (SBP), which uses modified attention masks and shared/parallel positional embeddings so candidate tokens are processed without left-to-right positional bias, guaranteeing permutation invariance. However, because standard foundation models are pretrained strictly on sequential, ordered text, zero-shot SBP inputs represent an out-of-distribution (OOD) format. In practice, this causes severe degradation in baseline accuracy, forcing practitioners to choose between order robustness and raw performance.
Methods
The authors propose fine-tuning models directly on SBP-formatted data using parameter-efficient fine-tuning (LoRA on $q, k, v, o$ projections) to pull SBP inputs onto the model's learned data manifold.
Key aspects of the methodology include:
- Set-Based Prompting Integration: Answer choices are reformatted into parallel sub-sequences using modified attention masks and identical positional embeddings, removing sequence order cues.
-
Margin-Based Contrastive Loss vs. Standard Cross-Entropy: Standard next-token cross-entropy simply maximizes the probability of the correct tokens without penalizing near-ties with distractors. The authors instead adopt a margin-based contrastive loss: $$\mathcal{L} = \max(0, m - (p - \max(n_1, n_2, \dots, n_k)))$$ where $p$ is the average per-token log-probability of the correct answer sequence, $\{n_1, \dots, n_k\}$ are the log-probabilities of incorrect answers, and the margin is fixed at $m = 1.0$. This explicitly enforces logit separation between ground truth and distractors.
-
Models Tested: Meta's LLaMA-2-7b (base) and LLaMA-2-7b-chat.
Datasets
The authors filtered multiple-choice benchmarks so that tokenized question-answer pairs did not exceed 256 tokens and contained at least three distractors:
- In-Distribution Training & Evaluation: MMLU (12,147 questions) was used exclusively for fine-tuning.
- Out-of-Distribution Generalization: CommonsenseQA (CSQA) (9,741 5-choice questions) and ARC Challenge (2,582 4-choice questions) were evaluated without any benchmark-specific tuning.
- Language Modeling Monitor: WikiText-103 perplexity was monitored to ensure fine-tuning did not cause catastrophic forgetting.
- Exploratory Task: Financial reports from SEC filings were used to test whether SBP formatting transfers to document summarization.
Key Insights and Ideas
- Contrastive Separation is Essential: Fine-tuning on SBP inputs with standard cross-entropy actually degrades QA performance. SBP inputs scramble the familiar context cues models use to generate tokens, so cross-entropy overfits without establishing a crisp decision boundary. Margin-based contrastive loss solves this by actively repelling distractor probabilities.
- SBP Fine-Tuning Surpasses "Best-of-2" Baselines: Base models are so sensitive to option order that taking the best score across standard and reversed orderings (Best-of-2) outperforms single-prompt evaluation. SBP fine-tuning enables the model to surpass its prior Best-of-2 accuracy under a single, completely order-invariant forward pass.
- Task Alignment Matters: Fine-tuning on contrastive MCQ tasks does not automatically make the model good at other set-based tasks like summarization, indicating that set-based representations require task-aligned training objectives.
Key Results
- Permutation Invariance & Accuracy: On LLaMA-2-7b and LLaMA-2-7b-chat tested across 24 ($4!$) permutations, contrastive SBP fine-tuning reversed the accuracy drop observed in zero-shot SBP, significantly outperforming both the base model and standard fine-tuning controls across MMLU, CSQA, and ARC Challenge.
- Retained General Language Capabilities: Language modeling capability remained stable on WikiText-103. On LLaMA-2-7b, perplexity shifted negligibly from 12.66 to 12.76 (treatment). On LLaMA-2-7b-chat, perplexity dropped from 17.04 to 15.36.
- Summarization Degraded: In exploratory qualitative tests on SEC report summarization, both base and MCQ-finetuned models produced lower-quality, repetitive summaries under SBP formatting compared to standard sequential prompting.
Limitations and Future Work
- Narrow Task Transfer: Models fine-tuned on multiple-choice SBP do not transfer zero-shot to order-invariant generation tasks like summarization; future work must explore training with summarization-specific set-based objectives.
- Hyperparameter Sensitivity: The contrastive margin was held fixed at $m = 1.0$. Optimal margins across different architectures and dataset scales remain unstudied.
- Instruction-Tuning Shifts: SBP fine-tuning slightly altered instruction-following behaviors in the chat variant, suggesting SBP-formatted data should be blended into the primary instruction-tuning pipeline rather than applied purely as an afterthought.
Summary updated