potentialpaper

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

NeurIPS 2026

Edit this page

Or clone it with git

Run in a terminal:

Needs Git LFS. To push, use an API key from your profile as the password.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

TL;DR. CopyGen is a lightweight decoding-time plugin that makes LLMs reproduce source spans more exactly and faster, improving average exact match by 35% relative without finetuning.

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://github.com/mbzuai-nlp/CopyGen.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

edit · history

DateVersionSubmitted toPDFEvidence
4 May 2026NeurIPS 2026submittedNeurIPS 2026Accept (poster)reviews ↓[1]PDF[1]
Missing a version?

NeurIPS 2026

Accept (poster) · 3 reviews · OpenReview

Updated 25 Nov 2026, 03:44 UTC.

Program Chairs · DecisionOpenReview ↗
Decision
Accept (poster)
Read decision
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.

Final justification

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.

Area Chair 7H8e · Meta-reviewOpenReview ↗
Read meta-review
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.

Final justification

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.

1 comment
Authors · CommentOpenReview ↗

Dear Area Chair,

Thank you for summarizing the key concerns. We have addressed all three with new experiments:

  • Missing baselines: We added LLMA, CopySpec, PICARD-style decoding, a non-learned longest-copy method, and an oracle-segmented pointer baseline. CopyGen achieves 70.29 average EM, outperforming these baselines in accuracy while running 3.19× faster than LLMA and 4.69× faster than CopySpec.
  • Incomplete ablations: New heuristic and component ablations show that learned verification provides the accuracy gain (+12.73 EM), while adaptive length prediction primarily provides efficiency, reaching up to 72.6× speedup over one-token proposals.
  • Newer models: We evaluated GPT-4.1-nano, Gemini-2.5-Flash-Lite, and DeepSeek-V4-Pro, confirming that exact copying remains challenging even for frontier models.

We have incorporated these results and clarified CopyGen’s contribution relative to prior copy mechanisms in the revision. We hope they resolve the concerns raised in the meta-review.

Reviewer 6oMqOpenReview ↗
Rating
5/6
Confidence
4/5
Quality
3/4
Clarity
3/4
Significance
3/4
Originality
2/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
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.

Final justification

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

Formatting concerns

None

5 comments
Authors · CommentOpenReview ↗

Response to Reviewer 6oMq (1/2)

Dear Reviewer 6oMq,

We sincerely thank you for the positive and constructive review. We especially appreciate your recognition that our research problem exposes a real gap in current LLMs, and the encouraging words on our work. We are happy to address each point below.


W1. On the contribution of an explicit copy mechanism

Thank you for this comment. We agree that introducing an explicit span-copy mechanism is a natural thought for this task.

The core contribution of this paper, however, lies in solving the problems that stand between this idea and a working method on a frozen LLM, problems that prior copy mechanisms do not address. Experiments show that simply enabling span copying does not resolve the unstable switching between copy and generation modes, the ambiguity of the stopping boundary, or the difficulty of improving exact-copy accuracy and decoding speed at the same time. Our learnable trigger module, length predictor, and margin-calibration bias head are designed to identify copy boundaries robustly, and our experiments confirm that naive rule-based copy strategies cannot improve exact match and throughput together. The substance of this work is therefore not the coarse idea of span copying, but the integrated pipeline, the analysis of logit-margin dynamics, and the systematic validation on demanding tasks.


W2 & Q1. Evaluation of closed models

We agree that testing closed models directly shows whether exact copying remains nontrivial even for frontier models, and whether the gap our benchmark exposes persists beyond open 4B/8B backbones.

To address your concern, we evaluated three frontier models spanning the GPT, Gemini, and DeepSeek families using API calls. All evaluation protocols remain the same as in our paper.

Model Contract Literature Code Random Sequence Avg
GPT-4.1-nano 33.33 80.00 65.50 81.20 65.01
Gemini-2.5-Flash-Lite 41.84 80.00 90.83 78.40 72.77
DeepSeek-V4-Pro 56.03 77.24 97.38 99.20 82.46

Results clearly show that no model is perfect across all four domains: even DeepSeek-V4-Pro reaches only 56.03 EM on Contract and 77.24 on Literature, and the observed failures include extra output boundaries, removed escaped newlines, and premature termination. Exact copying therefore remains nontrivial well beyond the open 4B/8B backbones studied in the paper.

Notably, small open models equipped with CopyGen already compare favorably. In the frozen setting, Qwen3-8B and Ministral-8B with CopyGen reach 76.97 and 76.87 four-domain average EM (Table 1), exceeding GPT-4.1-nano (65.01) and Ministral additionally matching Gemini-2.5-Flash-Lite (72.77); with SFT, all three backbones surpass every closed model tested, including DeepSeek-V4-Pro, at 91.40 (Qwen3-4B), 96.50 (Qwen3-8B), and 97.75 (Ministral-8B) versus 82.46. Even a 4B model with CopyGen therefore exceeds the strongest closed model we evaluated. We believe this further demonstrates the practical value of CopyGen.

Authors · CommentOpenReview ↗

Response to Reviewer 6oMq (2/2)

W3: Comparison with prior pointer mechanisms

We added an oracle-segmented span-pointer adaptation inspired by prior pointer-generator models [1]: the base LM is kept frozen, and we train three light components on top of it, a gate that decides at each step whether to generate a token or copy from the source, and a pair of start and end pointers that select which source span to copy when the gate chooses copying. Oracle segmentation supplies favorable training targets but is never used at test time.

Model Method Contract Literature Code Random Avg CopyGen gain
Qwen3-4B Base 5.67 68.28 54.20 53.60 45.44 +11.59
Pointer 0.71 10.34 82.97 1.60 23.91 +33.12
CopyGen 13.48 84.83 55.02 74.80 57.03 -
Qwen3-8B Base 16.31 77.20 80.40 67.20 60.28 +16.69
Pointer 7.09 28.97 79.04 5.60 30.18 +46.79
CopyGen 34.75 86.21 96.51 90.40 76.97 -
Ministral-8B Base 19.15 41.38 96.07 42.80 49.85 +27.02
Pointer 2.13 19.31 93.01 54.00 42.11 +34.76
CopyGen 22.70 88.28 96.51 100.00 76.87 -

Bold marks the best EM in each setting. Across Contract and Literature alone, the pointer reaches 11.43 avg EM against 55.04 for CopyGen, and 35.95 against 64.25 over the three real domains. Its average even falls below the frozen base model on every backbone. So a conventional pointer route, even trained with oracle segmentation, still cannot decide where a copy should start and stop under instruction conditioning.


Q2. Fixed copy length of 1

Thank you for this concrete question, and for connecting it to our w/o Length Proposal ablation. The paper's Appendix D already sweeps fixed lengths kk over {8,16,32,64,128,256}\{8, 16, 32, 64, 128, 256\} on Qwen3-8B: the most accurate fixed length (kk=8) reaches 71.07 EM at 99.02 token/s, the fastest (kk=256) reaches 66.52 at 286.06, and none matches the adaptive operating point of 72.49 at 295.06.

The kk=1 you mention further isolates the contribution of proposal head, so we added it on all three backbones and all four domains. The checkpoint, trigger, verifier, fallback, and decoding policy are held fixed within every pair; only the proposed copy length is capped at one. Δ\Delta is the EM of fixed kk=1 minus that of CopyGen, so a positive Δ\Delta favors kk=1.

Model CopyGen Avg Contract Δ\Delta Literature Δ\Delta Code Δ\Delta Random Δ\Delta Mean Δ\Delta Adaptive speedup over kk=1
Qwen3-4B 57.03 -2.84 +0.00 +0.00 -1.20 -1.01 2.14-34.80x
Qwen3-8B 76.97 +0.71 +0.00 +0.00 +0.40 +0.28 1.44-72.60x
Ministral-8B 76.87 -1.42 +0.00 -0.44 +0.00 -0.46 1.32-32.95x
Avg 70.29 -0.40 1.32-72.60x

The results show that kk=1 changes EM by only -0.40 points on average, while adaptive length is faster in every case; on Qwen3-8B it even runs below the base model (38.77 versus 55.23 token/s on the real domains). This is expected: accuracy is decided by verification, which both settings share, while a one-token proposal pays the full grounding, triggering, and calibration cost for a single token. This confirms that the length head contributes efficiency rather than accuracy, and multi-token proposal is what makes the copy path pay off.

References

[1] Copy that! Editing Sequences by Copying Spans, AAAI 2021.


Thank you again for the comments, which helped us strengthen the empirical comparison and provided additional insights into our method. We have incorporated these experiments into our paper. We hope our response resolves your concerns and would greatly appreciate your support during the discussion phase.

Authors · CommentOpenReview ↗

Dear Reviewer 6oMq,

Thank you once again for your valuable comments and for the time you have devoted to reviewing our submission. We appreciate that this is a busy period for reviewers. Given the tight discussion timeline, we would like to kindly ask whether our response and additional experiments have sufficiently addressed your concerns. If any questions remain, we would be grateful for the opportunity to clarify them further.

Sincerely,

The Authors

Reviewer z7dsOpenReview ↗
Rating
5/6
Confidence
3/5
Quality
3/4
Clarity
3/4
Significance
4/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
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.

Final justification

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

Formatting concerns

None observed

7 comments
Authors · CommentOpenReview ↗

Response to Reviewer z7ds (1/3)

Dear Reviewer z7ds,

Thank you for your positive and constructive review. We especially appreciate that our margin observation at copy failures resonated with your deep experience in logit analysis, and that you recognized CopyGen's effectiveness.

On the length predictor, we initially had the same doubt for exactly the reason you give. Experiments showed, however, that it adaptively proposes a tentative length per example while the verifier still decides the boundary, exactly the complementarity you point out. We are happy to address each concern below.


W1 & Q2. Gain of a simple heuristic rule instead of the learned bias head

The pure heuristic comparison you propose isolates what the learned head is buying us over a fixed rule. We implemented it as you describe: after five grounded tokens (CopyGen's own grounding threshold), scale the raw margin by a fixed constant of 2. Since the verification threshold is zero, positive scaling preserves the raw margin's sign, so we added a non-sign-equivalent second rule that adds a fixed constant of 1. Both rules are prespecified without tuning and replace only the bias head, with trigger and length proposal unchanged (Qwen3-8B, Temperature=0).

Calibration Contract Literature Code Avg Random Learned gain (Avg)
Heuristic: raw margin x2 16.31 77.24 80.79 58.11 67.60 +14.76
Heuristic: raw margin +1 17.02 77.93 83.41 59.45 71.20 +13.42
Learned bias head (CopyGen) 35.46 86.21 96.94 72.87 90.40 -

The paper's component results, together with an added fallback ablation, separate accuracy from speed even more clearly (averaged over three backbones and the three real domains):

Setting Avg EM EM gain vs. Base Avg tokens/s Speedup
Frozen Base 50.96 - 59.17 -
Learned trigger/length + raw verification/fallback 50.81 -0.15 272.89 4.61x
Learned verification + raw fallback 63.55 +12.59 309.09 5.22x
Full CopyGen 64.25 +13.29 308.86 5.22x

On speed your estimate is right: keeping our learned trigger and length heads but replacing verification with the raw rule already recovers 85.6% of full CopyGen's throughput gain over Base. On accuracy, however, the same configuration changes EM by -0.15 relative to Base, while learned verification with fallback held raw adds 12.73. This confirms the learned bias head is necessary, not replaceable by a fixed rule. A simple heuristic buys most of the fast path, and the learned head buys the exact-match gain.

Intuitively, Fig. 5 helps explain this. Its two panels show opposite failures at similar raw margins. In the top panel, the base model drifts mid-copy and ranks Ipv above the correct source token IPv, so the margin falls just below zero and needs a push up. In the bottom panel, a true boundary token sits just above zero and needs a push down. The two cases overlap in margin ranges, but fixed scaling or offset moves them identically. Distinguishing them requires hidden-state context, which our bias head learns.


W2. The random-sequence task

Thank you for noticing this, it is indeed an extreme task by design. As described in Sec. 4.1 (Experimental Setup), it stress-tests copy fidelity when semantic priors are unavailable, matching keys, hashes, and encoded configuration values.

On the mechanism, however, the evidence suggests it is more than a fast-path override. Appendix H.2 reports token acceptance of 74.9%, 89.9%, and 93.5% on this task across the three backbones, so the verifier still rejects roughly 6% to 25% of proposed tokens. The heuristics above likewise recover at most 17% of the learned calibration's gain here (71.20 and 67.60 versus 90.40, base 67.20), so its score does not come from an unconditional copy threshold.

More importantly, our conclusion does not depend on it. when excluding Random, over three backbones and the three real domains, CopyGen obtains 64.25 EM / 308.86 token/s versus 50.96 / 59.17 for Base (+13.29 EM, 5.22x). These domains come from real workflows, and we believe this supports CopyGen's practical value.

Authors · CommentOpenReview ↗

Response to Reviewer z7ds (2/3)

Q1. Behavior at temperature above zero and immediately after copy exit

We are very grateful for your recognition of our evaluation protocol. Although sampling falls outside our evaluation scope, we were curious ourselves whether the calibration head disturbs the distribution after a copied span.

We evaluated Qwen3-8B at Temperature=0.7 with top-p=0.9 and min-p=0.05 on the three real domains with paired seeds 42/43/44. Verification remains a deterministic margin decision; sampling applies to ordinary generation and rejected-proposal fallback (SD: standard deviation over seeds).

Domain Sampler Base (s42/s43/s44) CopyGen (s42/s43/s44) Mean gain±SD
Contract top-p 16.31/16.31/17.02 35.46/36.17/34.04 +18.68±1.48
Contract min-p 16.31/16.31/17.02 35.46/36.17/34.75 +18.91±1.08
Literature top-p 76.55/76.55/75.86 86.90/86.21/87.59 +10.57±1.05
Literature min-p 76.55/76.55/76.55 86.90/86.21/87.59 +10.34±0.69
Code top-p 80.79/80.35/81.22 96.94/96.07/96.07 +15.57±0.67
Code min-p 80.79/81.22/80.79 96.07/96.51/96.07 +15.28±0.00

CopyGen exceeds Base in all conditions; every run ends with EOS below the cap, and values stay close to the paper's temperature-0 results (Base within 1.34 points, CopyGen within 1.42). This verifies that CopyGen's gain is preserved under proper sampling and is not an artifact of greedy decoding.

We then measured exit-boundary distortion directly, the core of your question. We teacher-forced each example to the end of its gold answer so Base and CopyGen reach an identical state, then compared next-token distributions under both samplers, reporting top-1 changes and total variation (TV) distance (0 means identical).

Probe Comparable states Top-1 flips Mean TV p95 TV
Gold-answer boundary, three real domains 98.4% 0 (3 after masking EOS) 0.000285 0
First actual exit, Code domain 95.6% 0 0.001904 0

In the remaining states, CopyGen accepts an extra copied token, and even including these over-copy states there are only five top-1 flips per sampler. This verifies that the calibration head barely changes exit distributions, with distortion limited to few over-copy states.

Finally, to check whether distortion persists after the exit, we appended an instruction requesting a short, varied free continuation, teacher-forced the correct closing bridge so both start from the identical state, and sampled three seeds per task with both samplers. Diversity columns measure cross-seed variation; higher is more diverse.

Sampler Token-identical pairs Heads invoked Unique rate Pairwise-difference rate Token-Jaccard distance
top-p 100% 0 0.8750 0.8542 0.3177
min-p 100% 0 0.9583 0.9479 0.3845

Every diversity statistic is identical between Base and CopyGen, with paired differences exactly zero. This shows that after a correct exit the heads stay inactive and CopyGen samples exactly as the base model does.

Authors · CommentOpenReview ↗

Response to Reviewer z7ds (3/3)

Q3 and Limitations. Engine Integration and Systems-level overhead

We evaluated Qwen3-8B with CopyGen on both vLLM 0.25.1 and SGLang 0.5.15.post1. The vLLM path uses the engine for target-model execution with CopyGen's control logic outside it; in SGLang we registered CopyGen as a custom SpeculativeAlgorithm inside its native speculative scheduler, with no client-side re-prefill. All measurements use batch 8 on the same RTX PRO 6000 GPU:

Domain vLLM Base EM vLLM CopyGen EM SGLang Base EM SGLang CopyGen EM vLLM speedup SGLang speedup
Contract 16.31 34.75 16.31 35.46 3.39x 1.733x
Literature 77.24 85.52 77.24 85.52 4.87x 5.261x
Code 80.79 96.94 79.91 96.07 1.16x 1.214x
Random 68.40 90.80 69.20 91.20 13.55x 14.898x
Avg (3 real domains) 58.11 72.40 57.82 72.35 3.14x 2.74x
Avg (all 4 domains) 60.69 77.00 60.67 77.06 5.74x 5.78x

Speedups are end-to-end wall clock, covering all three components of CopyGen plus framework interaction. In both engines, CopyGen preserves the accuracy gains (every EM within 0.80 points of the paper) while delivering consistent speedups under batching, up to 5.78x on average.

In addition, to address the MLP overhead, we ran each example twice on an identical token trajectory, once normally and once with all three heads forced on every decoding step; the difference upper-bounds the heads' cost, since real runs fire them only when triggered, amounting to at most 1.746% of wall time in vLLM and 2.696% in SGLang. This coexists with the large speedups because the gain comes from taking fewer steps, not faster steps: one verified copy step emits a span greedy decoding would spend many steps on. This verifies the MLP heads are negligible and do not offset the speedup.

For the limitation regarding CUDA, you are right that our integration is not at the kernel level, so the branching cost you describe does exist in our implementation. However, it is fully included in every measurement above, which shows it does not offset CopyGen's gains in practice. We agree with your point and have added it to the Limitations, and look forward to exploring CUDA-fused, batched suffix matching in future work.


Thank you again for the comments, which helped us strengthen the empirical comparison and provided additional insights into our method. We have incorporated these experiments into our paper. We hope our response resolves your concerns and would greatly appreciate your support during the discussion phase.

Reviewer xxmkOpenReview ↗
Rating
4/6
Confidence
4/5
Quality
3/4
Clarity
3/4
Significance
3/4
Originality
3/4
Contribution type
general
Ethical concerns
NO or VERY MINOR ethics concerns only
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

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.

Formatting concerns

no

7 comments
Authors · CommentOpenReview ↗

Response to Reviewer xxmk (1/3)

Dear Reviewer xxmk,

Thank you for the constructive and careful review. We are especially grateful for recognizing that the problem we study is meaningful and practically relevant, and for the positive assessment of both the CopyGen method and its empirical results! We are happy to address each concern below.


W1, W4 & Q1. Baseline comparisons (efficiency and accuracy)

Thank you for this suggestion.

(1) On the efficiency baselines, we would like to explain that we initially did not include lossless methods because, as you correctly note, they preserve the base model's output distribution by construction, so their exact match equals the base model's and cannot address copy accuracy, which is this paper's primary objective; we therefore did not originally treat them as comparison targets.

We agree, however, that comparing against them further clarifies CopyGen's advantage in speedup. To address your concern, we evaluated both LLMA [1] or CopySpec [2] under identical models, environments, and GPUs, across three backbones and four domains. Each cell is EM / tokens-per-second.

Method Qwen3-4B Contract Qwen3-4B Literature Qwen3-4B Code Qwen3-4B Random Qwen3-8B Contract Qwen3-8B Literature Qwen3-8B Code Qwen3-8B Random Ministral-8B Contract Ministral-8B Literature Ministral-8B Code Ministral-8B Random Avg EM lead Speed lead
Base 5.67/66.5 68.28/60.1 54.20/54.8 53.60/62.3 16.31/53.0 77.20/56.3 80.40/56.4 67.20/56.2 19.15/60.0 41.38/62.1 96.07/63.4 42.80/60.9 51.86/59.3 +18.43 15.19x
LLMA 5.67/260.9 68.28/517.1 54.20/139.6 53.60/223.4 16.31/234.6 77.20/493.7 80.40/94.8 67.20/588.0 19.15/220.3 41.38/469.4 96.07/94.7 42.80/53.4 51.86/282.5 +18.43 3.19x
CopySpec 5.67/187.2 68.28/313.8 54.20/136.7 53.60/116.3 16.31/172.8 77.20/300.4 80.40/96.3 67.20/334.2 19.15/191.4 41.38/289.5 96.07/102.3 42.80/64.8 51.86/192.1 +18.43 4.69x
CopyGen 13.48/238.0 84.83/729.4 55.02/132.3 74.80/2939.2 34.75/219.5 86.21/592.9 96.51/72.8 90.40/2483.2 22.70/204.2 88.28/521.5 96.51/69.1 100.00/2609.6 70.29/901.0

On average, CopyGen improves EM by +18.43 points over all three methods while running 3.19x faster than LLMA and 4.69x faster than CopySpec, showing reference reuse is effective for speed but cannot repair the base model's copying errors, whereas CopyGen improves accuracy and throughput together.

(2) Regarding accuracy, we compared against the PICARD-style [3] decoder you describe: after a five-token source match, it masks generation to source-consistent continuations.

Method Qwen3-4B Contract Qwen3-4B Literature Qwen3-4B Code Qwen3-4B Random Qwen3-8B Contract Qwen3-8B Literature Qwen3-8B Code Qwen3-8B Random Ministral-8B Contract Ministral-8B Literature Ministral-8B Code Ministral-8B Random Avg EM lead Speed lead
PICARD 0.00/52.0 67.59/52.5 84.28/50.2 53.60/231.0 0.00/50.8 77.93/51.3 96.07/48.8 69.20/227.4 0.00/60.0 42.07/60.4 87.77/59.2 40.80/82.1 51.61/85.5 +18.68 10.54x
CopyGen 13.48/238.0 84.83/729.4 55.02/132.3 74.80/2939.2 34.75/219.5 86.21/592.9 96.51/72.8 90.40/2483.2 22.70/204.2 88.28/521.5 96.51/69.1 100.00/2609.6 70.29/901.0

It is worth noticing that the Contract EM is 0 on every backbone: the task requires copied clauses inside JSON strings with escaped \n, while pure source masking follows raw newline tokens and produces parser-invalid JSON. Format post-processing cannot fix this, because the failures are not only representational, since source-only constraint can neither generate tokens absent from the copied span nor determine the exact exit boundary, which is precisely what CopyGen's learned triggering and margin calibration provide.

Authors · CommentOpenReview ↗

Response to Reviewer xxmk (2/3)

W2. Necessity of the learned verification mechanism

We would first clarify the role of the components: in CopyGen, the trigger and length heads only decide whether to copy and how long a span to attempt, and they do not interfere with the final verification step. If Proposal Verification is removed, the remaining learned components contribute only to efficiency, and whether the current token is accepted is decided entirely by the base model itself. As the ablation shows, removing Margin Calibration returns EM to the base model's level. Therefore, we believe the w/o Margin Calibration ablation does isolate the contribution of learned verification to exact match: the accuracy gain comes from calibration, not from the copy route itself. The description of this ablation in the paper may not have been clear enough, and we have revised the text to make this explicit.

To address your concern further, we evaluated both fully non-learned alternatives you name. Masking generation to source-consistent tokens is the PICARD-style constraint above (51.61 avg EM, 18.68 points below CopyGen). Directly copying the longest matched source continuation (Longest) uses no learned parameter at all: after an exact five-token match, it selects the source occurrence with the longest backward match and directly copies its remaining continuation without target-model verification. We report the EM here:

Method Qwen3-4B Contract Qwen3-4B Literature Qwen3-4B Code Qwen3-4B Random Qwen3-8B Contract Qwen3-8B Literature Qwen3-8B Code Qwen3-8B Random Ministral-8B Contract Ministral-8B Literature Ministral-8B Code Ministral-8B Random Avg CopyGen lead
Longest 0.00 12.41 86.46 0.00 0.00 12.41 95.63 0.00 0.00 12.41 96.51 0.00 26.32 +43.97
CopyGen 13.48 84.83 55.02 74.80 34.75 86.21 96.51 90.40 22.70 88.28 96.51 100.00 70.29

An explicit copy constraint with no learned component therefore does not recover the gain and can even hurt, which we believe establishes the necessity of CopyGen's learned verification.


W3. Positioning relative to prior copy mechanisms

Thank you for reading the paper so closely. We agree that copying from source context has a long history: the related work section on copy mechanisms acknowledges this in its opening sentence (line 99) and discusses the essential contributions of the work you mention on learned copy actions and efficient source reuse.

We would also like to point out that existing copy mechanisms cannot directly solve our task, as they typically require architectural modifications or task-specific training and do not support instruction-conditioned, exact span reproduction in frozen LLMs. Our setting additionally requires deciding when to copy, how much to copy, and where the target span ends. We will revise certain statements to make this distinction and our contribution more precise in our paper.

Authors · CommentOpenReview ↗

Response to Reviewer xxmk (3/3)

Q2. Robustness to instruction and output-format changes

To examine how robust CopyGen is to prompt variation and evaluation harness, we kept the frozen Qwen3-8B model and each domain's trained CopyGen checkpoint unchanged and modified only the test-time prompt. Each domain is evaluated on every example under two paraphrases (same task, different wording and sentence structure; PA and PB) and one tagged-output format (Tag), which requires the answer to be wrapped between <COPYGEN_OUTPUT> tags instead of the bare output of the original template.

Method Contract PA Contract PB Contract Tag Literature PA Literature PB Literature Tag Code PA Code PB Code Tag Avg
Base 14.89 16.31 16.31 77.93 55.86 73.79 71.18 89.52 89.08 60.84
CopyGen 37.59 34.04 33.33 86.21 75.17 78.62 84.72 97.38 95.20 73.20
EM gain +22.70 +17.73 +17.02 +8.28 +19.31 +4.83 +13.54 +7.86 +6.11 +12.36

Across all conditions, CopyGen reaches 73.20 EM versus 60.84 for Base, and both satisfy the tagged format on all wrapped examples. The checkpoint was never retrained on these variants. Contract PA is the clearest case: against the original template (Base 16.31, CopyGen 34.75), Base drops to 14.89 while CopyGen rises to 37.59, widening the gain from 18.44 to 22.70; an overfit to a particular template and harness would not behave this way.

References

[1] Inference with Reference: Lossless Acceleration of Large Language Models, arXiv 2304.04487

[2] CopySpec: Accelerating LLMs with Speculative Copy-and-Paste, EMNLP 2025

[3] PICARD: Parsing Incrementally for Constrained Auto-Regressive Decoding from Language Models, EMNLP 2021


Thank you again for the comments, which helped us strengthen the empirical comparison and provided additional insights into our method. We have incorporated these experiments into our paper. We hope our response resolves your concerns, and would be very grateful if you could consider raising your score.

Comments on the paper

1 comment
Authors · CommentOpenReview ↗

Overall Response and Appreciation to the Reviewers and the Area Chair

We sincerely thank all reviewers and the Area Chair for their careful evaluation and constructive feedback. The reviews consistently recognized the following strengths:

  • Problem significance. Exact span reproduction is an important and practically relevant problem across domains such as legal processing, scientific evidence extraction, and code generation.

  • Method design. CopyGen provides a well-motivated and technically sound decomposition of exact copying into triggering, length proposal, and boundary-aware verification.

  • Empirical performance. CopyGen delivers promising improvements in both exact-match accuracy and decoding efficiency across multiple domains and model backbones, while remaining complementary to supervised fine-tuning.

  • Clear writing and presentation. The reviewers positively assessed the presentation of the paper’s motivation, method, benchmark construction, and experimental analysis.


During the discussion period, we addressed the three main concerns highlighted in the meta-review:

  1. Missing baselines. We added LLMA, CopySpec, PICARD-style constrained decoding, a fully non-learned longest-copy method, and an oracle-segmented pointer baseline. CopyGen achieves 70.29 average EM, outperforming the lossless source-reuse baselines by 18.43 points, while running 3.19× faster than LLMA and 4.69× faster than CopySpec. The rule-based and pointer baselines further show that explicit copying alone cannot reliably handle instruction-conditioned triggering and exact stopping boundaries. These comparisons more clearly establish CopyGen’s distinct contribution in jointly improving copy accuracy and decoding efficiency.

  2. Incomplete ablations. Following the reviewer's suggestions, we expanded and clarified our existing ablations with fixed-margin heuristics, fully non-learned constraints, fixed-length proposals, and component-level analyses. The results show that learned verification contributes +12.73 EM, whereas adaptive length prediction primarily improves efficiency, providing up to 72.6× speedup over one-token proposals. Simple heuristic rules recover much of the throughput benefit but not the exact-match improvement, further demonstrating the necessity of learned boundary-aware verification.

  3. Newer models. We evaluated GPT-4.1-nano, Gemini-2.5-Flash-Lite, and DeepSeek-V4-Pro under the same protocol. Even the strongest evaluated model reaches only 56.03 EM on Contract and 77.24 EM on Literature, confirming that reliable exact copying remains challenging for frontier models. Without fine-tuning, CopyGen-equipped 8B models outperform GPT-4.1-nano and Gemini-2.5-Flash-Lite; with SFT, even Qwen3-4B surpasses DeepSeek-V4-Pro.

Beyond these three concerns, we added prompt-paraphrase and output-format evaluations, non-greedy decoding experiments with top-p and min-p, direct analyses of copy-exit distributional distortion, and end-to-end vLLM and SGLang evaluations. CopyGen retains an average +12.36 EM gain under unseen prompt variants and achieves average end-to-end speedups of up to 5.78× in optimized inference engines, while the three lightweight heads contribute less than 2.7% of wall-clock time. These additional results strengthen the practical relevance of the paper and provide further insights into CopyGen’s robustness and systems-level behavior. We have incorporate all additional experiments and clarifications into our paper.


We are grateful that all three reviewers have confirmed that our responses and additional experiments addressed their concerns and recommend acceptance. Reviewers z7ds and 6oMq rated the paper as Accept (5), while Reviewer xxmk rated it as Borderline Accept (4). Their constructive feedback helped us more clearly establish CopyGen’s contribution and strengthen the paper’s empirical rigor, robustness, and systems-level validation.

Once again, we thank all reviewers and the Area Chair for their time, careful consideration, and valuable feedback.

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

Missing a submission?

Loading the discussion…