MIR-Bench: Can Your LLM Recognize Complicated Patterns via Many-Shot In-Context Reasoning?

Kai Yan, Zhan Ling, Kang Liu, Yifan Yang, Ting-Han Fan, Lingfeng Shen, Zhengyin Du, Jiecao Chen

TL;DR

This paper introduces MIR-Bench, a novel benchmark designed to evaluate Large Language Models' (LLMs) ability to perform complex pattern recognition using many-shot in-context learning (ICL). MIR-Bench addresses the limitations of existing benchmarks by focusing on reasoning with hundreds to thousands of examples and diverse data formats, revealing that while LLMs are robust to errors, they often struggle with information integration and can be outperformed by simpler, direct reasoning.

What Problem Does This Paper Address?

The paper tackles a critical gap in evaluating LLMs: their ability to recognize and generalize complex patterns from a large number of examples, a skill crucial for general intelligence. Existing benchmarks often focus on few-shot learning (less than 10 examples) or simple classification tasks, failing to capture the challenges of aggregating information from long contexts with many examples. This is particularly relevant as LLMs are increasingly capable of handling longer contexts, enabling many-shot ICL. The authors argue that current long-context tasks, like "needle-in-a-haystack," primarily test retrieval rather than complex reasoning. MIR-Bench aims to fill this void by providing a challenging, diverse benchmark for many-shot in-context reasoning.

Methods

The core of the paper is the creation of MIR-Bench. The authors developed a pipeline that:

  1. Collects functions from introductory coding benchmarks (HumanEval+, MBPP+, APPS).
  2. Uses GPT-4o-0806 to generate data generators for these functions, producing thousands of input-output pairs.
  3. Filters these pairs to ensure sufficient diversity and avoid trivial problems.
  4. Constructs two benchmark versions: MIR-Extended (693 functions, 10 test cases each) and MIR-Core (300 functions selected for their high potential to benefit from many-shot learning).

The evaluation methodology involves testing various LLMs on MIR-Bench with a range of shots (from 4 to 2048) and analyzing their performance based on accuracy. They also conduct extensive ablation studies to investigate factors influencing performance, such as the number of shots, inductive vs. transductive reasoning, robustness to erroneous examples, and the impact of Chain-of-Thought (CoT) prompting.

Datasets

The primary dataset introduced is MIR-Bench, comprising two versions:

  • MIR-Extended: 693 functions, each with 10 test cases, totaling 6930 problems.
  • MIR-Core: A subset of 300 problems from MIR-Extended, specifically chosen for their high distinctiveness between few-shot and many-shot performance.

The functions used to construct MIR-Bench are sourced from existing coding benchmarks: HumanEval+, MBPP+, and APPS.

Key Insights and Ideas

  • Many-shot saturation is not about retrieval, but distraction: The performance of LLMs doesn't always improve with more shots. This saturation seems to stem from the model being overwhelmed and distracted by too much information, rather than an inability to retrieve relevant examples.
  • Transductive reasoning often outperforms inductive reasoning: Surprisingly, for many pattern recognition tasks, LLMs achieve higher accuracy when directly providing an answer (transductive) compared to when prompted to show their reasoning steps (inductive, via CoT). This suggests that the structural coherence of direct input-output mapping is more beneficial than explicit reasoning chains in these scenarios.
  • LLMs are surprisingly robust to erroneous examples: Even with a significant proportion of incorrect examples in the few-shot context, LLMs maintain decent performance, indicating a degree of resilience.
  • CoT can be detrimental for many-shot pattern recognition: While CoT is generally beneficial for complex reasoning, in many-shot pattern recognition, it can break the structural coherence between input-output pairs, leading to worse performance than direct, transductive reasoning.
  • Difficulty matters: Problems that are more difficult to guess from input-output pairs (as judged by LLMs) benefit more from many-shot learning. Conversely, very simple problems see little to no improvement with more examples.

Key Results

  • MIR-Bench is challenging: Even state-of-the-art LLMs like OpenAI's o1-mini-0912 and o1-preview-0912 only achieve accuracies below 0.7 on MIR-Extended, with most models performing significantly lower.
  • Scaling effects are nuanced: While more shots generally improve performance, this effect saturates for many models around 256-512 shots, indicating limitations in information integration.
  • Transductive reasoning advantage: Models consistently perform better without CoT. For instance, on MIR-Core, accuracy without CoT is unanimously higher than with CoT.
  • Robustness to errors: LLMs show minimal performance degradation even with up to a 75% error rate in the provided shots.
  • RAG is not a silver bullet: Retrieval Augmented Generation (RAG) did not significantly improve performance, suggesting that the issue is not solely about retrieving the most relevant shots but about effectively integrating information.

Limitations and Future Work

  • Defining "many-shot benefit" is complex: The authors acknowledge that their method for identifying problems that benefit from many-shot (MIR-Core selection) is not perfect and a more explainable rule is needed.
  • Text-based focus: The current benchmark is limited to text-based pattern recognition; future work could explore multimodal settings.
  • Underlying function ambiguity: While efforts were made to filter ambiguous functions, some underlying functions might still be non-unique given the input-output pairs.
  • Addressing saturation: While RAG was explored and found ineffective, supervised fine-tuning or reinforcement learning with in-context learning data are suggested as promising avenues for future research.
  • Learning "meta-skills": LLMs still struggle to generalize inductive reasoning skills from out-of-domain demonstrations, presenting an interesting research direction.

Summary updated

BibTeX
@inproceedings{yan2025mir,
  author = {Kai Yan and Zhan Ling and Kang Liu and Yifan Yang and Ting-Han Fan and Lingfeng Shen and Zhengyin Du and Jiecao Chen},
  title = {{MIR-Bench: Can Your LLM Recognize Complicated Patterns via Many-Shot In-Context Reasoning?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=IZHWvvmYwx},
}
Figure