The Impact of Demonstrations on Multilingual In-Context Learning: A Multidimensional Analysis

Miaoran Zhang, Vagrant Gautam, Mingyang Wang, Jesujoba Alabi, Xiaoyu Shen, Dietrich Klakow, Marius Mosbach

Introduction

In-context learning (ICL) has become the standard paradigm for utilizing Large Language Models (LLMs), where a few demonstrations are provided in the prompt to guide the model toward a specific task. While extensively studied in English, the effectiveness of ICL across the global linguistic landscape remains less understood. This study presents a multidimensional analysis of multilingual ICL, evaluating 5 LLMs across 56 languages and 9 diverse datasets to determine if few-shot examples are truly the "silver bullet" they are often perceived to be.

Experimental Setup and Methodology

The researchers evaluated a spectrum of models, including base models (XGLM, Llama 2) and instruction-tuned chat models (Llama 2-Chat, GPT-3.5, GPT-4). The evaluation spanned zero-shot and few-shot settings (2, 4, and 8 demonstrations).

Overview of in-context learning and zero-shot learning tasks across different languages.

The study focused on two primary manipulations to understand the mechanics of ICL:

  1. Demonstration Quality: Comparing random selection, semantically similar "top-k" examples, and "corrupted" examples where ground-truth labels were intentionally randomized.
  2. Prompt Templates: Comparing standard templates against "formatting-focused" templates that explicitly enforce output styles to minimize parsing errors.

The datasets covered classification tasks (e.g., XNLI, PAWS-X, AfriSenti) and generation tasks (e.g., XQuAD, TyDiQA, MAFAND).

A central finding of the research is that adding demonstrations does not uniformly improve performance. In many classification tasks, particularly for base models, ICL can actually lead to performance degradation compared to zero-shot baselines.

Performance metrics (Accuracy/F1/ChrF++) as a function of the number of few-shot demonstrations (k-shot) across nine multilingual datasets.

As shown in the performance curves, while some tasks like Question Answering (XQuAD, TyDiQA) show clear gains from k-shot scaling, others like PAWS-X exhibit flat or even negative trends for certain models. This suggests that the utility of demonstrations is highly task-dependent and model-dependent. For instance, on the PAWS-X dataset, using 4-shot ICL with Llama 2 improved Japanese performance but degraded English performance by over 10 points.

The Power of Templates over Demonstrations

Perhaps the most surprising insight is the efficacy of prompt engineering. For advanced chat models like GPT-4, the performance gap between zero-shot and few-shot learning can be largely closed—or even reversed—by using formatting-focused templates. These templates instruct the model on exactly how to structure its response, reducing the need for examples to serve as formatting hints.

Furthermore, the study revealed that chat models are remarkably resilient to "corrupted" labels. When provided with demonstrations containing incorrect ground-truth labels, models like GPT-3.5 and GPT-4 maintained high performance, whereas base models suffered significant drops (e.g., Llama 2 dropped by ~26 F1 points on XQuAD). This implies that high-capacity models use demonstrations primarily to understand the desired output format and to activate relevant internal knowledge, rather than "learning" the task logic from the provided examples.

Cross-Lingual Variance and Limitations

The impact of prompting strategies varies significantly across languages. A strategy that benefits one language might actively harm performance in another on the exact same task. This variance underscores the danger of generalizing English-centric ICL findings to a multilingual context.

The authors acknowledge limitations such as potential data contamination in closed models like GPT-4 and the reliance on automatic metrics (F1, ChrF++), which may penalize nuanced but correct human-readable answers. Future research is needed to explore cross-lingual demonstrations and more advanced prompting techniques like Chain-of-Thought.

Conclusion

This multidimensional analysis suggests that the NLP community may be overestimating the necessity of few-shot demonstrations for multilingual tasks, especially when using state-of-the-art chat models. By prioritizing well-crafted, formatting-focused prompt templates, developers can achieve high performance in zero-shot settings, simplifying the deployment of multilingual AI systems and reducing inference costs.

Summary updated

BibTeX
@inproceedings{zhang2024impact,
  author = {Miaoran Zhang and Vagrant Gautam and Mingyang Wang and Jesujoba Alabi and Xiaoyu Shen and Dietrich Klakow and Marius Mosbach},
  title = {{The Impact of Demonstrations on Multilingual In-Context Learning: A Multidimensional Analysis}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.findings-acl.438},
}
Figure