Table of Contents
Fetching ...

Vector-ICL: In-context Learning with Continuous Vector Representations

Yufan Zhuang, Chandan Singh, Liyuan Liu, Jingbo Shang, Jianfeng Gao

TL;DR

Vector-ICL investigates whether large language models trained on text can perform in-context learning on continuous vectors from diverse domains. It introduces embedding projection to map encoder outputs into the LLM's context as box tokens, with projectors pretrained via next-token prediction and optionally finetuned for downstream tasks. Across nine tasks spanning text, time-series, graphs, and neuroscience data, Vector-ICL frequently matches or surpasses few-shot ICL and domain-specific baselines, and the finetuned projectors yield the strongest performance gains. This work broadens the applicability of LLMs by enabling learning from non-textual, continuous representations, with implications for multimodal reasoning and cross-domain transfer.

Abstract

Large language models (LLMs) have shown remarkable in-context learning (ICL) capabilities on textual data. We explore whether these capabilities can be extended to continuous vectors from diverse domains, obtained from black-box pretrained encoders. By aligning input data with an LLM's embedding space through lightweight projectors, we observe that LLMs can effectively process and learn from these projected vectors, which we term Vector-ICL. In particular, we find that pretraining projectors with general language modeling objectives enables Vector-ICL, while task-specific finetuning further enhances performance. In our experiments across various tasks and modalities, including text reconstruction, numerical function regression, text classification, summarization, molecule captioning, time-series classification, graph classification, and fMRI decoding, Vector-ICL often surpasses both few-shot ICL and domain-specific model or tuning. We further conduct analyses and case studies, indicating the potential of LLMs to process vector representations beyond traditional token-based paradigms.

Vector-ICL: In-context Learning with Continuous Vector Representations

TL;DR

Vector-ICL investigates whether large language models trained on text can perform in-context learning on continuous vectors from diverse domains. It introduces embedding projection to map encoder outputs into the LLM's context as box tokens, with projectors pretrained via next-token prediction and optionally finetuned for downstream tasks. Across nine tasks spanning text, time-series, graphs, and neuroscience data, Vector-ICL frequently matches or surpasses few-shot ICL and domain-specific baselines, and the finetuned projectors yield the strongest performance gains. This work broadens the applicability of LLMs by enabling learning from non-textual, continuous representations, with implications for multimodal reasoning and cross-domain transfer.

Abstract

Large language models (LLMs) have shown remarkable in-context learning (ICL) capabilities on textual data. We explore whether these capabilities can be extended to continuous vectors from diverse domains, obtained from black-box pretrained encoders. By aligning input data with an LLM's embedding space through lightweight projectors, we observe that LLMs can effectively process and learn from these projected vectors, which we term Vector-ICL. In particular, we find that pretraining projectors with general language modeling objectives enables Vector-ICL, while task-specific finetuning further enhances performance. In our experiments across various tasks and modalities, including text reconstruction, numerical function regression, text classification, summarization, molecule captioning, time-series classification, graph classification, and fMRI decoding, Vector-ICL often surpasses both few-shot ICL and domain-specific model or tuning. We further conduct analyses and case studies, indicating the potential of LLMs to process vector representations beyond traditional token-based paradigms.
Paper Structure (51 sections, 3 equations, 12 figures, 4 tables)

This paper contains 51 sections, 3 equations, 12 figures, 4 tables.

Figures (12)

  • Figure 1: Comparing regular in-context learning to vector in-context learning. (a) In regular ICL, textual demonstrations are given as context during LLM inference. (b) In Vector-ICL, the input space is extended across multiple modalities. The input data is first encoded as embeddings, then transformed into continuous vectors which represent as box tokens ($\Box$) via embedding projection. During inference, we provide box tokens in prompts as demonstrations for ICL. We consider box tokens representing text, numerical data, brain fMRI, time series, and graphs in this study.
  • Figure 2: Pretraining and finetuning the projectors. Vector-ICL requires updating the parameters of a lightweight projector while keeping the encoder and decoder parameters fixed. The encoder first compresses the input into single token embeddings, and then the projector will project it to the aligned representation space for LLMs' later use. (a) Pretraining the projector on a general language modeling corpus (or a modality-to-text dataset) enables Vector-ICL. (b) Task-specific fine-tuning makes Vector-ICL outperform few-shot ICL on natural language tasks, as well as with domain-specific models on non-language tasks.
  • Figure 3: Main results: LLMs can perform Vector-ICL ($\uparrow$ = better). We show that training the embedding projector with a simple next-token prediction objective enables Vector-ICL. Even with only unsupervised pretraining, Vector-ICL matches or outperforms traditional few-shot ICL on 4 out of 6 tasks where direct comparison is possible. Fine-tuning the projector on downstream tasks further enhances the use of continuous context, consistently surpassing both few-shot ICL and specialized task-tuned baselines (soft-prompt for text, tuned encoders for non-text). The study begins with text reconstruction to assess LLMs' ability to interpret box token embeddings, followed by function regression to evaluate reasoning capabilities. We then demonstrate Vector-ICL's effectiveness and applicability across various downstream tasks, including text classification, summarization, time-series classification, graph classification, and brain fMRI decoding & classification. Results in each panel are averaged over different encoders and LLMs for the diverse tasks we study; error bars show 95% confidence intervals.
  • Figure 4: Key Insights from Encoders, Projections, and Synthetic Data Curation. (a) Correlation between encoders' text reconstruction performance and their downstream task effectiveness with Vector-ICL, suggesting information preservation ability predicts Vector-ICL performance. (b) Euclidean distance matrix of 1024 projected number embeddings (0 to 1e10) shows structured block-diagonal patterns, indicating meaningful numerical relationships are preserved. (c) Results from pretraining on our synthetic time-series QA dataset, which captures statistical properties through trend analysis, anomaly detection, and stability assessment. The curated QA pairs enable effective cross-modal pertaining.
  • Figure 5: Analyzing LLM's understanding of projected brain fMRI embeddings after only unsupervised pretraining. We categorize the underlying questions related to the text and measure the mean accuracy for each category, highlighting the LLM’s ability to interpret the embeddings, with only the next token prediction pretraining.
  • ...and 7 more figures