Adaptive Cross-lingual Text Classification through In-Context One-Shot Demonstrations

Emilio Villa-Cueva, Adrián Pastor López-Monroy, Fernando Sánchez-Vega, Thamar Solorio

Abstract

We introduce IC-XLT (In-Context Cross-lingual Transfer), a novel framework that enables multilingual models to adapt to target languages using a single demonstration at inference time. By employing a meta-training phase called In-Context Tuning (ICT), we teach models to utilize demonstrations to bridge the cross-lingual transfer gap. Evaluations on the ACD and MASSIVE benchmarks show that IC-XLT significantly outperforms zero-shot and one-shot fine-tuning baselines, particularly in data-scarce scenarios, while maintaining model modularity and computational efficiency.

Introduction

In cross-lingual Natural Language Processing (NLP), transferring knowledge from high-resource source languages (e.g., English) to lower-resource target languages remains a challenge. Traditional approaches like Zero-Shot Transfer (ZS-XLT) are modular but often suffer from a significant "transfer gap" in performance. Conversely, Few-Shot Fine-Tuning (FS-XLT) can improve performance but is computationally expensive and requires maintaining separate model versions for each target language. This paper addresses these limitations by proposing a gradient-free adaptation method that leverages in-context learning.

Methodology

The IC-XLT approach consists of two primary stages:

1. In-Context Tuning (ICT)

During meta-training, an encoder-decoder model (mT5) is fine-tuned on a source language. Unlike standard training, the input is prepended with $M$ random text-label pairs (demonstrations). This phase explicitly trains the model to use these demonstrations as contextual clues for the classification task, effectively "learning to learn" from examples.

2. In-Context Learning (ICL)

At inference time, the model performs In-Context Cross-lingual Transfer. A single labeled example from the target language is prepended to the user's input. The model uses its meta-trained ability to interpret the task through this target-language "anchor," requiring no weight updates or additional fine-tuning.

Experimental Evaluation

The authors evaluated IC-XLT on two diverse benchmarks: Aspect Category Detection (ACD), a multi-label restaurant review task, and MASSIVE, a large-scale domain classification dataset for virtual assistant utterances covering 13 target languages.

Key Results

IC-XLT consistently outperformed both zero-shot and traditional one-shot fine-tuning baselines across both datasets. On the MASSIVE dataset, IC-XLT achieved an average $F_1$ micro score of 81.24, a substantial improvement over the 76.12 achieved by Zero-Shot transfer.

Mean F1 micro on target languages for the MASSIVE dataset across varying source data sizes (K_src).

As shown in Figure 2, IC-XLT maintains a performance advantage even when source-language data is extremely limited (e.g., $K_{src} = 8$ or $16$). This suggests that the framework is highly efficient at learning task structures from minimal data.

Detailed per-language performance on the MASSIVE dataset comparing IC-XLT with zero-shot and one-shot baselines.

Table 5 highlights the effectiveness of IC-XLT across a wide range of languages, including low-resource ones like Swahili (SWA) and Amharic (AMH). For Swahili, the introduction of a single target-language example improved performance by over 15% in certain configurations compared to zero-shot baselines. Furthermore, the results indicate a "sweet spot" for meta-training, where 10 demonstrations ($M=10$) often yielded better results than 20 ($M=20$).

Discussion and Conclusion

IC-XLT provides a compelling alternative to per-language fine-tuning by enabling efficient, modular, and high-performance cross-lingual transfer. While the method is currently constrained by the context window limits of models like mT5, it demonstrates that explicit in-context tuning can unlock powerful adaptation capabilities in smaller multilingual models. Future work will explore the applicability of this framework to different model architectures and strategies for scaling the number of demonstrations.

Summary updated

BibTeX
@inproceedings{villacueva2024adaptive,
  author = {Emilio Villa-Cueva and Adrián Pastor López-Monroy and Fernando Sánchez-Vega and Thamar Solorio},
  title = {{Adaptive Cross-lingual Text Classification through In-Context One-Shot Demonstrations}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.naacl-long.460},
}
Figure