acceptodds
Published as a conference paper at NeurIPS 2026

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

Jinghui Zhang, Lang Gao, Zongfang Liu, Ruihong Zeng, Zirui Song, Rui Yan, Kentaro Inui, Xiuying Chen

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 https://anonymous.4open.science/r/CopyGen-A65D.

Keywords:
Sydney, Main Track

Reviews

Among:
Shape:
123456this paper, Top 24%
Figure 1. Mean review rating of the reviewed papers at NeurIPS 2026. This paper averages 4.67 over 3 reviews, above 76% of the others.
Reviewer_6oMqOpenReview ↗
Rating
5
Clarity
3
Confidence
4
Originality
2
Quality
3
Significance
3
Read review
Summary

This paper introduces a benchmark to test the LLM capability of copying exact spans of text from input to output. Motivated by the observation that current open LLMs make frequent mistakes, the paper introduces CopyGen, a mechanism to provide a (frozen) LLM the ability to deliberately copy spans of text. Empirical results show that CopyGen indeed improves copying abilities.

Strengths and weaknesses

The paper addresses a problem with relevant applications across many domains. Experiments clearly identify a gap in existing open 4B/8B LLMs (both pre-trained and SFT). The proposed method is shown to be effective at improving copying abilities.

The paper does a good job at explaining clearly the motivation, the benchmark construction, the method, and the experiments.

I will mention three minor weaknesses. First, the idea of introducing an explicit mechanism for span copy is probably not hard to come up with. Second, the paper’s significance would increase if it included experiments on current closed LLMs (see question below). Third, the current experiments do not provide any comparison with prior methods (e.g., with pointer mechanisms).

Questions
  1. It would be insightful to also evaluate top closed models (e.g. GPT, Claude, Gemini) on your benchmark, in order to compare open and closed models on the copying task.
  2. Could you clarify how your method compares to simpler baselines, e.g. using a fixed copy length of 1 (similar to the case k=1k=1 of the w/o Length Proposal ablation)?
Limitations

Limitations are not mentioned in the main text. There is a discussion in the appendix.

Paper formatting concerns

None

Final justification

The rebuttal addresses my weaknesses 2 and 3. So, overall, I think this paper has sufficient merits to deserve publication.

Reviewer_z7dsOpenReview ↗
Rating
5
Clarity
3
Confidence
3
Originality
3
Quality
3
Significance
4
Read review
Summary

The authors propose CopyGen. CopyGen is a decoding-time plugin for frozen large language models designed to enforce exact string copying from the input context. The authors identify that standard autoregressive generation struggles with exact copying due to mid-span token drift and boundary overruns. To fix this, they introduce a three-stage pipeline. First, a trigger head detects if the model is grounded in a source span. Second, a length head predicts a tentative copy length. Finally, a verification stage adjusts the token logits of the proposed span to either suppress or encourage continuation based on a learned margin calibration. They evaluate on four datasets including code and legal contracts and show large improvements in exact match accuracy and decoding throughput.

Strengths and weaknesses

I spend most of my time staring at logit landscapes and figuring out why LLMs sample garbage at the tails. A fixed penalty or standard greedy decoding fails because the boundary transitions between copying and generating are extremely fragile.

The observation that copy errors happen precisely where the logit margin between the top token and the runner-up narrows is spot on. Modifying the logits dynamically via a calibrated bias head is a way to force the model to commit to a boundary. Getting a 15x speedup while also improving exact match is good.

The ablations prove the necessity of the length predictor. I initially assumed the length predictor was redundant given the token-by-token verification step. The data clearly shows you need both to get the throughput gains without blowing past boundaries.

The complexity of the pipeline is quite high. You are training three separate heads and injecting a very specific grounding calculation into the inner decoding loop. I would bet money you could achieve 80% of this benefit with a simpler dynamic truncation threshold on the raw margins without training a bias head.

The random string task is pathological. Asking an LLM to auto-regressively generate base64 strings is basically begging for entropy collapse. CopyGen fixes it by brute force memorization routing. I question if this task actually proves the model is better at reasoning about boundaries versus just taking a fast-path override.

The reliance on temperature=0 deterministic decoding limits the scope. I understand why the authors did it for an exact match benchmark, so I do not penalize them here and I would fight with any reviewer who tried to penalize them for it. I still want to see how this calibration head interacts with proper sampling methods when you actually need diverse completions right after the copied span ends.

Questions

How does CopyGen behave when temperature is strictly greater than zero? If I am generating a long block of code with a sampling technique like min_p or top-p, does the bias head distort the distribution too much right at the exit boundary?

Have you compared this against a pure heuristic baseline where you just scale the raw margin by a fixed constant when the grounding length exceeds a certain threshold? I want to know exactly how much the neural bias head is buying you over a simple rule.

The fallback generation step still requires running the bias head. What is the actual wall-clock overhead of these extra MLPs in a highly optimized inference engine like vLLM/sglang/TRT-LLM?

Limitations

The authors adequately address the limitations regarding cross-domain generalization. They should additionally discuss the systems-level overhead of integrating these three distinct plugin heads into production inference engines. Modifying the inner decoding loop to calculate suffix grounding on the fly is computationally cheap in naive python scripts but can cause nasty branching delays in fused CUDA kernels.

Paper formatting concerns

None observed

Final justification

They did significant further experiments which improved the quality of the paper, so I raised my score to a 5.

Reviewer_xxmkOpenReview ↗
Rating
4
Clarity
3
Confidence
4
Originality
3
Quality
3
Significance
3
Read review
Summary

This paper studies whether LLMs can reliably copy an exact span from a long input context without changing any tokens or extending beyond the intended boundary. The authors propose CopyGen, a lightweight decoding-time plugin for frozen LLMs that determines when to enter copy mode, predicts a tentative span length, and verifies the proposed span token by token before emission. Across legal, scientific, code, and random-sequence tasks, CopyGen substantially improves exact-match accuracy and decoding speed, and it remains effective when combined with supervised fine-tuning.

Strengths and weaknesses

Strengths

  1. The paper studies a meaningful and practically relevant problem. Exact span reproduction is important in applications such as legal document processing, scientific evidence extraction, and code generation, where even a small token-level error can invalidate the output.

  2. The proposed method is intuitive and technically reasonable. CopyGen decomposes exact copying into three components—copy triggering, span-length proposal, and token-level verification—which directly target the main failure modes of standard autoregressive decoding, including internal token mismatches and incorrect stopping boundaries.

  3. The empirical results are promising. CopyGen consistently improves exact-match accuracy across multiple model backbones and benchmark domains while also substantially increasing decoding throughput. The method also remains effective when combined with supervised fine-tuning, suggesting that decoding-time copy control and model adaptation are complementary.

Weaknesses

  1. The baseline comparison is substantially incomplete. The paper compares CopyGen only against standard decoding and supervised fine-tuning, despite making claims about both exact-copy accuracy and decoding efficiency. Several closely related methods should be included as direct baselines. For the efficiency claim, methods such as LLMA and CopySpec reuse spans from a reference or context to accelerate generation. Although these methods are lossless and preserve the original model distribution—and therefore may not improve exact-match accuracy—they are direct competitors to CopyGen's speedup claim, so at least one of them should be evaluated under the same models and datasets. For the accuracy claim, the paper lacks a simple source-constrained decoding baseline; for example, a PICARD-style decoder could restrict the next-token distribution to valid continuations of the currently matched source span once copy mode is triggered, testing whether CopyGen's learned triggering and margin calibration provide meaningful gains over a simpler rule-based copy constraint.

  2. The paper does not sufficiently establish that the proposed learned verification mechanism is necessary. The ablations evaluate components within CopyGen, and the w/o Margin Calibration variant already approximates a fixed-threshold rule without the learned bias head—but all variants remain inside CopyGen's learned framework, since the trigger and length heads are still trained. The paper does not compare against fully non-learned alternatives, such as directly copying the longest matched source continuation or masking generation to source-consistent tokens. Without these comparisons, it is difficult to determine how much of the gain comes from the proposed margin-calibration mechanism rather than from adding any explicit copy constraint.

  3. The novelty claim should be positioned more carefully. Copying from source context has a long history in pointer networks, CopyNet, pointer-generator models, copy-based generation, and reference-based speculative decoding. The most distinctive aspect of this work appears to be the specific setting of instruction-conditioned, exact span reproduction for frozen LLMs, together with learned boundary-aware verification. The paper should emphasize this narrower contribution rather than suggesting that exact copying has received little prior attention in general.

  4. The lack of direct comparisons limits the interpretation of the reported speedups. The approximately 15× throughput improvement appears strong, but it is difficult to assess its significance without comparison to existing copy-based acceleration methods such as LLMA or CopySpec. The current experiments show that CopyGen is faster than ordinary token-by-token decoding, but not that it is competitive with the most relevant specialized decoding approaches.

Questions

See weaknesses above.

  1. How does CopyGen compare with prior accuracy-oriented constrained-decoding methods and speed-oriented copy or speculative-decoding baselines?

  2. How robust is CopyGen to prompt paraphrasing, alternative instruction wording, and changes in the required output format at test time? Since the trigger, length, and bias heads are trained using fixed templates that are also used during evaluation, could the authors demonstrate that the reported gains are not overly coupled to the training and evaluation harness?

Limitations

yes

Paper formatting concerns

no

Final justification

The additional experiments address my main concerns well. In particular, the comparisons with LLMA, CopySpec, PICARD-style constrained decoding, and the non-learned baselines make the empirical evaluation much more convincing. The prompt robustness experiments also increase my confidence that the reported gains are not tied to a particular evaluation template. Accordingly, I have raised my score.

Comments on the paper

1 comment
Meta-review

This paper studies the challenges of copying exact text by LLMs, and proposes a solution to enforce exact copying by first detecting the copying mode, inferring the copy length, and finally adjusting the output logit to ensure exact copying. The reviewers agree that this paper studies an important research problem and the results are promising. However, there are key concerns among the reviewers that the paper misses some important baselines, and thus does not adequately claim contribution. Other concerns include the incomplete ablation study and the lack of newer LLMs in the evaluation. It would make the paper stronger if these concerns were addressed.

After the rebuttal, all reviewers agree that the concerns are adequately addressed. Therefore, the final recommendation is accept. The authors are encouraged to incorporate the new results into the paper.

From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.

Related papers

Loading the map…

Discussion (0)

Sign in to comment.