LiFT: How to Enable In-Context Learning for Longitudinal Modelling
Organizations: Queen Mary University of London (UK) · The Alan Turing Institute (UK)
Abstract
Longitudinal NLP tasks such as mental health monitoring and stance evolution require modeling temporally ordered text to track persistence and detect change. Such tasks also suffer from data scarcity, often involving rare events and sparsely annotated data. Large Language Models (LLMs) can learn from small amounts of data through in-context learning (ICL), which is particularly important in low-data resource scenarios. However, when it comes to tracking evolving interactions or identifying rare events or changes, LLMs fall short in both zero- and few-shot ICL. To address this limitation, we introduce LiFT, a model-agnostic longitudinal Instruction Fine-Tuning framework that is able to induce ICL behaviour in LLMs for longitudinal tasks. LiFT unifies diverse tasks through a shared instruction schema that leverages sequential dependencies, curriculum learning, and temporal conditioning. We evaluate LiFT on five longitudinal datasets under zero-, one-, and three-shot settings, demonstrating that LiFT delivers superior performance to IFT models under identical ICL conditions. Furthermore, we demonstrate that LiFT yields larger gains for minority classes, meaningfully attends to recent demonstration history, and develops transferable longitudinal modeling capabilities beyond its training tasks
Figures & tables
| Dataset | AnnoMI | LRS | TalkLife | Reddit (OOD) | CMV (OOD) | ||||||||||
| Shots | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 |
| OLMo-1B (IFT) | .18 | .18 | .18 | .35 | .36 | .37 | .23 | .22 | .29 | .14 | .27 | .15 | .36 | .36 | .37 |
| OLMo-1B (LiFT) | .29 *** | .34 *** | .36 *** | .45 *** | .47 *** | .53 *** | .22 | .25 *** | .32 * | .30 *** | .32 *** | .32 *** | .40 *** | .38 ** | .39 *** |
| OLMo-7B (IFT) | .21 | .38 | .45 | .12 | .13 | .13 | .03 | .01 | .06 | .23 | .22 | .30 | .48 | .47 | .49 |
| OLMo-7B (LiFT) | .34 *** | .44 | .45 | .38 | .58 *** | .59 *** | .30 *** | .31 *** | .32 *** | .30 | .30 *** | .32 | .60 *** | .61 *** | .62 *** |
| LLaMA-8B (IFT) | .21 | .35 | .40 | .44 | .46 | .43 | .07 | .07 | .18 | .29 | .29 | .29 | .47 | .47 | .46 |
| AnnoMI | LRS | TalkLife | Reddit (OOD) | CMV (OOD) | |||||||||||
| Shots | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 |
| IFT | .21 | .38 | .45 | .12 | .13 | .13 | .03 | .01 | .06 | .23 | .22 | .30 | .48 | .47 | .49 |
| SFT | .29 | .31 | .33 | .33 | .35 | .38 | .07 | .05 | .06 | .27 | .24 | .28 | .50 | .47 | .51 |
| LiFT w/o Temporal | .28 | .32 | .33 | .31 | .35 | .38 | .06 | .05 | .06 | .27 | .24 | .29 | .48 | .48 | .50 |
| LiFT w/o Curriculum | .28 | .32 | .33 | .31 | .35 | .38 | .06 | .05 | .06 | .26 | .24 | .29 | .49 | .48 | .51 |
| Reverse 1–2–3 | .29 | .33 | .34 | .33 | .36 | .39 | .07 | .06 | .06 | .27 | .25 | .30 | .51 | .49 | .53 |
| Family | F1 | Wins/Sig. | McN. OR | DID |
| OLMo-1B | ||||
| OLMo-7B | ||||
| LLaMA-8B | ||||
| Qwen-14B | ||||
| Qwen-32B | ||||
| Overall |
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| Acronym | Definition |
| NLP | Natural Language Processing. |
| LLM | Large Language Model. |
| ICL | In-Context Learning, where a model performs a task using demonstrations provided in the input prompt without updating its parameters. |
| LiFT | Longitudinal Instruction Fine-Tuning, the proposed framework for improving longitudinal reasoning and in-context learning. |
| IFT | Vanilla instruction-tuned checkpoint. |
| SFT | Standard supervised fine-tuning baseline. |
| Symbol | Definition |
| Temporally ordered history associated with the current prediction instance. | |
| Sequence of historical observations and their corresponding timestamps, ordered such that . | |
| The -th observation in a longitudinal sequence. | |
| Timestamp or temporal position associated with observation . | |
| Number of observations included in the historical context. | |
| Current observation and its timestamp, for which a prediction is required. |
| Term or symbol | Definition |
| hist_mean | Mean hidden-state representation computed over tokens in the <HIST> span. It measures how much task-relevant information is encoded in the historical context. |
| fewshot_mean | Mean hidden-state representation computed over tokens belonging to the few-shot demonstrations. |
| curr_mean | Mean hidden-state representation computed over tokens in the current observation. |
| last_curr | Hidden-state representation of the final decision-facing token in the current-observation span. |
| Relative temporal bin assigned to an item within the history. Smaller values represent items closer to the current observation. | |
| Difference in probing performance between LiFT and the corresponding IFT model for a given layer and prompt region. |
| Symbol | Definition |
| Difference in macro-F1 between LiFT and the corresponding IFT model. | |
| Indicator that the IFT model predicts example correctly. | |
| Indicator that the LiFT model predicts example correctly. | |
| Indicator function. | |
| Number of examples incorrect under IFT but correct under LiFT. | |
| Number of examples correct under IFT but incorrect under LiFT. |
| Dataset | Domain and Sequence | Task Definition | Labels | Key Characteristics | Role |
| AnnoMI | Motivational-interviewing dialogue | Given the preceding therapist–client dialogue, classify the motivational language expressed in the current client utterance. | Change , Sustain , Neutral | 44 topics; 6,725 utterances; structured and relatively short contexts (mean: 142 tokens). | Train |
| LRS | Twitter rumour timelines | Given the chronological history of a rumour conversation, predict whether the stance changes at the current post. | Switch , Non-Switch | 274 timelines; 4,239 posts; medium-length, noisy social-media sequences (mean: 216 tokens). | Train |
| TalkLife | Mental-health user timelines | Given a user’s previous posts and current post, identify whether their emotional or mental state changes or escalates. | IS , IE , O | 500 timelines; 18,702 posts; long contexts with sparse and often implicit changes (mean: 1,049 tokens). | Train |
| Reddit MoC | Reddit mental-health timelines | Detect switches, escalations, or stability in a user’s mental state across chronologically ordered Reddit posts. | IS , IE , O | 255 timelines; 6,195 posts; longest and noisier user histories (mean: 2,583 tokens). | OOD only |
| CMV | Reddit opinion-change discussions | Given a reply and the author’s previous same-topic contributions, predict whether the reply changes the author’s view. | 1: Change , 0: No change | 9,456 author-topic timelines; 48,570 replies; binary and highly sparse change events (mean: 786 tokens). | OOD only |
| LRS | TalkLife | AnnoMI | CMV | ||
| Dataset Overview | |||||
| Split Type | timelines | timelines | topics | timelines | timeline |
| Total Timelines | 274 | 500 | 44 | 255 | 9,456 |
| Train Timelines | 219 | 400 | 35 | – | – |
| Test Timelines | 55 | 100 | 9 | Full Set | Full Set |
| Total Posts | 4,239 | 18,702 | 6,725 | 6,195 | 48,570 |
| Model | Context | 0 | 1 | 3 |
| OLMo-7B | IFT (Author-all) | .487 | .478 | .513 |
| LiFT (Author-all) | .543 | .545 | .564 | |
| IFT (Conv.) | .482 | .471 | .506 | |
| LiFT (Conv.) | .488 | .479 | .514 | |
| IFT (Author-topic) | .482 | .470 | .486 | |
| LiFT (Author-topic) | .601 | .606 | .618 |
| IFT | LiFT | Gain | |||||||
| Dataset | 0-shot | 1-shot | 3-shot | 0-shot | 1-shot | 3-shot | 0-shot | 1-shot | 3-shot |
| AnnoMI | .292 | .341 | .357 | .389 | .479 | .517 | +.096 | +.138 | +.161 |
| LRS | .332 | .342 | .327 | .428 | .486 | .504 | +.096 | +.144 | +.178 |
| TalkLife | .158 | .125 | .186 | .267 | .277 | .318 | +.110 | +.152 | +.132 |
| Reddit (OOD) | .197 | .252 | .251 | .289 | .339 | .361 | +.092 | +.087 | +.109 |
| CMV (OOD) | .494 | .509 | .516 | .540 | .569 | .590 | +.047 | +.060 | +.074 |
| shot | shots | |||||
| Model | Amp. | Amp. | ||||
| OLMo-1B | ||||||
| OLMo-7B | ||||||
| LLaMA-8B | ||||||
| Qwen-14B | ||||||
| Qwen-32B | ||||||
| AnnoMI | LRS | TalkLife | Reddit (OOD) | CMV (OOD) | |||||||||||
| Shots | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 |
| OLMo-1B (IFT) | .178 | .178 | .178 | .354 | .364 | .371 | .225 | .217 | .290 | .136 | .268 | .150 | .361 | .362 | .369 |
| SFT | .219 | .257 | .279 | .359 | .325 | .354 | .052 | .041 | .044 | .260 | .216 | .238 | .337 | .342 | .369 |
| LiFT w/o Temporal | .215 | .259 | .278 | .353 | .326 | .356 | .051 | .042 | .044 | .236 | .219 | .261 | .325 | .351 | .358 |
| LiFT w/o Curriculum | .214 | .257 | .279 | .352 | .327 | .355 | .048 | .042 | .045 | .235 | .218 | .262 | .332 | .347 | .360 |
| LiFT w/o History Loss | .217 | .255 | .291 | .339 | .345 | .351 | .047 | .041 | .050 | .227 | .260 | .234 | .371 | .344 | .339 |
| Component | Details |
| Models and compute | |
| Models | OLMo-1B, OLMo-7B, LLaMA-3.1-8B, Qwen2.5-14B, and Qwen2.5-32B |
| Model Checkpoints | Exact Hugging Face model identifiers and revisions are recorded in the released configuration files |
| Hardware | NVIDIA A100 (80GB), H100, and GH200 (120GB) GPUs |
| # GPUs | 2–3 depending on model size; Qwen2.5-32B uses 2 GPUs |
| Training Method | LoRA-based parameter-efficient fine-tuning; where backbone parameters remain frozen |
| AnnoMI | LRS | TalkLife | Reddit (OOD) | CMV (OOD) | |||||||||||
| Shots | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 1 | 3 |
| OLMo-1B (IFT) | .178 ( .000) | .178 ( .000) | .178 ( .000) | .354 ( .000) | .364 ( .000) | .371 ( .000) | ..225 ( .000) | .217 ( .000) | .290 ( .000) | .136 ( .024) | .268 ( .015) | .150 ( .025) | .361 ( .000) | .362 ( .000) | .369 ( .000) |
| OLMo-1B (LiFT) | .290 *** ( .000) | .335 *** ( .000) | .363 *** ( .000) | .449 *** ( .003) | .473 *** ( .000) | .528 *** ( .000) | .224 ( .016) | .254 *** ( .000) | .321 * ( .000) | .301 *** ( .000) | .317 *** ( .000) | .323 *** ( .000) | .400 *** ( .000) | .377 ** ( .000) | .389 *** ( .000) |
| OLMo-7B (IFT) | .207 ( .000) | .379 ( .000) | .446 ( .000) | .124 ( .174) | .128 ( .000) | .125 ( .000) | .029 ( .000) | .008 ( .000) | .064 ( .000) | .227 ( .023) | .219 ( .019) | .298 ( .014) | .482 ( .000) | .470 ( .000) | .486 ( .000) |
| OLMo-7B (LiFT) | .339 *** ( .000) | .443 ( .000) | .448 ( .000) | .380 ( .000) | .584 *** ( .000) | .587 *** ( .000) | .298 *** ( .000) | .305 *** ( .000) | .324 *** ( .000) | .298 ( .000) | .300 *** ( .000) | .319 ( .000) | .601 *** ( .000) | .606 *** ( .000) | .618 *** ( .000) |
| LLaMA-8B (IFT) | .207 ( .000) | .352 ( .000) | .400 ( .000) | .437 ( .000) | .460 ( .000) | .430 ( .000) | .067 ( .000) | .073 ( .000) | .180 ( .000) | .292 ( .000) | .291 ( .000) | .291 ( .000) | .466 ( .000) | .468 ( .000) | .462 ( .000) |
| Model family | Macro-F1 | Macro-F1 tests | Sign test | McNemar | Minority effect | Few-shot DID |
| OLMo-1B | wins; sig.; adj. | , | ; sig.; adj. | F1 ; sig.+; recall sig.+ | ; sig.+; adj. | |
| OLMo-7B | wins; sig.; adj. | , | ; sig.; adj. | F1 ; sig.+; recall sig.+ | ; sig.+; adj. | |
| LLaMA-8B | wins (one tie); sig.; adj. | wins and one tie, | ; sig.; adj. | F1 ; sig.+; recall sig.+ | ; sig.+; adj. | |
| Qwen-14B | wins; sig.; adj. | , | ; sig.; adj. | F1 ; sig.+; recall sig.+ | ; sig.+; adj. | |
| Overall | wins (one tie); sig.; adj. | wins, one tie, and one loss, | ; sig.; adj. | F1 ; sig.+; recall sig.+ | ; sig.+; adj. |
In-Context Learning
In-context learning studies how models adapt to new tasks from examples or instructions supplied at inference time, without changing their weights.
See all 404 papers