SelectCopy: Controlled Copying in Deep Models
- SelectCopy is a family of mechanisms that selectively copy existing content or generate new output under structural, probabilistic, or semantic constraints.
- It is applied in areas such as sequence-to-sequence learning, image captioning, secure object cloning, and document extraction, ensuring precise structural alignment.
- Empirical studies show that selective copying can improve accuracy and reduce computational overhead by preserving source alignment and controlled reuse.
Searching arXiv for the core paper and adjacent copying-mechanism work to ground the article in current arXiv metadata. {"query":"(Gu et al., 2016) CopyNet copying mechanism sequence-to-sequence learning", "max_results": 5} “SelectCopy” (Editor’s term) denotes a family of computational mechanisms that arbitrate between copying an existing structure and producing an output by generation, transformation, inference, or recomputation. In neural sequence modeling, the copied unit is typically a token or span from an input sequence; in vision it may be an object label, an image region, a text-placement box, or a block of intermediate features; in data fusion it is a shared value that signals source dependence; in software security it is the reachable object graph allowed to remain shared after cloning; and in quantum algorithms it is a table entry coherently loaded into a register. The common technical problem is not copying alone, but controlled copying under structural, probabilistic, or semantic constraints (Gu et al., 2016, Portenier et al., 2019, Verelst et al., 2021, Jensen et al., 2012, Motlagh et al., 19 May 2026).
1. Scope and recurring decision structure
Across the literature, selective copying is defined by three recurrent questions: what may be copied, when copying should dominate over generation or fresh computation, and how copied content interacts with a broader model state. In CopyNet, the alternatives are generation from a fixed vocabulary and copying from source positions under a single shared softmax normalizer; in span-copy editing, the alternatives are single-token generation and whole-span copy actions; in image captioning for novel objects, the alternatives are standard language-model emission and copying object names supplied by external visual classifiers (Gu et al., 2016, Panthaplackel et al., 2020, Yao et al., 2017).
Outside text generation, the same structure reappears with different objects. Copyspace detection treats text placement on images as selecting rectangular regions that satisfy compositional and legibility constraints rather than generating text itself. Context-aware copy-paste selects source content and target placements by caption-based semantic matching, object detection, mask extraction, and compositing constraints. BlockCopy selects spatial blocks to recompute and copies cached features elsewhere. Enterprise document extraction treats repetitive, template-based documents as a “copy-heavy” regime in which structure-aware routing minimizes generative decoding. Deep-Web truth finding treats a shared rare false value as evidence that one source copied another (Lundin et al., 2020, Guo, 2024, Verelst et al., 2021, Wang et al., 11 Oct 2025, Li et al., 2015).
A plausible implication is that selective copying is best understood as an arbitration layer between reuse and reconstruction. The arbitration variable may be explicit, as in pointer-generator gates or reinforcement-trained execution policies, or implicit, as in CopyNet’s shared-normalizer competition and QROM’s circuit-level replacement of “SelectSwap” by “SelectCopy” (Choi et al., 2021, Gu et al., 2016, Motlagh et al., 19 May 2026).
2. CopyNet and token-level copying in sequence-to-sequence learning
The canonical neural formulation is CopyNet, which augments the standard attention-based encoder–decoder architecture with an explicit copying pathway. Given input sequence and output sequence , a bidirectional RNN encoder produces hidden states , and an RNN decoder with state attends to the encoder to compute . At step , the decoder scores two competing emission modes: generation over a fixed vocabulary and copying over source positions . The key design is a single shared partition function across both modes, so the selector is implicit rather than an explicit sigmoid gate (Gu et al., 2016).
For candidate token , the emission probability is
0
Because probability mass for duplicate source symbols is summed over positions, collisions are handled automatically: if a token is both in the fixed vocabulary and in the source, both terms contribute. The emergent mode probabilities 1 and 2 are the normalized masses of the two groups and satisfy 3 (Gu et al., 2016).
A distinctive feature is the selective read 4, which feeds the decoder not only the embedding of the previously emitted token but also a position-weighted summary of source locations where that token occurred. The decoder update uses
5
This mechanism does not explicitly score spans, but it biases the state toward copying contiguous subsequences: after copying from location 6, the next step is biased toward 7. The model therefore combines semantically driven attention 8 with location-aware selective read 9, permitting both multi-token contiguous copying and jumps to new source regions (Gu et al., 2016).
CopyNet is trained end-to-end by maximum likelihood over the mixture distribution,
0
with no supervision for which mode to use. Because copy-mode operates over source symbols, the model can emit OOV or rare words whenever they appear in the input, while generate-mode falls back to 1 for true OOVs. In the reported experiments, CopyNet achieved 93.7–98.3% exact-match accuracy on synthetic transformation rules requiring copying 2 or 3, improved Chinese short-text summarization on LCSTS from approximately 4 to approximately 5 in ROUGE-1/2/L for word-based modeling, and raised dialogue accuracy on DS-II from 6 to 7 for Top-1/Top-10. The paper also notes two limitations: the mechanism copies surface forms and is therefore not directly applicable to cross-lingual tasks without modification, and it does not include ablations isolating the selective read from the shared-normalizer mixing (Gu et al., 2016).
3. Supervised gates, span actions, and novel-object captioning
Later work refined token-level copying in two directions: by supervising the copy/generate decision and by enlarging the copied unit from a token to a span. In the enhanced supervised-copy method, a Transformer encoder plus LSTM decoder pointer-generator model retains the standard mixture
8
but adds explicit supervision to both attention and the gate. The timestep loss is
9
where 0 for copy-candidates and 1 is defined either by Force-copy or by Force-copy-unk. Force-copy drives 2 low whenever the gold token appears in the source; Force-copy-unk does so only when the token is both in the source and OOV with respect to the target vocabulary. On CNN/DailyMail, Force-copy-unk reached ROUGE-1/2/L of 3 versus 4 for the re-implemented PGNet baseline, increased copy precision from 5 to 6, and raised novel 7-gram rates from 8 to 9. On RotoWire, FCU achieved RG precision 0 with 1 unique extracted relations. The paper also reports that Force-copy tends to over-copy, whereas Force-copy-unk uses vocabulary size as a control knob over copy versus abstractness (Choi et al., 2021).
A more radical extension is to make the action space itself span-aware. “Copy that! Editing Sequences by Copying Spans” introduces generate actions 2 and copy-span actions 3 that emit the contiguous subsequence 4 in one step. Because many action sequences can produce the same output, training marginalizes over all valid derivations with a backward dynamic program:
5
Span scores are computed from boundary encoder representations via
6
This formulation reduces the number of decisions on edit-heavy tasks where most of the input is unchanged. Reported gains include WikiAtomicEdits accuracy 7 versus 8 for a token-copy baseline, GitHubEdits 9 versus 0, C# Fixers one-shot 1 versus 2, and code-repair accuracy 3 versus 4 on BFP-small (Panthaplackel et al., 2020).
Image captioning for novel objects instantiates a related but multimodal variant. LSTM-C combines a standard LSTM LLM with a copying distribution over an external object lexicon 5, using detector or classifier confidences 6 in the copy logits
7
The final probability over 8 mixes generation and copying with a fixed scalar 9, set to 0 in most experiments. Unlike pointer-generator networks, there is no dynamic 1; copy selection arises from the relative logits and the fixed trade-off. On held-out MSCOCO, LSTM-C with One-hot+GloVe achieved METEOR 2 and average F1 3, compared with METEOR 4 and F1 5 for NOC. On ImageNet with external text from BNC+Wikipedia, it reached Novel 6, F1 7, and Accuracy 8, outperforming NOC’s 9, 0, and 1 (Yao et al., 2017).
4. Image layout, copy-paste, and compositing
In vision, selective copying often concerns where content should be placed and how copied content should be harmonized. Copyspace detection formulates the placement of text over an image as an object-detection problem over expert-labeled rectangular regions. The dataset contains 20,000 license-free Unsplash images labeled by a team of experts and stratified into four difficulty classes. The paper evaluates YOLOv4, YOLOv5 variants, and Faster R-CNN using mAP@0.5, [email protected]:0.95, and average IoU. YOLOv5x at 2 reached [email protected] 3, [email protected]:0.95 4, and IoU 5; YOLOv5s reached 6; Faster R-CNN reached 7. Performance degrades sharply with complexity: for YOLOv5x, [email protected] falls from 8 in Class 1 to 9 in Class 4. The paper explicitly cautions that “good predictions are sometimes disjoint from annotations,” so IoU and mAP undercount aesthetically valid placements (Lundin et al., 2020).
Context-aware image augmentation addresses a different problem: selecting semantically compatible source content and pasting it into a target image without manual annotation. The CACP pipeline uses BLIP to caption a source image, BERT cosine similarity to rank category names, YOLO-365 to localize candidate objects in gallery images, Grad-CAM to derive point prompts, and SAM to extract masks. The paper reports that Grad-CAM-assisted prompts improve mask quality from bbox 0 to 1 with one CAM point and to 2 with three CAM points. On downstream tasks, CACP outperforms random copy-paste and standard augmentation: on Cats vs Dogs, accuracy rises to 3 with CACP and 4 with CACP+aug; on CamVid, mIoU rises to 5 and 6; on CityPersons detection, [email protected] rises to 7 and 8. The reported GPU cost per image pair is approximately 9 ms for BLIP, 0 ms for YOLO, and 1 ms for SAM, for a total of approximately 2 ms (Guo, 2024).
“Smart, Deep Copy-Paste” treats harmonization itself as the central copying problem. It receives a source image 3, a target image 4, and mask 5, forms the naive composite
6
and predicts a residual 7 so that the final result is
8
Training is self-supervised: from a single image 9, the method constructs transformed source content using a geometric homography 00 and a locally varying photometric transform 01, then reconstructs the original image with an 02 loss plus conditional WGAN-GP. The reported hyperparameters are 03 and 04 in the total objective, with ADAM 05, 06, learning rate 07, batch size 08, and 09k iterations. The method is demonstrated on 10k face images at 11 and on Cityscapes, and the paper attributes its behavior to learning to correct shading and moderate geometric inconsistency rather than to explicit flow or homography prediction (Portenier et al., 2019).
5. Spatially selective computation and copy-heavy document extraction
Selective copying can also reduce computation by copying intermediate representations rather than output symbols. BlockCopy partitions feature maps into spatial blocks and trains a lightweight policy network to decide, for each block and frame, whether to execute or copy. For selected blocks, block-sparse convolutions with halo padding recompute features; for non-selected blocks, the previous frame’s features are reused directly. The policy observes the current frame 12, previous frame state 13, previous output 14, and previous execution grid 15, and is trained online with REINFORCE using a reward
16
with 17 and momentum 18 in the smoothed cost term. On CityPersons with CSP and target 19, GMACS drop from 20 to 21, runtime from 22 s/frame to 23 s/frame, and miss rate on the Reasonable split changes from 24 to 25. For Mask R-CNN on Cityscapes, BlockCopy with 26 roughly halves FLOPs, increases FPS from 27 to 28, and drops validation AP by about 29 (Verelst et al., 2021).
Enterprise-scale document extraction reframes “copy-heavy” as a structure-aware routing problem over repetitive documents. The hybrid OCR–LLM framework evaluates direct, replacement, and table-based extraction over PNG, DOCX, XLSX, and PDF using PaddleOCR, EasyOCR, Docling, MinerU, MarkItDown, Qwen2.5-7B, and Qwen2.5-VL-7B. Table-based extraction minimizes generation by having the LLM emit only structure metadata such as header-to-column mappings and row ranges, after which a deterministic parser extracts contents. On structured documents, table-based methods reach F1 30 with 31 s average latency; on PNG images with PaddleOCR table-based extraction, F1 is 32 at approximately 33 s; the multimodal PNG baseline reaches F1 34 but requires approximately 35 s; Docling-based PDF table extraction reaches F1 36 at approximately 37 s; EasyOCR table extraction on PNG and MinerU replacement on PDF both yield F1 38. The framework’s central claim is that repetitive structure permits “copy-first” extraction with minimal LLM decoding (Wang et al., 11 Oct 2025).
A shared principle emerges across BlockCopy and enterprise extraction: copying is operationally useful when the system can preserve alignment. BlockCopy preserves alignment through cached block coordinates and halo padding; table-based document extraction preserves alignment through row and column structure. A plausible implication is that selective copying remains stable when geometry or schema is explicit, and degrades when those coordinates are lost, as in OCR outputs that fail to preserve spatial structure (Verelst et al., 2021, Wang et al., 11 Oct 2025).
6. Source dependence, secure cloning, retrieval arbitration, and QROM
In structured data fusion, copying becomes a latent dependency relation among sources. “Scaling up Copy Detection” assumes single truth per item, 39 false values per item, item independence, copy selectivity 40, and prior copying probability 41 with 42. For two sources 43 and observations 44, the posterior probability of independence is
45
Shared rare false values contribute strongly positive evidence for copying, while differing values contribute the constant negative term 46. The scalability contribution is an inverted index over shared values 47, processed in decreasing order of their contribution upper bound 48, with pruning, early termination, incremental updates, and optional sampling. The reported speedup is two to three orders of magnitude over naive pairwise copy detection, while truth-finding quality remains essentially unchanged and copy-detection precision/recall stays high, with examples including precision at least 49 and recall at least 50 (Li et al., 2015).
In secure object-oriented programming, copying is constrained by policy rather than by probability. “Secure the Clones” introduces type-based annotations such as @Shallow, @Deep, and @Copy(X) to specify the maximally allowed sharing between an object and its clone. The semantics require that any location reachable from the result by following only deep-annotated fields be disjoint from any value reachable from pre-existing caller variables. The analysis uses graph-shaped types 51 with strong and weak nodes, proves monotonicity of stronger policies, and establishes soundness in Coq: if a program is well typed, all declared copy methods satisfy their copy policies. The paper also notes a limitation: subclasses may add new fields not constrained by the superclass policy, motivating possible “deep-all-except” extensions (Jensen et al., 2012).
Retrieval-augmented generation exposes another arbitration problem: whether a LLM should copy from the prompt context or recall from parametric memory. “To Copy or Not to Copy” constructs an arbitration vector 52 as the residual-stream centroid difference between irrelevant contexts that elicit recall and relevant-but-false contexts that elicit copying. Intervening with
53
steers behavior in two directions. Copy54Recall uses 55 at early-to-middle layers and succeeds only when injected at counterfactual object tokens; Recall56Copy uses 57 at middle-to-late layers and succeeds from object, subject, or last-token locations. On PopQA, Copy58Recall recovers to 59 EM for Gemma2-2B and 60 for T5Gemma-2B, while Recall61Copy raises copying EM to 62 and 63; similar asymmetries appear on PEQ. The mechanistic conclusion is that inducing copying is an easier “reactivation” process than restoring recall, which behaves as a fragile suppression process (Farahani et al., 17 Jan 2026).
At the hardware level, selective copying becomes a circuit optimization. “Halving the cost of QROM” replaces the dirty-ancilla SelectSwap architecture with SelectCopy. For a table of 64 entries, entry width 65, and bucket parameter 66, the dirty-ancilla SelectSwap cost is
67
whereas SelectCopy reduces this to
68
A further bit-packet construction yields
69
interpolating the leading prefactor on 70 from 71 down to 72. For 73 and regimes where 74, the paper reports an effective reduction of approximately 75 in the dominant term, matching clean-qubit QROM performance with dirty qubits for practical values of 76 (Motlagh et al., 19 May 2026).
7. Evaluation, trade-offs, and unresolved questions
A persistent issue across selective-copy systems is that standard metrics often observe only one aspect of correctness. Copyspace detection uses mAP and IoU even though many valid placements may be disjoint from the annotation. CopyNet shows strong empirical results but does not isolate the contributions of selective read and shared-normalizer mixing. Force-copy improves factual extraction but can reduce abstractness, whereas Force-copy-unk improves ROUGE and novel 77-grams but depends on vocabulary size. RAG arbitration succeeds at moderate scaling but large 78 values spike perplexity and degrade fluency (Lundin et al., 2020, Gu et al., 2016, Choi et al., 2021, Farahani et al., 17 Jan 2026).
Another recurrent limitation is that copying usually preserves surface form rather than semantic equivalence. CopyNet copies source tokens verbatim and is therefore not directly suited to cross-lingual translation without modification. LSTM-C copies detector labels as single tokens and does not explicitly handle singular/plural variation or multi-word object names. Context-aware copy-paste can fail under domain shift, thin structures, or missed detections. Enterprise document extraction depends critically on structure preservation by OCR or parsers, with catastrophic failures when that assumption breaks. Secure object cloning currently constrains only the fields named in a policy, not arbitrary future fields introduced by subclasses (Gu et al., 2016, Yao et al., 2017, Guo, 2024, Wang et al., 11 Oct 2025, Jensen et al., 2012).
These results suggest that selective copying is most effective when the copied unit has an explicit address: a source position, a span boundary pair, a detected object label, a table cell, a block coordinate, a policy-annotated field, or a bucketed QROM address. When alignment is explicit, copying reduces uncertainty, compute, or latency; when alignment is weak, the system must reintroduce semantics through attention, gating, constraints, or expert annotation. That pattern links CopyNet’s selective read, span-copy marginalization, BlockCopy’s execution masks, enterprise table extraction, Deep-Web copy evidence, and QROM SelectCopy into a single computational theme: copying is a structured decision, not merely a retrieval primitive (Panthaplackel et al., 2020, Verelst et al., 2021, Li et al., 2015, Motlagh et al., 19 May 2026).