跳到正文
arXiv cs.CL· Jinghui Zhang, Lang Gao, Zongfang Liu, Ruihong Zeng, Zirui Song, Rui Yan, Kentaro Inui, Xiuying Chen·· 12 小时前AI 评分31

CopyGen:让冻结 LLM 精确复制长文本片段的复制约束解码方法

When Copying Is Hard: Copy-Constrained Decoding for Exact Span Reproduction

AI 导读

CopyGen 是一种面向冻结 LLM 的轻量级复制约束插件,将复制拆解为“何时复制、复制多远、何时停止”三个决策,在三个模型骨干和四项基准任务上无需微调即把平均 exact match 相对提升 35%,与 SFT 结合再提升 4%,并显著加速生成。

正文 · 原文

View PDF HTML (experimental)

Abstract:Precisely reproducing a target span verbatim within a long context is a fundamental capability test for LLMs: even when the target string is present in context, models often still drift within the span or fail to stop correctly, revealing limitations in source grounding and boundary control. This capability has broad practical relevance. For instance, code generation often requires embedding sensitive strings such as API keys exactly as they appear in context. In this work, we construct a benchmark to test exact span reproduction ability across contracts, scientific literature, code, and random sequences, and find that current models still make surprisingly frequent errors. To address this, we propose CopyGen, a lightweight copy-constrained plugin for frozen LLMs that turns copying from a byproduct of next-token prediction into a controlled process. Our key idea is to decompose copying into three distinct decisions: when to copy, how far to copy, and when to stop. Concretely, CopyGen first determines whether to enter copy mode, then predicts a tentative copy length, and finally verifies the generated span token by token. During verification, we adaptively adjust the logits of copy continuation tokens to incentivize or suppress continuation, and emit only the longest valid prefix. Across three LLM backbones and four benchmark tasks, CopyGen improves average exact match by 35% relative without model finetuning, and integrates seamlessly with SFT to further improve it by 4%, while substantially accelerating generation. These results suggest that reliable exact copying is not something LLMs obtain for free, but a decoding-time control problem that requires explicit modeling. Code is available at this https URL.
Comments: NeurIPS 2026
Subjects: Computation and Language (cs.CL)
Cite as: arXiv:2610.28393 [cs.CL]
  (or arXiv:2610.28393v1 [cs.CL] for this version)
  https://doi.org/10.48550/arXiv.2610.28393

arXiv-issued DOI via DataCite (pending registration)

Submission history

From: Jinghui Zhang [view email]
[v1] Tue, 20 Oct 2026 15:40:54 UTC (1,481 KB)

来源:arXiv cs.CL · arxiv.org