---
title: "Language Models can Exploit Cross-Task In-context Learning for"
description: "Chatterjee and colleagues test whether labeled examples from other tasks can improve answers when a new task has no labeled examples."
canonical: "https://research.elamur.ai/free/en/papers/chatterjee-2024-language-models-can-exploit-cross/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/chatterjee-2024-language-models-can-exploit-cross/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/) / Language Models can Exploit Cross-Task In-context Learning for Data-Scarce Novel Tasks

# Language Models can Exploit Cross-Task In-context Learning for Data-Scarce Novel Tasks

Paper · 2024 · Anwoy Chatterjee, Eshaan Tanwar, Subhabrata Dutta et al.

**Authors:** [Anwoy Chatterjee](https://md.research.elamur.ai/free/en/authors/anwoy-chatterjee/), [Eshaan Tanwar](https://md.research.elamur.ai/free/en/authors/eshaan-tanwar/), [Subhabrata Dutta](https://md.research.elamur.ai/free/en/authors/subhabrata-dutta/) and [Tanmoy Chakraborty](https://md.research.elamur.ai/free/en/authors/tanmoy-chakraborty/) · **Year:** 2024 · **Venue:** Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2024.acl-long.621/)
- [PDF](https://aclanthology.org/2024.acl-long.621.pdf)
- [DOI 10.18653/v1/2024.acl-long.621](https://doi.org/10.18653/v1/2024.acl-long.621)

## Summary

A new task may be easy to describe and hard to demonstrate. A user can ask for the sentiment of a financial news sentence without having any labeled financial news on hand. Yet a system that struggles with the instruction alone may respond differently once it sees a worked example. Chatterjee and colleagues ask whether that example can come from another task altogether. Their method, cross-task [in-context learning](https://md.research.elamur.ai/free/en/concepts/few-shot-learning/), places a labeled example from a source task before the instruction and input for the target task. The source and target each have their own instructions, and the example is chosen for its similarity to the target input. The system’s parameters stay fixed throughout.

The authors test this idea on tasks including science and medical [question answering](https://md.research.elamur.ai/free/en/topics/question-answering/) and financial sentiment classification. Compared with zero-shot prompting, where the system receives the target instruction and input alone, the paper reports average relative performance gains of 107% for LLaMA-2 7B, 18.6% for LLaMA-2 13B, and 3.2% for GPT3.5. The largest relative gain comes from the system with the weakest zero-shot scores. The choice of example matters. Selecting related inputs works better than drawing examples at random, and pairing a target with a poorly suited source can lower accuracy. Adding more source demonstrations often leaves accuracy flat or makes it worse.

The paper also tests a way to use several sources without placing competing demonstrations in the same prompt. Each source supplies a prediction for an unlabeled target item. A vote turns those predictions into a provisional answer, or pseudo-label. The resulting target examples then serve as demonstrations for new target inputs. With LLaMA-2 7B, prompts built this way reach 48.5% average accuracy across the target tasks, compared with 26.9% using examples labeled by zero-shot predictions and 47.6% using human labels. The pattern varies by benchmark, and the gains from cross-task pseudo-labeling are smaller with GPT3.5.

The authors also examine what happens inside the system and where it goes wrong. Sources whose instructions produce activations similar to those of the target instruction frequently yield better accuracy. The relationship changes across layers and across targets, so it offers a clue about transfer while leaving its causal mechanism open. Individual failures show the practical stakes of source selection. A demonstration can supply a way to structure an answer, but it can also lead the system to copy the wrong answer letter or to return grammatical tags for a sentiment question.

## Deep dive: Language Models can Exploit Cross-Task In-context Learning for Data-Scarce Novel Tasks

Chatterjee and colleagues test whether labeled examples from other tasks can improve answers when a new task has no labeled examples. · about 35 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### When a task comes with instructions alone

A task instruction tells the system what operation to perform. A demonstration shows that operation on a concrete input and supplies the expected result. The gap between those two kinds of guidance matters when a task imposes both a decision rule and an answer convention. A financial sentiment instruction can specify that the reader should judge the likely effect of a news item and return a polarity label. A completed example can show what evidence is relevant to that judgment and what the finished answer should look like. In the setting studied here, the user can supply the instruction while having no verified example of the target decision.

The authors motivate this case through ordinary use of automated assistants. A researcher can sometimes write demonstrations by hand. A user looking for a quick answer may lack the time, the expertise, or the inclination to do so. The paper describes stronger zero-shot performance as one reason large systems are attractive in that setting and computational cost as one reason smaller systems remain relevant. The practical question is whether a stock of labeled examples already available for other tasks can improve what a smaller system does with an unfamiliar request.

In the paper, *zero-shot* means that the prompt supplies the target task definition and the query without a worked example. The term identifies the information supplied at prediction time. The use of *novel* is similarly tied to the experimental setup. An experimenter withholds labeled target demonstrations while still using a benchmark with known answers to score the predictions. This makes it possible to measure the effect of withholding examples. It leaves open what the system encountered during its prior training, and it allows some source and target tasks to resemble one another.

The experiment therefore changes which examples a predictor can see while keeping its learned parameters fixed. [Fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) changes those parameters using training data. In-context learning supplies evidence in the prompt for the current prediction. An example that helps with one query can be replaced for the next query, and the two predictions can use the same underlying system. That distinction makes the paper’s source-selection question concrete. Transfer can be investigated by swapping a block of text and observing the answer.

#### What earlier prompting studies supplied

The authors trace this form of learning without gradient updates to the GPT-3 study. A prompt containing worked examples let the same predictor handle a range of tasks. Subsequent research asked how to choose demonstrations that made this behavior more reliable. The main setting in those studies supplied examples of the same task as the query. A useful selector, in that setting, had to choose among examples that already followed the target instruction. [Language Models are Few-Shot Learners](https://md.research.elamur.ai/free/en/papers/brown-2020-language-models-few-shot-learners/)

One approach chose examples by how closely their meaning matched the query. The account in Chatterjee and colleagues’ paper emphasizes that input similarity could improve results as well as make prompting more robust. Other work considered examples with low perplexity, a way to choose text the predictor finds relatively probable. A retrieval study trained a procedure with successive selection stages to identify promising examples. These approaches show why selection matters even when every available demonstration already belongs to the task being evaluated. [What Makes Good In-Context Examples for GPT-3?](https://md.research.elamur.ai/free/en/papers/liu-2022-what-makes-good-context-examples/) and [Learning To Retrieve Prompts for In-Context Learning](https://md.research.elamur.ai/free/en/papers/rubin-2021-learning-retrieve-prompts-context-learning/)

The closest motivation described in the paper comes from cross-lingual prompting. Earlier work found that demonstrations in another language could help when the source and target examples were aligned in meaning and task. Changing the task presents a related problem with an extra complication. The operation to perform can change at the same time as the subject matter, and a label that is valid for one input may be invalid for the other. The person writing a cross-task prompt must give the system a way to see where one operation ends and the next begins.

The paper also places its question beside work on learning multiple tasks during training. T5 provides an example of a system trained to solve different text-processing problems in a shared framework. Another line of work used task prefixes during multitask pretraining. Chatterjee and colleagues draw on the idea that a shared system can carry out multiple operations, then ask what information can be shared when a demonstration arrives at prediction time. The relevant intervention is which finished example the system sees before making its next decision. [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://md.research.elamur.ai/free/en/papers/raffel-2019-exploring-limits-transfer-learning-unified/)

The authors also discuss Meta-CoT, an earlier proposal that put examples from multiple tasks into prompts for [chain-of-thought prompting](https://md.research.elamur.ai/free/en/papers/wei-2022-chain-thought-prompting-elicits-reasoning/). That work considered mixed-task prompts in connection with stepwise reasoning. In the setup studied here, the demonstrations are labeled input–output pairs. A source may be useful even when its worked answer consists of a single label. The question is whether that pair helps the system answer the next item under a different instruction.

#### What could carry over from a source task

The source and target can share subject matter, answer format, or some part of the reasoning an input calls for. These kinds of resemblance can appear independently. A school science question and a harder science question may share subject matter and require the answer as a letter. A question about a passage and a question from a medical exam may put evidence and choices in front of the reader but expect different kinds of judgment. A news topic label and a financial polarity label both reduce text to a category while classifying different properties of it. Those possibilities make a source worth testing even when its label has no meaning in the target task.

They also create a risk. If the worked source answer is a sequence of tags, the system may continue in that format after the prompt switches to a target that needs a single sentiment word. If both tasks accept letters, copying the source’s letter can look like compliance while giving the wrong answer. A demonstration can help in one respect and interfere in another. Because of this, the authors treat the definition of each task as part of the prompt. It describes the requested operation and, where relevant, which forms of answer are valid.

The paper takes some inspiration from biological studies of how experience can carry over between skills. Its computational motivation comes from work on the [Transformer and attention](https://md.research.elamur.ai/free/en/concepts/transformer/) that describes pathways involved in particular behaviors. If different tasks depend on some shared operations, a source demonstration might engage operations that the target can also use. That is a rationale for looking at activations after the behavioral experiments. The behavioral test itself asks a simpler question that can be answered from predictions. Does adding a labeled example under its own instruction make the system more accurate on a query under another instruction? [Towards Automated Circuit Discovery for Mechanistic Interpretability](https://md.research.elamur.ai/free/en/papers/conmy-2023-towards-automated-circuit-discovery-mechanistic/)

### The method, step by step

#### Build a demonstration around the target input

The procedure begins with a target instruction and a new target item. The target item is the thing to be classified or answered. A multiple-choice target input includes its question and options. A financial sentiment input supplies the sentence to be classified. The instruction describes what to infer from that input and how to express the result. For a test query, the prompt stops where the answer should begin.

The experiment then chooses a source task with labeled examples. Each candidate has an input and a known output under the rules of that source. The procedure compares candidate inputs with the current target input. It retrieves a close match, keeps the source’s original answer, and places the two under the source instruction. The prompt then switches to the target instruction and presents the unanswered item. A new target query can retrieve a different example from the same source.

The paper illustrates the setup with BoolQ as the source and MedMCQA as the target. A BoolQ demonstration supplies a passage, a question about it, and an answer expressed as true or false. A MedMCQA item supplies a medical question and answer options. Its instruction calls for the letter of the chosen option. The selected BoolQ input is related to the medical query according to the retrieval score. The Boolean answer remains in the source block, where it shows how the BoolQ item was resolved. The medical instruction tells the system which operation and response convention govern the query that follows. [BoolQ](https://md.research.elamur.ai/free/en/papers/clark-2019-boolq-exploring-surprising-difficulty-natural/) and [MedMCQA](https://md.research.elamur.ai/free/en/papers/pal-2022-medmcqa-large-scale-multi-subject/)

How a cross-task prompt is assembled The steps in order.

#### Retrieve examples by input similarity

The main retrieval procedure represents text with an embedding, a vector of numbers used to compare inputs. [Sentence-BERT](https://md.research.elamur.ai/free/en/papers/reimers-2019-sentence-bert-sentence-embeddings-siamese/) creates these vectors for the target item and the candidate source inputs. The authors rank source candidates by cosine similarity, which measures how closely two vectors point in the same direction. High similarity provides a way to retrieve related examples even when their datasets use different instructions or labels. The retrieval criterion concerns the inputs. The gold label of the target query plays no role in selecting the example.

This is an operational use of [semantic similarity](https://md.research.elamur.ai/free/en/concepts/semantic-similarity/). The paper’s prompt examples show what a match can look like when two tasks have quite different requirements. One pairs a duplicate-question example about income with a financial sentence about earnings. Income provides a point of contact even though the duplicate-question label has no place in the financial output. Another pairs a commonsense question about what clouds float in with a science question about the term for water vapor in air. The source answer illustrates one application of options, while the target requires selecting its own answer from a new option list.

In the standard experiment the candidate source task is fixed for the pairing under evaluation. Retrieval determines which example from that source to use. It helps to separate this from choosing a source task in the first place. A target query can have a close text match inside a source whose instruction or output convention produces poor transfer. Conversely, an effective source may contain both relevant and irrelevant examples. The experiments vary both parts of the decision, but the main retrieval score ranks candidate inputs within the designated source.

The paper also compares Sentence-BERT with E5 and with representations taken from the final layer of LLaMA-2 7B. Those alternatives change how the method finds inputs that resemble the target. The basic prompt still contains the original source instruction, the selected example with its answer, and the target query under its own instruction. This distinction matters because a different retriever can change the demonstration even when the answer-generation procedure stays the same.

#### Specify the source and target blocks

The primary setup is one-shot prompting: the prompt has one complete demonstration, and it comes from the source. The paper expresses the prediction as a conditional choice.

```
ŷₜ = argmaxᵧ p(y | (dₛ ⊕ xₛ ⊕ yₛ ⊕ dₜ ⊕ xₜ))
```

Here `ŷₜ` is the predicted output for the target. The subscript `ₜ` denotes the target and `ₛ` denotes the source. The symbol `y` is a candidate output, and `p(y | …)` is its probability conditional on the prompt inside the parentheses. The vertical bar marks that conditioning. The operation `argmaxᵧ` chooses the candidate `y` with the highest conditional probability, and `=` gives the resulting prediction. The operator `⊕` joins the prompt fields in the displayed order. The source instruction is `dₛ`, the selected source input is `xₛ`, and its known answer is `yₛ`. The target instruction is `dₜ`, and the target input awaiting an answer is `xₜ`.

The candidate source inputs come from `Dₛ`, the source dataset. The query belongs to `Dₜ`, the target dataset. The two definitions apply locally to the blocks that follow them. This layout gives the demonstration enough information to make sense on its own. It also makes an explicit transition before the query, so the final instruction can specify the convention to use when the earlier example has a different one. The formula states the prediction objective. The default decoding procedure used to generate answers is described separately below.

The zero-shot comparison keeps the target instruction and query and leaves out the source block. Ordinary in-task prompting instead places a worked target item under the target instruction before the query. Since a source demonstration and a target demonstration play different roles, the authors also test a prompt that includes both. Its order makes the difference visible. After the source block, the reader sees the target definition, then a completed target example, then a target item with its answer left open.

```
ŷₜ = argmaxᵧ p(y | (dₛ ⊕ xₛ ⊕ yₛ ⊕ dₜ ⊕ xₗₜ ⊕ yₗₜ ⊕ xₜ))
```

The result `ŷₜ` is the predicted target answer, and `=` marks its assignment. The operation `argmaxᵧ` selects the candidate answer `y` that maximizes `p(y | …)`, its conditional probability given the concatenated prompt. Parentheses enclose that prompt, the bar indicates conditioning, and `⊕` joins adjacent fields. The subscript `ₛ` identifies the source instruction `dₛ`, input `xₛ`, and answer `yₛ`. The subscript `ₜ` identifies the target instruction `dₜ` and query `xₜ`. The added subscript `ₗₜ` denotes the labeled target demonstration. Its input is `xₗₜ` and its known answer is `yₗₜ`. The paper uses `Tₜ` for the target collection from which that labeled example is sampled.

For example, one mixed prompt starts with a movie-review sentiment item from SST2 and follows it with a financial sentiment item and its human label. The final input is another financial sentence. The source and target share some judgment of polarity, but the target instruction and worked target item establish that the classification concerns financial news. Another mixed prompt places a reading comprehension question before a medical demonstration. The setup asks whether the source block still contributes when the target already has a worked example of its own.

The authors also construct prompts with several examples from source tasks. They hold the total at four in one comparison and change how those examples are distributed. One setting retrieves all four from the strongest single source for the target, as measured in the one-example experiments. A second draws four source tasks at random and retrieves a similar example from each. A third uses the four highest-performing sources and retrieves one example per source. Random selection here concerns which tasks supply examples. A separate experiment randomizes which item is drawn from a given source pool.

#### Turn predictions into target demonstrations

The pseudo-labeling procedure changes where cross-task examples appear. The authors start with a small collection of target items that can be used as potential demonstrations, with their answers treated as unknown. The paper calls this collection `Dₚₗ`, a subset of the target dataset `Dₜ`. In the main comparison it has size 8. For each item, the procedure builds independent cross-task prompts using all available source tasks. The sources therefore contribute their own predictions for the same target item.

The authors use majority voting to assign a pseudo-label. For an unlabeled target input `xₚₗ`, the winning generated answer becomes the provisional target label `yₚₗ`. Having several predictions gives an item a source of supervision even when none of the source tasks comes with an official label for it. Those provisional labels may contain mistakes. The test is whether the resulting examples are good enough to improve answers when used in a prompt.

At prediction time the system sees the target instruction and worked target examples built from those pairs. The source instructions and original source labels appeared in the earlier prompts used to generate the vote. They are absent from this final prompt. The distinction makes it possible to draw on multiple source tasks while giving the predictor a final context whose examples all use the target operation. It also creates a second point of comparison. The researchers can hold the target demonstration inputs fixed and change where their labels came from.

The paper compares targets labeled by people, targets labeled by zero-shot predictions, and targets labeled by cross-task votes. The first uses the annotations already available for experimental evaluation. The second runs the target instruction and each demonstration input without a worked example to obtain a provisional answer. The third uses source-conditioned predictions. In each case the final prompt uses labeled target inputs. Differences in its accuracy can therefore reflect the consequences of changing those labels under the tested prompting setup.

#### Decode an answer and check its format

The main experiments use greedy decoding. At each generation step the system can select the most probable token from its full vocabulary. This leaves it free to emit an option letter or a sentiment label, as well as any other token it favors. The choice makes following the output instruction part of the evaluated behavior. A sentence that names the correct multiple-choice option can still depart from a task that requests a letter.

The appendix evaluates force decoding as well. In this alternative the system compares probabilities over the permitted labels and returns the highest-probability one.

```
ŷₜ = argmaxᵧ∈Lₜₐₛₖ p(y | C)
```

Here `ŷₜ` is the answer predicted for the target, and `=` assigns the value selected by the expression on its right. The operation `argmax` chooses the candidate `y` that maximizes the conditional probability `p(y | C)`. The symbol `∈` restricts `y` to the set `Lₜₐₛₖ`, the label space of the target task. This writes out the task subscript that the paper denotes by `T`. The bar indicates that the probability is conditioned on `C`, the prompt context used for prediction. The parentheses enclose the arguments of the probability expression.

For ARC-Challenge, MedMCQA, and SciQ, the permitted answers are `A`, `B`, `C`, and `D`. Social-i-QA uses `A`, `B`, and `C`. Financial-Phrasebank accepts the sentiment categories positive, neutral, and negative. These are the same conventions described by the target instructions. The constrained decoder enforces the convention at the point of selection, while the greedy decoder relies on the system to follow it from the prompt.

The experiments reuse benchmark data and leave the prediction systems’ parameters fixed. The labeled source pools provide retrieval candidates. The target samples provide queries and reference answers for evaluation, with target demonstrations introduced in the corresponding prompting conditions. The paper also makes the implementation available as Cross-Task-ICL.

### Experiments and results

#### The source library and the target samples

The experiment pairs ten source tasks with five target tasks, giving 50 source–target setups. Source tasks span several operations, including classification of a whole sentence, comparison of two texts, answering questions, and assigning a label to each token. The targets cover financial sentiment and multiple kinds of question answering. The paper evaluates LLaMA-2 7B, LLaMA-2 13B, and text-davinci-003, which it calls GPT3.5. It also includes a separate instruction-tuned LLaMA-2 7B Chat experiment. [Llama 2](https://md.research.elamur.ai/free/en/papers/touvron-2023-llama-2-open-foundation-fine/)

The source [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/) collections vary in where the answer is expected to come from. RACE supplies passages and exam questions. ARC-Easy supplies multiple-choice questions about natural science. Commonsense-QA requires a choice among alternatives using everyday knowledge or reasoning. BoolQ asks whether the answer to a question is yes or no in light of a passage. That last setting allows the authors to test transfer from a judgment grounded in a text even when the target asks for a choice among several options. RACE

SST2 supplies sentiment labels for movie-review snippets, while AG-news assigns topics to news articles. In MNLI, the task is to decide whether the premise entails the hypothesis, contradicts it, or does neither. QQP provides question pairs whose label indicates whether they ask the same thing. These sources all expect an answer at the level of the input as a whole. What counts as evidence for one decision can differ greatly from what matters for another. [Stanford Sentiment Treebank](https://md.research.elamur.ai/free/en/papers/socher-2013-recursive-deep-models-semantic-compositionality/) and [Multi-Genre Natural Language Inference](https://md.research.elamur.ai/free/en/papers/williams-2018-broad-coverage-challenge-corpus-sentence/)

The CoNLL sources use a different output structure. Conll2003-POS is a [part-of-speech tagging](https://md.research.elamur.ai/free/en/concepts/part-of-speech-tagging/) task that provides a grammatical category for each token. Conll2003-NER is a [named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/) task that identifies and classifies spans such as people and organizations through sequences of tags. The two sources let the experiment test transfer from dense token-level outputs to target tasks that each expect a single choice. [CoNLL-2003 shared task](https://md.research.elamur.ai/free/en/papers/sang-2003-introduction-conll-2003-shared-task/)

The main design standardizes the size of the source pools where possible. The appendix reports source samples of 10K for datasets including AG-news, MNLI, and RACE. Several sources use smaller training pools as documented there. ARC-Easy provides 2251 training questions, BoolQ provides 9427 training question–passage pairs, and Commonsense-QA provides 9740 labeled training questions. Retrieval runs against the applicable source pool. An item in that pool serves as a demonstration if it is selected for the current query.

The authors sample 500 evaluation examples per target and keep the number of examples for each answer label roughly equal. ARC-Challenge draws 500 items from a test set of 1172 questions. Its science questions were selected for difficulty using prior automated approaches, and the task offers a harder counterpart to ARC-Easy. SciQ also supplies test examples, with 500 sampled from 1000 science questions. These two targets can share an answer format and broad scientific content with some source tasks. [AI2 Reasoning Challenge](https://md.research.elamur.ai/free/en/papers/clark-2018-think-have-solved-question-answering/)

MedMCQA and Social-i-QA draw their evaluation examples from validation splits. The medical sample takes 500 questions from the 4183 in its validation set, and the social reasoning sample takes 500 examples from 1954. MedMCQA uses medical entrance examination questions. Social-i-QA supplies a description of a social situation and asks the reader to choose an answer based on it. Both are multiple choice, but the knowledge that supports the choice differs. [Social-i-QA](https://md.research.elamur.ai/free/en/papers/sap-2019-socialiqa-commonsense-reasoning-about-social/)

Financial-Phrasebank draws 500 target sentences from a training split containing 2264 labeled sentences. A label expresses the polarity of a financial news sentence in terms of its possible effect on stock price. This makes the dataset a useful counterpoint to the question-answering targets. It expects a sentiment word, and its news-oriented vocabulary can be similar to texts in sources that have completely different objectives. The benchmark’s original split name describes where the sample came from. Its role in this experiment is to provide target items and annotations.

#### How to read the accuracy comparisons

Accuracy measures the share of evaluated target items answered correctly. In the principal comparison, the systems and target samples remain fixed while the authors change the prompting condition. The zero-shot column uses the target instruction alone with each query. The source columns add a retrieved, labeled example of the indicated source task. Each cell therefore concerns one predictor, one target benchmark, and one way of building its prompt. The average row for a source describes its accuracy across the target benchmarks.

A reported percentage gain over zero-shot and an accuracy value answer different questions. Accuracy indicates how often the evaluated system produced the correct response. A relative improvement describes the size of the change in relation to the starting performance. This matters when comparing predictors whose baselines are far apart. The paper’s best-source aggregate figures and its averages across pairings also answer different questions. Strong performance on one tested source can demonstrate what the procedure can achieve, even as its reliability throughout the remaining library stays uncertain.

The default tendency is clearest in the weakest zero-shot system. LLaMA-2 7B averages 18.4% accuracy across the five target samples with no demonstration. With ARC-Easy as the source it averages 44.3%, and with RACE it averages 48.3%. LLaMA-2 13B begins at 47.5% and reaches 61.7% when RACE provides the example. GPT3.5 moves from 69.8% with zero-shot prompting to 74.9% with ARC-Easy. These are source averages across the target tasks in the one-demonstration setting, using the paper’s main greedy decoding procedure.

LLaMA-2 7B mean accuracy across the five target benchmarks The strongest source shown is RACE, while the tagging source yields a smaller gain over the instruction alone.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Zero-shot | 18.4 |
| Conll2003-NER source | 25.5 |
| AG-news source | 41.6 |
| ARC-Easy source | 44.3 |
| RACE source (this paper) | 48.3 |

For the strongest overall source settings in this comparison, the paper reports relative improvements of 162% for LLaMA-2 7B, 30% for LLaMA-2 13B, and 7% for GPT3.5. Across the wider set of pairings, the reported average gains are 107%, 18.6%, and 3.2%, respectively. The two sets of figures show how much results depend on the source. In the 7B case especially, the best observed source yields a larger improvement than the typical source across the experiment.

The effects can change direction within a single target. With LLaMA-2 7B on Financial-Phrasebank, the zero-shot accuracy is 34.1%. Using Commonsense-QA brings it to 14.6%, while AG-news yields 62.1% and SST2 yields 65.0%. The contrast is informative because the news source and the sentiment source each share a different feature with the target. AG-news gives an example of classifying a news text. SST2 gives an example of classifying sentiment. Both can help on financial polarity, while the commonsense source is more helpful on other targets.

On MedMCQA, the same 7B system starts at 4.2% with the target instruction alone. A Commonsense-QA source brings accuracy to 33.0%, and ARC-Easy brings it to 31.4%. With GPT3.5, the corresponding zero-shot medical accuracy is already 49.6%. Commonsense-QA yields 49.8%, while AG-news yields 48.5%. The size and direction of a source’s effect thus depend on the predictor as well as the target. A source can deliver a conspicuous change in one setup and a small change in another.

On SciQ, LLaMA-2 7B records 8.0% with zero-shot prompting, 65.6% with Commonsense-QA, and 64.4% with RACE. The shared multiple-choice format is one plausible contributor. A more distant source can still help in this setting. MNLI yields 44.8% on the same target and predictor even though its labels describe the relationship between sentences. This gives the authors reason to study how far transfer extends beyond sources with visibly similar formats.

The paper’s significance analysis uses one-tailed tests, grouped by source task over the samples of the target tasks, with `α = 0.05`. It reports significance for all source tasks with LLaMA-2 7B in this aggregate analysis. For LLaMA-2 13B and GPT3.5, the part-of-speech and named entity sources fall outside the reported positive findings. The unit of that analysis matters. Its entries summarize a source across target samples, while an individual source–target cell can still decline even when the aggregate comparison favors the prompting method.

#### When a labeled target example is available

The next comparison starts from a prompt with one human-labeled target demonstration. The cross-task version prepends one labeled source example. This tests the incremental value of the source when the target already supplies its own example of an acceptable decision and answer form. It differs from the direct cross-task comparison because the latter tests what a source can do in the absence of that target guidance.

On SciQ with LLaMA-2 7B, the in-task demonstration yields 67.4% accuracy. Adding an ARC-Easy demonstration brings it to 73.4%. On Social-i-QA, the same in-task baseline is 43.3%, and adding Commonsense-QA brings it to 58.3%. Other choices reduce accuracy. On SciQ, for example, adding AG-news yields 60.4% under the same general prompt design. A human-labeled example clarifies the target, yet the source can still pull predictions in a helpful or harmful direction.

The target demonstration can be especially valuable for financial sentiment. With LLaMA-2 13B, the in-task Financial-Phrasebank condition reaches 86.0%. None of the tested one-source additions improves that score. With GPT3.5, MedMCQA is another case in which the in-task baseline, 52.0%, exceeds the variants that add a source example. Across most other predictor–target combinations the authors identify at least one source that helps. They find less consistency about which source to pick once a target example is already present.

The authors also vary the source and target composition of an 8-shot prompt while keeping the total demonstration count fixed. One end uses entirely in-task demonstrations. The other uses entirely cross-task demonstrations assembled using the strongest mixed-source strategy. For ARC-Challenge, MedMCQA, SciQ, and Social-i-QA, the paper describes the endpoints as giving nearly the same accuracy across the three principal predictors. Financial-Phrasebank is the exception. This comparison concerns those prompt compositions and target samples. The single-source and pseudo-label experiments ask different questions about what can be done without human-labeled target examples.

#### How well provisional target labels work

The pseudo-label experiment evaluates the accuracy of predictions made *after* provisional examples have been added to the prompt. This score reflects the usefulness of the labeled demonstrations for answering new target queries. It is distinct from the fraction of pseudo-labels that directly match the human annotations. Even an imperfectly labeled set can provide useful guidance for some queries, and the value of its labels depends on how the answering system uses them.

For LLaMA-2 7B, the cross-task vote produces prompts with an average downstream accuracy of 48.5% across the target benchmarks. The zero-shot pseudo-label condition yields 26.9%, and the human-label condition yields 47.6%. With LLaMA-2 13B the corresponding averages are 62.2% with cross-task votes, 40.62% with zero-shot labels, and 62.1% with human labels. The close aggregate results for cross-task and human-labeled demonstrations are the practical finding. The benchmark breakdown reveals cases where the ordering changes.

LLaMA-2 7B mean target accuracy by demonstration label source Cross-task voting yields downstream accuracy close to human-labeled examples and ahead of zero-shot labeling.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Zero-shot pseudo-labels | 26.9 |
| Human labels | 47.6 |
| Cross-task pseudo-labels (this paper) | 48.5 |

On SciQ, LLaMA-2 7B reaches 67.7% downstream accuracy with human-labeled examples and 64.6% with cross-task pseudo-labels. The zero-shot pseudo-label version reaches 3.3%. On Financial-Phrasebank, the three conditions are closer and ordered differently. The human-label accuracy is 48.4%, the zero-shot pseudo-label accuracy is 56.5%, and the cross-task pseudo-label accuracy is 56.8%. These results show that a gold label is a reliable annotation of the demonstration itself, while the value of that demonstration in a prompt also depends on the system and the other examples.

For GPT3.5, the average downstream accuracy is 74.2% with human-labeled examples, 74.9% with examples pseudo-labeled zero-shot, and 75.3% with examples pseudo-labeled by cross-task voting. These averages lie much closer together than the LLaMA-2 comparisons. At the target level, the paper identifies SciQ and Social-i-QA as cases where the cross-task pseudo-label condition gives lower accuracy than human labels across all three predictors. For a data-scarce target, the vote is best understood as another way to assemble demonstrations, with measured benefit that depends on both the available system and the benchmark.

### What the ablations show

#### Which part of the prompt provides the benefit?

The source-definition ablation removes the instruction that explains the source example. The example remains, and the target still has its own instruction. With LLaMA-2 7B, average accuracy across the target benchmarks is 38.1% in the reported comparison with source definitions and 33.8% without them. The corresponding LLaMA-2 13B averages are 56.4% and 51.6%. The paper describes these changes as average drops of 11% and 8%, respectively.

The aggregate result gives a reason to identify both tasks in a cross-task prompt. An uncued example leaves more for the predictor to infer about why the source output was produced and where its rule applies. A written definition can make the structure of the demonstration easier to read. The effect is uneven. MedMCQA accuracy with LLaMA-2 7B is 27.3% with source definitions and 17.06% without them, while the corresponding SciQ values are 45.7% and 48.1%. Explicit boundaries help in the aggregate, and a particular target can respond differently to their removal.

The retrieval comparison changes how the demonstration is selected within a source task. In the random setting, the paper averages results across three seeds. In the similarity setting, it uses the ranked input representations to select the example. With LLaMA-2 7B and MNLI as the source for Financial-Phrasebank, the random choice gives an average accuracy of 0.0%, while the semantically selected demonstration gives 62.7%. With QQP as the source on the same target, the reported values are 0.0% and 44.7%. The example’s membership in the source dataset is insufficient to reproduce the gain. Its relation to the particular query matters in these comparisons.

Similarity can help explain why two examples appear together without ensuring that the same label applies. The paper also tests randomly labeled examples in target contexts and finds performance generally close to random. With LLaMA-2 7B, for example, random labeling yields 25.07% on ARC-Challenge with 1 demonstration and 25.00% with 8. For MedMCQA the corresponding values are 25.00% and 24.80%. These experiments examine a different form of randomization from random retrieval. Random retrieval changes which real source input and answer are shown. Random labeling breaks the usual relation between a worked input and the answer attached to it.

The embedding comparison varies the representation used to retrieve similar examples. Using final-layer LLaMA-2 7B representations for retrieval was computationally more expensive in the authors’ experiment, with no significant performance gain. E5 and Sentence-BERT produced comparable results overall in the tested setup, with individual pairings moving in either direction. On LLaMA-2 7B and SciQ, for example, an ARC-Easy demonstration retrieved with E5 gives 62.40% accuracy, compared with 59.0% in the main Sentence-BERT result. With RACE on the same target, these accuracies are 65.40% and 64.4%. The authors retain Sentence-BERT based on comparable performance and its use for related retrieval tasks in earlier studies.

#### How many demonstrations can help?

Adding source examples from the same task is one way to test whether a useful initial example is the beginning of a steady improvement. In the LLaMA-2 7B analysis, performance generally flattens at `k = 1`, where `k` counts source demonstrations in the prompt. In some cases, adding more examples lowers accuracy. The authors use one source example as the default because the broader experiment offers little evidence that a longer source block systematically reinforces a helpful signal.

Mixing source tasks within a prompt is a different way to add information. At a fixed total of four demonstrations, the experiment compares the strongest single source with randomly chosen sources and with the highest-ranked mix. LLaMA-2 7B averages 47.84% using four examples from the best source for each target, 44.62% using the random mix, and 47.82% using the best mix. LLaMA-2 13B averages 63.06%, 61.86%, and 61.71%, respectively. The average favors the single-source selection in each case, although the gap is small between the two best-ranked variants for LLaMA-2 7B.

There are target-level benefits hidden by those averages. On SciQ with LLaMA-2 7B, the four-example single-source condition records 46.2%, the random mix 60.5%, and the best mix 67.2%. On ARC-Challenge with the same predictor, those settings yield 51.6%, 42.8%, and 44.0%. The outcome depends on what the prompt includes and which decision follows it. A common demonstration count makes it possible to see that changing the source composition can help one target and hurt another even when the length in examples stays fixed.

Experiments on the number of pseudo-labeled target demonstrations give a different response. With LLaMA-2 7B, accuracy generally rises as more target examples with provisional labels are supplied. Financial-Phrasebank again departs from the general trend, with performance falling as the number grows. Source demonstrations present the system with examples of another task. Pseudo-labeled demonstrations present repeated applications of the target instruction, albeit with labels that may be wrong. Their divergent behavior helps explain why the authors view a vote followed by target-only demonstrations as a practical alternative to accumulating heterogeneous source blocks.

#### How much depends on the permitted answer?

The force-decoding control asks what happens when the test enforces the target label space. Under greedy decoding, LLaMA-2 7B obtains 8.0% zero-shot accuracy on SciQ. With force decoding, it obtains 59.60% on that target. The LLaMA-2 13B SciQ zero-shot score also rises, from 55.8% under greedy decoding to 82.00% under the restricted choice. MedMCQA shows a similar baseline effect. LLaMA-2 7B moves from 4.2% to 26.00%, and LLaMA-2 13B from 9.2% to 36.60%.

Zero-shot accuracy on SciQ for LLaMA-2 7B by decoding rule Restricting the answer to valid option labels raises the zero-shot score.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Greedy decoding | 8.0 |
| Force decoding (this paper) | 59.60 |

Source demonstrations remain helpful in some restricted settings. On SciQ, the LLaMA-2 7B pairing with Commonsense-QA gives 65.60% under force decoding. With AG-news it gives 37.00%, below the restricted zero-shot score. The restricted choice eliminates invalid output forms as a category of failure, while leaving the source capable of changing which valid label receives the most support. The effect of a demonstration can therefore include help with the output convention as well as changes in the underlying selection among target labels.

The instruction-tuned comparison tests another change to the starting conditions. LLaMA-2 7B Chat obtains 42.00% zero-shot accuracy on ARC-Challenge, where the base 7B system has 4.6% under the main greedy setting. The Chat system still benefits from some demonstrations, reaching 51.40% with RACE on that target. Other pairings lower its score. On Social-i-QA it obtains 52.10% zero-shot and 48.10% with ARC-Easy as the source. The paper interprets the generally smaller gains for the Chat system in light of its stronger instruction-only baseline. The result also shows that instruction tuning can change which source–target relationships are helpful.

#### What the activation comparisons reveal

The [interpretability](https://md.research.elamur.ai/free/en/topics/interpretability/) analysis compares a different kind of similarity from the retrieval stage. Retrieval compares individual source and target inputs using an external encoder. This analysis compares internal representations associated with the source and target *instructions*. For a given layer, the authors average the activations of the instruction tokens and measure cosine similarity between the resulting source and target vectors. That gives each candidate source a similarity score for the target at that layer.

At the final layer, the paper reports that the source definition with the highest similarity also corresponds to the best-performing source in 80% of the examined cases. The final-layer comparison covers LLaMA-2 7B and LLaMA-2 13B. An instruction can thus show evidence of a shared representation even though its individual demonstration is selected separately, by comparing inputs. The result is a retrospective match between an internal score and observed performance under the experiment’s source pool.

The layerwise analysis focuses on LLaMA-2 7B. For each target, it relates the similarity scores for the source instructions to the observed changes in target accuracy relative to zero-shot. Spearman’s rank-order coefficient and Kendall’s tau describe agreement in ordering. The Pearson coefficient describes how the compared values move together. Computing these measures at successive layers lets the authors ask where similarity tracks source usefulness most closely.

For several targets, the correlations start high, fall in earlier or middle layers, and strengthen again towards the end. On ARC-Challenge, the Spearman coefficient is 0.70 at Layer-1, -0.09 at Layer-3, and 0.74 at Layer-32. Financial-Phrasebank shows a weaker association in much of the interior of the system, with a Spearman coefficient of -0.36 at Layer-4, 0.04 at Layer-28, and 0.49 at Layer-32. The financial case motivates the authors’ observation that a later recovery in correlation can occur at a different point depending on the target.

MedMCQA illustrates why the layer pattern needs a benchmark qualifier. Its Spearman coefficient drops from 0.75 at Layer-1 to 0.01 at Layer-3, then reaches 0.93 at Layer-8 and remains high at many intermediate layers. It records 0.78 at Layer-32. The relationship between activation similarity and prompting performance thus becomes strong well before the final layer in this case. The authors discuss task-specific computation and transfer as possible explanations for the overall profiles. The analysis measures correlations across source choices, leaving the timing and causal role of the relevant computations open.

#### What the errors look like in a prompt

The error analysis uses outputs from LLaMA-2 13B to show how a source demonstration can interfere. In one financial sentiment example, the source supplies grammatical tagging. The target asks for a polarity label, and the system generates a short sequence of grammatical tags instead. This is a label-space error. The source output is an intelligible response to its own type of task, but applying that type of output to financial sentiment defeats the purpose of the target instruction.

A named entity demonstration can lead to a less interpretable failure. In another financial example, the predictor emits a string of repeated `N` characters. The target’s gold sentiment is neutral. The authors suggest the output may combine the initial of that word with the source example’s pattern of repeated token tags. The output itself establishes that the answer does not belong to either task’s expected labels. The proposed explanation about how it formed is an interpretation of that example.

Copying can be harder to detect when the source and target share answer formats. The paper pairs questions concerning objects that shine by reflected light. The source’s correct answer uses `D`, and the system puts `D` in the target answer slot as well, even though the correct target choice is elsewhere. The response has the right grammatical form for the target. The error concerns which alternative the letter denotes. A similarity-based retriever can bring the system to relevant material while still giving it a tempting surface pattern to reproduce.

The reverse mismatch appears in a science example preceded by a BoolQ demonstration. The system gives the term *fluorescence*, which is the text of the correct option, when the target asks for the option letter. Here the content indicates a correct selection, while the response format violates the prompt. Together, the examples show why aggregate accuracy can move when decoding changes. Some errors arise from answer selection, some from following the instruction about how to express it, and some from adopting a source-task convention where it does not apply.

### Limitations

#### Limits the authors identify

The authors identify source availability as a boundary on the method. Their experiments offer several possible source tasks for each target, and retrieval can search for related inputs within those sources. A genuinely unfamiliar task may have little in common with the available instruction set, input collection, or answer conventions. In that case the procedure may fail to retrieve a demonstration that provides useful guidance. The gains demonstrated here establish viability when a suitable source can be found in the tested pool.

They also distinguish task novelty from a need for new knowledge. A prompt can give a system a worked example of how to apply information already accessible to it. When a correct decision depends on information absent from both pretraining and the prompt, transferring the structure of a different task cannot supply the missing facts. This distinction is especially important for an application that resembles the tested question-answering benchmarks while depending on recent or highly specific information.

The authors characterize their internal analysis as an early step towards understanding cross-task transfer. Similarity between source and target representations can be compared with performance, and the resulting profiles give a way to identify candidate layers or source tasks for further investigation. A mechanistic account would have to establish what information these representations encode and how later computation uses it. The paper leaves that deeper explanation as an open problem.

#### Limits of the comparisons

The test operationalizes novelty by withholding demonstrations. The targets are existing benchmarks with defined answer spaces and human annotations. One target is a harder counterpart of an available source, while several others share multiple-choice conventions with source tasks. The authors’ analysis of dissimilar sources reduces the role of obvious format overlap, but it still works with recognizable task instructions and a source library chosen for the study. Generalization to targets that involve unfamiliar actions or richer answer structures remains unmeasured.

Even the direct cross-task setup depends on having a usable target description. The instruction specifies the decision and frequently gives the legal labels. In a deployed setting, an underspecified request may leave both of those uncertain. The experiments address a more sharply defined case. The system is told what a medical option letter or a sentiment word should mean and is evaluated on whether its answer fits that request. The evidence therefore separates scarcity of labeled examples from scarcity of task specification.

The reported strongest-source variants use performance from the benchmark comparison to identify sources worth reusing. A practitioner with a target instruction and no labeled target examples would need a way to make that decision using information available before scoring. The activation analysis offers a possible signal, but a retrospective match among the chosen tasks leaves prospective selection unverified. It also leaves open how well instruction similarity would work when several source descriptions are plausible paraphrases of the same task or when the pool expands beyond those tested.

Some of the largest gains are measured against greedy zero-shot baselines that are particularly weak. The constrained decoding experiment changes those starting points substantially. This matters for attributing the result. Part of a large relative gain can arise because a demonstration helps elicit a valid response form in a setting where the instruction alone frequently fails to do so. The paper also finds improvements under constrained decoding for some sources. The remaining uncertainty is how much of any particular gain comes from format adherence, selection among labels, knowledge already accessible to the system, or interactions among them.

The target sampling scheme and scoring rule limit what accuracy summarizes. The sampled target labels are approximately balanced. Their frequencies can differ from what a system would face in ordinary use. The main targets require a short categorical output. The experiments observe whether that output is correct, and the qualitative analysis can distinguish some failures of substance from failures of formatting. The design offers limited evidence about longer responses, judgments requiring partial credit, or reliability under other label distributions.

Finally, the pseudo-label method requires access to representative unlabeled target items and multiple source-conditioned predictions for each one. The vote will work best when different sources contribute useful evidence. Sources can instead reinforce the same mistaken answer, and a high downstream average can obscure poor results on a particular benchmark. The study shows that examples constructed by voting can work under the experimental conditions. It leaves the cost of constructing those examples and the reliability of the vote for a new target as separate practical questions.

### What came after

The related survey takes in-context learning itself as its subject. Its scope is broader than cross-task prompting, which concerns the special case where the demonstration and the query follow different instructions. The survey is listed with a 2023 date, earlier than the 2024 proceedings paper. Its bibliographic listing establishes a connection to the literature on learning from demonstrations. The relationship between particular versions, and the survey’s specific treatment of the cross-task experiments, remains unclear. [A Survey on In-context Learning](https://md.research.elamur.ai/free/en/papers/dong-2023-survey-context-learning/)

The work on task-specific neurons takes up multitask generalization through a more localized unit of analysis. Chatterjee and colleagues compare mean activation vectors for complete instructions across layers and relate them to how useful each source is. The later study’s stated focus is detecting and exploring neurons associated with particular tasks. The conceptual link is the question of how a shared system can represent task-specific behavior and still generalize across tasks. The title establishes that focus while leaving the study’s use of individual cross-task prompting settings unspecified. [Towards Understanding Multi-Task Learning (Generalization) of LLMs via Detecting and Exploring Task-Specific Neurons](https://md.research.elamur.ai/free/en/papers/leng-2025-understanding-multi-task-learning-generalization/)

The clearest application-level connection comes from work on argument generation and retrieval. It takes cross-tasking into a setting organized around atomic and complex tasks and reports improvement in zero-shot argument generation and retrieval in its title. Chatterjee and colleagues’ study supplies the precedent for using evidence from one task when a different target lacks demonstrations. The argument study puts a related question in a different setting, where the contrast is between simpler and more complex tasks and the targets include generating and finding arguments. Its title identifies that direction without specifying how it selects sources or constructs demonstrations. [From Atomic to Complex tasks: Cross-Tasking Improves Zero-Shot Argument Generation and Retrieval](https://md.research.elamur.ai/free/en/papers/tamine-2026-atomic-complex-tasks-cross-tasking/)

## Cite

Cite as Anwoy Chatterjee, Eshaan Tanwar, Subhabrata Dutta and Tanmoy Chakraborty. 2024. Language Models can Exploit Cross-Task In-context Learning for Data-Scarce Novel Tasks. Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2024.acl-long.621](https://doi.org/10.18653/v1/2024.acl-long.621)

```bibtex
@inproceedings{chatterjee2024language,
  title = {{Language Models can Exploit Cross-Task In-context Learning for Data-Scarce Novel Tasks}},
  author = {Anwoy Chatterjee, Eshaan Tanwar, Subhabrata Dutta and Tanmoy Chakraborty},
  booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.621},
  url = {https://doi.org/10.18653/v1/2024.acl-long.621}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
