From Cross-Task Examples to In-Task Prompts: A Graph-Based Pseudo-Labeling Framework for In-context Learning (2025)

Abstract: The capability of in-context learning (ICL) enables large language models (LLMs) to perform novel tasks without parameter updates by conditioning on a few input-output examples. However, collecting high-quality examples for new or challenging tasks can be costly and labor-intensive. In this work, we propose a cost-efficient two-stage pipeline that reduces reliance on LLMs for data labeling. Our approach first leverages readily available cross-task examples to prompt an LLM and pseudo-label a small set of target task instances. We then introduce a graph-based label propagation method that spreads label information to the remaining target examples without additional LLM queries. The resulting fully pseudo-labeled dataset is used to construct in-task demonstrations for ICL. This pipeline combines the flexibility of cross-task supervision with the scalability of LLM-free propagation. Experiments across five tasks demonstrate that our method achieves strong performance while lowering labeling costs.

## introduction large language models (llms) have demonstrated impressive capabilities across a wide range of natural language processing tasks @xcite , including semantic parsing @xcite and commonsense reasoning @xcite @xcite . however, the substantial computational cost of retraining or fine-tuning these models limits their practicality for novel tasks @xcite @xcite . fortunately, llms possess an emergent ability known as in-context learning (icl) @xcite , wherein the model can perform new tasks by conditioning on a few inputoutput pairs (i.e., demonstrations) during inference, without updating model parameters @xcite . despite its promise, the effectiveness of icl heavily relies on high-quality labeled examples for the target task. for novel or data-scarce tasks, recent work has explored using llms with zeroshot prompts @xcite @xcite or relying on human annotators @xcite to obtain pseudo-labeled examples, which are then used as demonstrations for icl. yet both approaches have drawbacks: llms can be unreliable on unfamiliar tasks, while human annotation introduces additional time and labor costs @xcite . to overcome this, recent efforts have turned to leveraging well-established, high-resource source tasks to construct demonstrations @xcite . when the examples used for icl are drawn from a different task than the target, the setting is referred to as cross-task icl. for example, @xcite select examples from source tasks based on embedding similarity and demonstrate that such cross-task examples can significantly improve icl performance, highlighting cross-task icl as a promising approach for pseudo-labeling. however, as illustrated in figure 1 , the data dis-tributions of source and target tasks often differ significantly, and the label spaces can be misaligned, even between tasks with similar distributions. this raises a key limitation: selecting cross-task examples based solely on embedding similarity is insufficient for reliable pseudo-labeling of target samples. to address this, we draw inspiration from the graph mining literature, which shows that structural properties of graphs can generalize across domains even when feature spaces are heterogeneous @xcite @xcite . based on this, we propose graph-sim, a graph-based example selection method that augments text embeddings with structural information captured through graph aggregation-a process where each node's representation is updated by aggregating information from its neighbors. these structure-aware embeddings yield more robust similarity metrics across tasks, allowing for better example selection. to further address the label space mismatch across tasks, we propose glip (graphbased label information propagation), a label information propagation framework that uses a small set of pseudo-labeled target examples (obtained via graphsim and an llm) to infer labels for the remaining unlabeled target examples. the resulting pseudo-labeled target set can then be used as highquality demonstrations for in-context learning. notably, our pipeline is cost-efficient and adaptable: it only requires a small number of llm calls for pseudo-labeling and leverages lightweight graphbased propagation for the rest, making it practical for real-world deployment on novel tasks. our contributions can be summarized as follows: in-context learning. in-context learning (icl) @xcite equips large language models (llms) with the ability to leverage a handful of input-output demonstrations for reasoning. icl has proven remarkably successful in handling complex tasks, including summarization @xcite and question answering @xcite . to improve icl performance, many works have explored adaptive strategies for selecting effective demonstrations @xcite @xcite , such as retrieving semantically similar examples @xcite . however, these methods typically assume that the demonstrations and the input come from the same task (i.e., in-task icl) and rely on access to a large pool of labeled examples. this assumption limits their applicability in low-resource or novel task settings, where collecting high-quality annotations is costly and impractical. ## conclusions we propose a cost-effective and scalable pipeline for pseudo-labeling novel target tasks via crosstask icl. we introduce graphsim, a graph-based method that incorporates structural information to improve cross-task similarity estimation. to further reduce llm reliance, we develop glip, a graphbased label propagation technique that extends a small pseudo-labeled seed set to the full target dataset without additional llm queries. our approach combines the generalizability of cross-task supervision with the efficiency of structure-aware label propagation. experiments across multiple nlp benchmarks show that our method achieves competitive icl performance while significantly lowering annotation and inference costs. we hope this work encourages future research on graphenhanced icl and promotes practical solutions for applying llms in low-resource scenarios.