Enhancing Large Language Models for Time-Series Forecasting via Vector-Injected In-Context Learning

Jianqi Zhang, Jingyao Wang, Wenwen Qiang, Fanjiang Xu, Changwen ZhengarXiv 2026 · OpenReview

Abstract

Time series forecasting (TSF) is essential for responding to dynamic user behaviors on the web. While Large Language Models (LLMs) have shown promise in TSF, they suffer from a "modality gap" between text-based pretraining and numerical time-series data. Fine-tuning can bridge this gap but incurs massive computational costs. We propose LVICL (Vector-Injected In-Context Learning), a method that enhances frozen LLMs for TSF by injecting compressed context vectors into the model's layers. By adaptively extracting example-related information and injecting it into every layer during the forward pass, LVICL achieves performance comparable to fine-tuning without increasing prompt length or computational overhead. Extensive experiments demonstrate that LVICL provides a stable, efficient, and high-performance solution for LLM-based forecasting.

Introduction: The Modality Gap in LLM4TSF

Large Language Models (LLMs) possess significant potential for time-series forecasting, yet they face a fundamental challenge: they were trained on natural language, not numerical sequences. Current approaches to bridge this gap typically fall into two categories:

  1. Full Fine-tuning: Updating the LLM's weights on time-series data. While accurate, this is computationally prohibitive, often requiring over 100GB of GPU memory for a 7B parameter model.
  2. Traditional In-Context Learning (ICL): Feeding input-output examples directly into the prompt. This keeps the model frozen but makes it highly sensitive to example selection and order, while long prompts significantly increase inference latency.

LVICL introduces a "third way" that achieves fine-tuning-level performance while keeping the LLM parameters frozen and the prompt length short.

Methodology: Vector-Injected In-Context Learning

LVICL moves beyond simple text prompting by "injecting" task-specific information directly into the model's internal representations. The pipeline consists of three stages:

  • Context Vector Acquisition: Examples are converted into a natural language format and passed through the frozen LLM to extract hidden representation vectors.
  • Permutation-Invariant Aggregation: To mitigate the order-sensitivity of traditional ICL, LVICL averages vectors from multiple examples. This creates a stable "context vector" representing the general task pattern.
  • Vector Injection & Adaptation: This context vector is refined by a lightweight, learnable Context Vector Adapter (a simple MLP) and then added to the residual stream of every layer in the LLM during the forward pass.
The LVICL architecture: (a) Context vector extraction from examples and (b) Injection into LLM layers for forecasting.

By injecting the vector into the residual stream, the system "nudges" the model's internal state toward a forecasting-optimized configuration without altering its underlying weights.

Experimental Results

LVICL was evaluated across a comprehensive suite of benchmarks, including ETT, Electricity (ECL), Traffic, and Weather datasets, as well as zero-shot scenarios (M3/M4 datasets).

Performance and Stability

LVICL reproduces most of the predictive gains of full-parameter fine-tuning. Crucially, it demonstrates superior stability compared to traditional ICL. While traditional ICL performance can fluctuate based on example order, LVICL’s mean aggregation provides a reliable signal that is robust to permutations.

MSE performance comparison across ETTh1, Weather, and ECL datasets for various training and ICL settings.

Efficiency at Scale

In head-to-head tests on Llama-2-7B, LVICL consistently outperformed LoRA (Low-Rank Adaptation) while maintaining a smaller GPU memory footprint. Because the context vector is pre-computed and injected, the prompt length remains constant regardless of the number of examples used to prime the model, ensuring high inference efficiency.

Conclusion

LVICL offers a powerful alternative to fine-tuning for time-series forecasting. By leveraging vector injection, it captures the benefits of in-context learning while avoiding its pitfalls regarding stability and prompt length. Future work will explore more complex adapter architectures and dynamic context selection to further enhance the capabilities of frozen LLMs in specialized numerical domains.

Summary updated

BibTeX
@misc{zhang2026enhancing,
  author = {Jianqi Zhang and Jingyao Wang and Wenwen Qiang and Fanjiang Xu and Changwen Zheng},
  title = {{Enhancing Large Language Models for Time-Series Forecasting via Vector-Injected In-Context Learning}},
  year = {2026},
  eprint = {2601.07903},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.07903},
}
Figure