Learning Task Representations from In-Context Learning

Large language models (LLMs) have demonstrated remarkable proficiency in in-context learning (ICL), where models adapt to new tasks through example-based prompts without requiring parameter updates.However, understanding how tasks are internally encoded and generalized remains a challenge.To address some of the empirical and technical gaps in the literature, we introduce an automated formulation for encoding task information in ICL prompts as a function of attention heads within the transformer architecture.This approach computes a single task vector as a weighted sum of attention heads, with the weights optimized causally via gradient descent.Our findings show that existing methods fail to generalize effectively to modalities beyond text.In response, we also design a benchmark to evaluate whether a task vector can preserve task fidelity in functional regression tasks.The proposed method successfully extracts task-specific information from in-context demonstrations and excels in both text and regression tasks, demonstrating its generalizability across modalities.

Authors

Institutions

Publication Details

Published
2025-01-01
DOI
https://doi.org/10.18653/v1/2025.findings-acl.345
Primary Topic
Intelligent Tutoring Systems and Adaptive Learning
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Learning Task Representations from In-Context Learning

Baturay Sağlam, Dionysios S. Kalogerias, Amin Karbasi, Xinyang Hu et al.
Intelligent Tutoring Systems and Adaptive Learning
article

Learning Task Representations from In-Context Learning

Baturay Sağlam, Dionysios S. Kalogerias, Amin Karbasi, Xinyang Hu, Zhuoran Yang
article en

Abstract

Large language models (LLMs) have demonstrated remarkable proficiency in in-context learning (ICL), where models adapt to new tasks through example-based prompts without requiring parameter updates.However, understanding how tasks are internally encoded and generalized remains a challenge.To address some of the empirical and technical gaps in the literature, we introduce an automated formulation for encoding task information in ICL prompts as a function of attention heads within the transformer architecture.This approach computes a single task vector as a weighted sum of attention heads, with the weights optimized causally via gradient descent.Our findings show that existing methods fail to generalize effectively to modalities beyond text.In response, we also design a benchmark to evaluate whether a task vector can preserve task fidelity in functional regression tasks.The proposed method successfully extracts task-specific information from in-context demonstrations and excels in both text and regression tasks, demonstrating its generalizability across modalities.

Yale University (US)
Reduced inequalities
Openalex Percentile: Top 90%
Intelligent Tutoring Systems and Adaptive Learning
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Learning Task Representations from In-Context Learning — Baturay Sağlam, Dionysios S. Kalogerias, et al. · (2025) | TGRS Research Map | TGRS