cs.LGSep 27, 2026

You Only Edit Once: Incentivizing In-Context Capability of LLMs via Local Demonstration Refinement

Authors: Jiarong Wen, Qi Wang, Yun Qu, Yixiu Mao, Heming Zou, Haoang Chi, Lizhou Cai, Yiqin Lv, +3 more

Organizations: Department of Automation, Tsinghua University

Abstract

In-context learning (ICL) is crucial for boosting the inference performance of large language models (LLMs). However, the effectiveness of ICL in LLMs is greatly influenced by the choice of demonstration sets. Exhaustive searches over these sets are combinatorial, and existing selectors often rely on relevance or likelihood proxies to implicitly assess ICL quality. Making repeated queries to the target LLM with these strategies can incur substantial costs. This work simplifies selection by framing it as a constrained local search problem and presents local demonstration editing (LDE). Starting with an initially retrieved set of demonstrations, LDE employs a single structured edit to explore its surrounding neighborhood while balancing performance gains with search costs. Technically, LDE is reduced to a policy search problem, for which we train a small LLM, referred to as Jev-LDE. This model as the System-1 modifies the retrieved demonstration set by performing actions such as \texttt{Keep}, \texttt{Delete}, or \texttt{Replace} elements, all within a framework of reinforcement learning with verifiable rewards. At test time, Jev-LDE executes a single edit of the retrieved demonstration set, followed by one inference from the target LLM, avoiding the need for iterative context scoring or subset searches. Across standard classification benchmarks, various target LLMs with Jev-LDE as the plug-and-play module consistently improve ICL performance, and Jev-LDE shows transferability to held-out benchmarks and models without retraining. These findings indicate that the LDE approach offers an efficient and adaptable method for harnessing the ICL capabilities of target LLMs.

Figures & tables

Appendix figures & tables11 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. InComeS: Integrating Compression and Selection Mechanisms into LLMs for Efficient Model Editing

    May 28, 2025Shuaiyi Li, Zhisong Zhang, Yang Deng +6Multimodal Knowledge EditingEdit

  2. When Context Misleads: In-context Learning with Jurisdiction in Large Language Models

    Sep 23, 2026Pei-lin Li, Qingle Liu, Junyang Feng +4In-Context LearningIn-Context

  3. Easier to Judge than to Find: Predicting In-Context Learning Success for Demonstration Selection

    May 18, 2026Haochun Wang, Chaofen Yang, Jiatong Liu +5In-Context LearningMultiple Prompt Learning Frameworks