Abstract
In-Context Learning (ICL) typically requires manually curated, task-specific demonstrations, which can be a significant bottleneck for users. We present CrossICL, a framework that automates this process by retrieving and transforming demonstrations from existing source tasks to align with a new target task. By employing a two-stage process of Minimum Gap Selection and Progressive Task Adaptation, CrossICL eliminates the need for manual example writing while avoiding the "grounding" issues of self-generated examples. Our evaluations across 119 tasks in the Super-NI benchmark demonstrate that CrossICL consistently outperforms zero-shot and self-ICL methods across multiple large language models.
Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in In-Context Learning (ICL), where providing a few examples within the prompt significantly enhances performance. However, the standard ICL paradigm assumes that users can provide high-quality, task-specific demonstrations. In practice, this is often a barrier as users may be unable or unwilling to write examples for every new task. While "zero-shot" methods like Self-ICL attempt to generate examples internally, they often suffer from hallucinations and lack grounding, leading to suboptimal performance.
CrossICL addresses this by leveraging the massive libraries of existing NLP task demonstrations. Instead of requiring manual input or relying on ungrounded self-generation, it identifies relevant demonstrations from different "source" tasks and adapts them to the target task through an unsupervised transfer process.
Methodology
The CrossICL framework operates in two primary stages to ensure that demonstrations from disparate tasks provide high-quality guidance without causing confusion.
1. Minimum Gap Selection
For a given target task, the system identifies the "closest" existing source tasks from a large library (such as Super-NI). This selection is based on the semantic similarity of task descriptions and input distributions using text embeddings. The goal is to find source tasks that share a similar logical structure or domain with the user's query.
2. Progressive Task Adaptation
Directly using examples from a different task can lead to "cross-task interference," where the model follows the example's logic instead of the target instructions. CrossICL mitigates this through a multi-step alignment process:
- Cross-Task Query Transform: The LLM rewrites the source task query to match the format and style of the target task.
- Query Refinement: A second pass cleans up noise or formatting inconsistencies to ensure the prompt is professional and clear.
- Source-Guided Label Generation: The LLM generates a label for the newly transformed query, using the original source task's "golden" label as a reference to maintain grounding and accuracy.
Evaluation and Results
We conducted an extensive evaluation using the Super-NI (Natural Instructions) benchmark, utilizing 756 tasks as a source pool and testing on 119 tasks across six categories: Classification, Comprehension, Dialogue, Extraction, Generation, and Rewriting. We tested the framework on six LLMs, including Llama 3.1-8B, Qwen 2.5-7B, and GPT-4o.
Key Findings
- Consistent Performance Gains: CrossICL consistently outperformed Zero-Shot, Zero-Shot-CoT, and Self-ICL across all tested models. For instance, on Llama 3.1-8B, the average ROUGE-L score improved from 53.2% (Zero-Shot) to 56.8%.
- Efficiency: The automated process is approximately 10-15 times faster than manual human writing of demonstrations, making it a highly scalable solution.
- Alignment is Mandatory: Ablation studies showed that directly using source task demonstrations without the adaptation stage often performs worse than simple zero-shot inference due to interference.
- Synergy: When combined with other techniques like Query-Supervised ICL, CrossICL provided even stronger results by providing more accurate initial labels for the model to reference.
Conclusion
CrossICL provides a scalable, unsupervised alternative to manual demonstration engineering. By treating existing task libraries as a source of analogies, it enables LLMs to solve new tasks with high-quality, grounded guidance. While the current method requires specific query formatting and introduces some inference overhead due to the multi-step alignment, it represents a significant step toward making ICL more accessible and robust. Future work will explore transferring higher-level abstract execution skills and optimizing the computational efficiency of the alignment process.
Summary updated