Beyond Demonstrations: Dynamic Vector Construction from Latent Representations

Wang Cai, Hsiu-Yuan Huang, Zhixiang Wang, Yunfang Wu
5/23/2025
cs.CLcs.AI

No confident code implementation found for this paper.

Abstract

In-Context derived Vector (ICV) methods extract task-relevant representations from large language models (LLMs) and reinject them during inference, achieving comparable performance to few-shot In-Context Learning (ICL) without repeated demonstration processing. However, existing ICV methods remain sensitive to ICL-specific factors, often use coarse or semantically fragmented representations as the source of the vector, and rely on heuristic-based injection positions, limiting their applicability. To address these issues, we propose Dynamic Vector (DyVec), which incorporates an Exhaustive Query Rotation (EQR) strategy to extract robust semantically aggregated latent representations by mitigating variance introduced by ICL. It then applies Dynamic Latent Segmentation and Injection to adaptively partition representations based on task complexity and leverages REINFORCE-based optimization to learn optimal injection positions for each segment. Experiments results show that DyVec outperforms few-shot ICL, LoRA, and prior ICV baselines. Further analysis highlights the effectiveness of dynamically segmenting and injecting semantically aggregated latent representations. DyVec provides a lightweight and data-efficient solution for inference-time task adaptation.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{cai2025beyond,
  title  = {Beyond Demonstrations: Dynamic Vector Construction from Latent Representations},
  author = {Wang Cai and Hsiu-Yuan Huang and Zhixiang Wang and Yunfang Wu},
  year   = {2025},
  eprint = {2505.20318},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.20318v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.20318.svg)](https://codeofpaper.com/paper/2505.20318)

Discussion