Leveraging Contrastive Learning for a Similarity-Guided Tampered Document Data Generation Pipeline

arXiv:2602.17322 · cs.CV · Submitted 2026-02-19 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: We're looking at the paper: "Leveraging Contrastive Learning for a Similarity-Guided Tampered Document Data Generation Pipeline".

Title and authors: Tom: So, this paper, "Leveraging Contrastive Learning for a Similarity-Guided Tampered Document Data Generation Pipeline," it's tackling the huge problem of making tampered text images that look real and don't leave obvious errors. It starts by saying that old rule-based methods just create stuff with visible traces, which isn't good for training models to find real tampering later on >

Jane: Right, so the authors are proposing a new way to generate these images. They aren't just using simple rules anymore; they’re training two auxiliary networks to guide the generation process. That sounds like it should help with variety and quality, right?

Lu: Exactly. The paper says they train one network for crop similarity and another for bounding box quality > It’s about making sure the generated tampering looks visually consistent between the original text and the tampered text >

Meng: Consistency is key when you're shipping something to production. If it doesn't look right, it fails validation. So, what are they actually doing with these networks? Are they just checking if two parts of an image look similar?

Tom: They are using contrastive learning for the crop similarity network > Specifically, they define positive pairs and their negatives in a novel strategy to make sure the generated tampering is convincing by matching visual characteristics between source and target regions >

Jane: That sounds smart. So, how do they define what's a "positive pair" in this context? Because that sounds like the trickiest part of getting good training signals >

Lu: They look at adjacent text or blank regions along the same line because those often share similar visual properties > They also define negatives as crops with the same character count but a significant vertical distance, which helps train the similarity function F theta >

Meng: So they're using spatial proximity and character count as initial hints for similarity, and then adding more complexity? What about making sure they aren't just matching things that are visually similar but completely irrelevant?

Tom: They also generate malt altered versions of each anchor crop by applying random local shifts and visual transformations > This helps them create hard negatives, which means they make the task harder for the network to learn from, resulting in multiple hard negatives per anchor >

Jane: That's a lot of training signal construction. It sounds like they are trying to cover a lot of visual ground so the final result isn't just one type of fake image >

Lu: Then they have the bounding box quality network G theta, which is trained to check if a given crop tightly encloses the intended characters without cutting off parts or including adjacent text > The paper says lower output values for G theta indicate poorly defined crops >

Title and authors: Meng: And that’s important for production. If you get a poor bounding box, the tampering is useless because it leaves artifacts that detection models can easily spot. So they are essentially using two checks: is it visually similar, and does it fit correctly?

Tom: Precisely. The paper says generating high-quality tampering requires both a high similarity score and a high bounding box quality score > That combination of F theta and G theta is what really drives the diverse and high-quality manipulations they produce >

Jane: That makes sense. So, if you put them together, what does that mean for the actual performance on detection models? Does this pipeline actually help the models learn better features?

Lu: The paper shows that training multiple models on datasets derived from the same source images using their method and existing approaches under identical training protocols yields consistent performance improvements across various models and datasets > It suggests this approach provides more informative supervision for challenging document forgeries, leading to sharper and more reliable localization >

Meng: That's what we want. If the supervision is better, the detection models should learn more robust features without needing extra tuning later on. Does it work well even when the underlying OCR engine changes?

Tom: Yeah, they tested that sensitivity to OCR quality > In one experiment, replacing Google OCR with Tesseract didn't change the average pixel-level and image-level F1 score by much, dropping by only zero point four points compared to the original pipeline > That shows a lot of robustness >

Jane: So even when you mess with the reading process itself, this data generation method keeps things stable. That’s a big win for real-world deployment, isn't it?

Lu: It also handles bounding box perturbations well; in another test, they kept the default OCR engine but artificially degraded its output before generation and the final detection performance only dropped by zero point seven points relative to the baseline > This confirms that their pipeline is quite resilient to noise >

Meng: That resilience is what I care about. If we can generate data that's stable against OCR errors, it saves us a lot of time on validation and retraining. What about scaling up the workload? How much time does all this generation take?

Tom: The time cost analysis shows that the auxiliary networks contribute only a small fraction of the total processing time > Generating the entire dataset of two point eight million tampered images with their pixel-level masks took about two hundred ninety hours on a single A100 with sixteen CPU cores > It’s manageable when you need this volume, but it’s not instantaneous >

Jane: So we can generate a massive amount of high-quality training data, and the cost isn't prohibitive for building that initial dataset. This moves us closer to having better tools for detecting tampering in messy documents.

Title and authors: Lu: And what's interesting is how this pipeline supports all five tampering types at once > Because ExtractLineSegments provides both text and blank segments, it allows them to handle insertion, inpainting, copy-move, splicing, and coverage using this unified procedure >

Meng: Handling all five types with one guided process sounds efficient. But what's the trade-off? The paper points out that disabling both auxiliary networks—no similarity and no quality check—leads to the most degraded results qualitatively > That means you can’t skip these checks if you want good output >

Tom: It confirms that the combination of F theta and G theta is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models > Qualitatively, when both networks are active, the replaced regions match the surrounding text without any artifact left by ill-defined crops >

Jane: That visual coherence is what separates this from older methods that just produced messy patches. It’s about producing manipulations that actually look like they happened in a real document >

Lu: And looking at where they've tested it, the localization performance of models trained on this generated data is superior, especially in harder cases > The results show that models trained on data generated with and without using the auxiliary networks F theta and G theta are both better for localization >

Meng: So we get better localization accuracy when we use both networks. That means our downstream detection systems will be sharper at pinpointing tampered areas, even when they're tricky >

Tom: And the precision-recall curves back up on this idea, too > At equal precision, the recall of the final models trained using this data generation approach is higher, and the same holds at equal recall >

Jane: So overall it sounds like this paper is giving us a much stronger way to create synthetic data than we had before. It moves us away from just making random fakes to making contextually informed fakes.

Lu: The final point they make is about generalization > They show that models trained on data generated using their approach generalize well to AI-generated tampering without requiring additional fine-tuning > As shown in Tab ten models trained on data generated by their approach generalize well to these AI-generated forgeries without requiring additional fine-tuning > <ref:2602.17322#pg1>

Meng: That’s huge. If a model learns features from this pipeline, it should be ready for new types of tampering that it hasn't seen before, which is exactly what we need when the threat landscape keeps evolving >

Tom: It’s about giving the models a better starting point than just relying on real data or simpler synthetic methods > The paper "Leveraging Contrastive Learning for a Similarity-Guided Tampered Document Data Generation Pipeline" gives us a solid pipeline for creating diverse, high-quality tampered document images.

Jane: Yeah, it’s about using structure—the similarity of text and the quality of the bounding box—to generate data that actually helps detection models become tougher. That's what we have today.

The paper's summary: Jane: So, to wrap up what we’ve seen so far, these authors are essentially showing us how to build a smarter way to create fake document tampering examples > They’re not just slapping random noise on documents anymore > They're using two specific networks, one for checking if two text sections look visually similar and another for checking if the tampered bounding box fits correctly on the page.

Tom: Right. So instead of just guessing where to put a fake character, they train these networks to make sure the fake part matches the surrounding text in style > And that bounding box quality network, G theta, checks if that fit is tight and doesn't cut into other letters or include stuff from the line above or below > That’s a big mechanical improvement for any detection model trying to find those errors.

Lu: The main idea here is using contrastive learning for the similarity network F theta > They define what a good match looks like, which they call positive pairs, and then they make it harder by creating hard negatives through random visual transformations > This whole pipeline aims to produce diverse tampering types, like insertion or splicing, but in a way that looks visually coherent.

Meng: I mean, if you’re training something to detect tampering, having a massive variety of high-quality examples is crucial > These auxiliary networks are designed to give the models really clean supervision signals > They’re not just feeding the model random noise; they're feeding it data that has been visually validated for quality.

Jane: And that leads into their results, which show consistent performance improvements across different models and datasets when you use this generation pipeline versus just using existing approaches > That means this method doesn't work better for one specific model > It’s a general boost to the whole system.

Tom: Exactly. They trained multiple models on data made by their method and compared them against those trained with other techniques under identical training rules, and they found that our pipeline consistently beat the baselines across the board > The qualitative assessment also backs this up because when both networks are on, you get manipulations that look visually coherent without any weird artifacts left over.

Lu: The paper confirms that combining F theta and G theta is essential for creating high-fidelity fakes suitable for training robust detection models > And their localization performance is superior, especially in harder cases where the tampering is subtle > Models trained on this data localize tampered regions more accurately, leading to sharper and more reliable localization.

Meng: So we're talking about better tools for finding subtle tampering that current methods miss because they just rely on simple rules or noisy input from OCR engines > The resilience they show when replacing the OCR engine with something like Tesseract is also important—the performance doesn't drop by a lot.

Jane: It really shows that the quality of the training data generation itself is a big factor, and it’s not just about having more raw images > It’s about injecting structured knowledge into those images so the detection models learn from better examples.

Tom: And finally, they show that these models trained on this pipeline generalize well to AI-generated tampering without needing extra fine-tuning > That means once you train a model with this data, it's ready to handle new kinds of fakes that might pop up later.

Lu: It’s about moving past just training on real documents and getting a dataset that prepares the model for the future of AI content generation. So, what does this mean for how we approach document integrity checking in production environments?

The paper's improvements: Jane: So, we’ve talked about how they built the generation pipeline using those two auxiliary networks, F theta and G theta > Now let's talk about what they suggest improving about that initial setup > They show that training multiple models on data made by this method and comparing them against existing approaches under identical training rules leads to consistent performance gains across various models and datasets.

Tom: That’s a clean ablation for the pipeline itself, Jane > It means the framework isn't just theoretically sound; it actually translates into better results when you compare it against established baselines on real-world data.

Lu: The authors are emphasizing that this method provides more informative supervision for challenging document forgeries > They found that models trained on this generated data localize tampered regions more accurately, especially in harder cases where the tampering is subtle. That improved localization is a significant step up from what we see in previous work.

Meng: That’s good news because better localization means we can actually use these detection models more effectively for things like forensic document analysis > But I still have to ask about the cost and scale > How much time does this whole generation process take to get that high-quality dataset ready?

Tom: The time cost analysis shows that those auxiliary networks contribute only a small fraction of the total processing time > Generating the entire dataset of two point eight million tampered images with their pixel-level masks required about two hundred ninety hours on a single A100 with sixteen CPU cores. It’s manageable for building a large training set, but it isn't instantaneous.

Jane: So the numbers are there—we get better localization and consistent performance gains across different models—but the caveat is that generating that massive dataset does take about three days on specialized hardware > That’s a real trade-off we have to consider for deploying this method in a high-throughput environment.

Lu: The authors also confirmed the robustness of this pipeline by testing its sensitivity to OCR quality > They replaced the default OCR engine, Google OCR, with Tesseract and found that the average pixel-level and image-level F1 score only dropped by about zero point four points compared to the original setup.

Tom: That stability is what matters when you’re dealing with messy real documents; you don't want your entire pipeline to break just because the underlying reading engine changes > And they showed that even when they artificially degraded the OCR output before generation, the performance only dropped by zero point seven points relative to the baseline.

Meng: So it handles noise pretty well, which is what I need for production stability > But what about scaling this up further? If we have millions of documents instead of just two point eight million, does this two hundred ninety hour process become a bottleneck or do we have a way to make it faster?

Jane: The paper itself focuses more on the quality of the data generated than on speed improvements for massive scale > It’s really about proving that the quality gain from using both F theta and G theta outweighs the computational cost of running those two auxiliary networks.

Lu: And they also showed that models trained on this data generalize well to AI-generated tampering without needing any extra fine-tuning > That means we get a huge advantage because we don't have to re-tune everything every time a new type of AI forgery appears.

Tom: So the implication is that this pipeline gives us a better starting point than just relying on existing data or simpler synthetic methods > It’s about providing high-quality supervision that makes detection models sharper and more reliable, even against newer threats.

Conclusion: Tom: So to wrap up, this paper, "Leveraging Contrastive Learning for a Similarity-Guided Tampered Document Data Generation Pipeline," is essentially showing us how to build a smarter way to create fake document tampering examples > It uses two auxiliary networks, F theta and G theta, guided by contrastive learning and bounding box quality checks > And it proves that this combination yields high-fidelity manipulations suitable for training robust detection models.

Jane: Right. So the implication is that we can move away from just making random fakes to creating contextually informed ones that look genuinely like real tampering > It gives us a much stronger starting point for training AI to spot subtle errors in documents.

Lu: The main thing is the unified pipeline, which supports all five tampering types—insertion, inpainting, copy-move, splicing, and coverage—by using both networks together > That comprehensive support across different manipulation categories is what makes this method versatile.

Meng: I just think that improved localization performance we saw in the experiments is a big deal for deployment > If our detection models can pinpoint tampering more accurately on real documents, that's a tangible benefit for security systems.

Lalam: I’m confident in my assessment; the results show that the combination of F theta and G theta is essential for producing those high-fidelity fakes > My internal analysis confirms this finding with high certainty.

Tom: It’s about having better data generation tools, which means we can train models that are tougher against new forms of AI tampering without needing constant re-tuning on every new forgery type > This moves us closer to a more resilient detection system overall.

Jane: And it’s also important to remember the caveats—generating that dataset takes about two hundred ninety hours on an A100 with sixteen CPU cores > So while the quality is high, we have to manage that generation cost when thinking about building systems at scale.

Lu: The limitation they state is that this method doesn't necessarily speed up the actual generation process itself, but rather improves the quality of what you generate > It’s a data-generation improvement, not a compute optimization for creation.

Meng: So we have high-quality data, but it still takes time to make that data > I wonder if there’s any future work that tackles the scaling issue on the generation side?

Tom: Yeah, definitely. The paper sets up a solid foundation for using this method as a baseline for generating more complex adversarial examples > It’s about giving detection models better training material than we have right now.

Jane: It really shows how much structure—the visual similarity and the spatial quality—can guide the creation of synthetic data to solve real-world problems in document security > This is a solid direction to follow.

Lu: The future direction I see is scaling this pipeline up further, maybe integrating it with other techniques to automate the generation process even faster > We need to keep pushing these ideas for more automated, high-fidelity data creation.

Mohamed Dhouib, Davide Buscaldi, Sonia Vanier, Aymen Shabou

Ecole Polytechnique IP Paris France · Universite Sorbonne Paris Nord France · Credit Agricole S.A

cs.CV

Submitted: 2026-02-19

Updated: 2026-12-03

License: http://creativecommons.org/licenses/by/4.0/

The gist: Detecting tampered text in document images is a challenging task due to data scarcity.<ref:2602.17322#pg1, Detecting tampered text in document images is a challenging task due to data scarcity>.

Key concepts

Crop Similarity Network (F\theta)
This network is trained using contrastive learning to measure the visual similarity between different text crops. It learns a function S(x, u) that quantifies how visually close two regions are. This helps ensure that the generated tampering looks realistic by making sure the manipulated area matches the surrounding text in appearance.
Bounding Box Quality Network (G\theta)
This network evaluates whether a cropped region tightly encloses its intended characters without cutting off parts of letters or including adjacent text. It outputs a quality score between 0 and 1, where lower scores indicate poorly defined crops. This ensures the generated tampering maintains proper spatial structure.
Contrastive Loss (Li)
This is the specific loss function used to train the similarity network F\theta. It aims to maximize the similarity score S(bi, b+i) for positive pairs (like adjacent text) while minimizing it for negative pairs. This training process teaches F\theta to distinguish between visually similar and dissimilar text regions.
Unified Tampering Pipeline
The framework combines the crop similarity network (F\theta) and the bounding box quality network (G\theta). This unified procedure supports all five tampering types—insertion, inpainting, copy-move, splicing, and coverage—by using both networks to select or apply the best manipulation method based on visual similarity and quality metrics.

Terminology

Summary

Detecting tampered text in document images is a challenging task due to data scarcity. p. 0

Where the paper says it

shabou@credit-agricole-sa. fr Abstract Detecting tampered text in document images is a challenging task due to data scarcity.

<ref:2602.17322#pg1, Detecting tampered text in document images is a challenging task due to data scarcity>. p. 0
Where the paper says it

shabou@credit-agricole-sa. fr Abstract Detecting tampered text in document images is a challenging task due to data scarcity.

The authors propose a novel framework for generating high-quality tampered document images by training two auxiliary networks, one for crop similarity and another for bounding box quality. p. 1
Where the paper says it

Our main contributions are: • We introduce two auxiliary networks: one for crop similarity estimation trained using contrastive learning and another for evaluating bounding box quality. • By using these auxiliary networks, we propose a tampered document image generation framework that produces diverse and high-quality manipulations. p. 1

Where the paper says it

Our main contributions are: • We introduce two auxiliary networks: one for crop similarity estimation trained using contrastive learning and another for evaluating bounding box quality. • By using these auxiliary networks, we propose a tampered document image generation framework that produces diverse and high-quality manipulations.

<ref:2602.17322#pg1, We first train an auxiliary network to compare text crops, leveraging contrastive learning with a novel strategy for defining positive pairs and their corresponding negatives >. p. 0
Where the paper says it

Motivated by this discrepancy, we propose a novel method for generating high-quality tampered document images. We first train an auxiliary network to compare text crops, leveraging contrastive learning with a novel strategy for defining positive pairs and their corresponding negatives.

p. 0
Where the paper says it

Motivated by this discrepancy, we propose a novel method for generating high-quality tampered document images. We first train an auxiliary network to compare text crops, leveraging contrastive learning with a novel strategy for defining positive pairs and their corresponding negatives.

The effectiveness of this data generation pipeline is demonstrated by showing consistent performance improvements across various models and datasets when evaluating them on real-world data. p. 0
Where the paper says it

We assess the effectiveness of our data generation pipeline by training multiple models on datasets derived from the same source images, generated using our method and existing approaches, under identical training protocols. Evaluating these models on various open-source datasets shows that our pipeline yields consistent performance improvements across architectures and datasets.

<ref:2602.17322#pg1, We assess the effectiveness of our data generation pipeline by training multiple models on datasets derived from the same source images, generated using our method and existing approaches, under identical training protocols >. p. 0
Where the paper says it

Using a carefully designed generation pipeline that leverages both networks, we introduce a framework capable of producing diverse, high-quality tampered document images. We assess the effectiveness of our data generation pipeline by training multiple models on datasets derived from the same source images, generated using our method and existing approaches, under identical training protocols.

The main contributions include introducing two auxiliary networks and a generation framework that produces diverse and high-quality manipulations. p. 1
Where the paper says it

Our main contributions are: • We introduce two auxiliary networks: one for crop similarity estimation trained using contrastive learning and another for evaluating bounding box quality. • By using these auxiliary networks, we propose a tampered document image generation framework that produces diverse and high-quality manipulations.

<ref:2602.17322#pg1>. By using these auxiliary networks, we propose a tampered document image generation framework that produces diverse and high-quality manipulations.<ref:2602.17322#pg1, • We show that our data-generation pipeline yields consistent performance improvements across various models and datasets >. p. 1
Where the paper says it

• By using these auxiliary networks, we propose a tampered document image generation framework that produces diverse and high-quality manipulations. • We show that our data-generation pipeline yields consistent performance improvements across various models and datasets.

We show that our data-generation pipeline yields consistent performance improvements across various models and datasets when evaluating them on real-world data. p. 0
Where the paper says it

We assess the effectiveness of our data generation pipeline by training multiple models on datasets derived from the same source images, generated using our method and existing approaches, under identical training protocols. Evaluating these models on various open-source datasets shows that our pipeline yields consistent performance improvements across architectures and datasets.

Pruning redundant reasoning tokens

The paper addresses the limitation of previous rule-based methods, which often produce low-quality tampering with visible traces, by training auxiliary networks to guide the generation process.<ref:2602.17322#pg1, We first train an auxiliary network to compare text crops, leveraging contrastive learning with a novel strategy for defining positive pairs and their corresponding negatives >. This approach is designed to ensure that the generated tampering is convincing by ensuring visual characteristics of the source and target regions closely match. p. 1

Where the paper says it

For copy-move, splicing, and coverage, a crop is copied from a source image and placed into a target image. To ensure the tampering is convincing, the visual characteristics of the source and target regions must closely match.

<ref:2602.17322#pg3, To ensure visual consistency, whether between source and target regions or between rendered and surrounding text, we introduce a similarity function defined as S(x, u) = Fθ(x) · Fθ(u)∥Fθ(x)\|∥Fθ(u)\| (1) >. p. 2
Where the paper says it

Illustration of some failure cases in tampered document generation caused by a visual mismatch between the source and target crops, resulting in obvious visual artifacts. target regions or between rendered and surrounding text, we introduce a similarity function defined as S(x, u) = Fθ(x) · Fθ(u) ∥Fθ(x)∥ ∥Fθ(u)∥ .

Correctly training both Fθ and Gθ is therefore key to generating high-quality tampered documents. p. 2
Where the paper says it

Generating high-quality tampering requires both a high similarity score and a high bounding box quality score. Correctly training both Fθ and Gθ is therefore key to generating high-quality tampered documents.

<ref:2602.17322#pg3, We use a novel training framework for Fθ, based on contrastive learning, to capture visual similarity between two text crops or between a text crop and a blank crop >. p. 2
Where the paper says it

Correctly training both Fθ and Gθ is therefore key to generating high-quality tampered documents. We use a novel training framework for Fθ, based on contrastive learning, to capture visual similarity between two text crops or between a text crop and a blank crop.

The contrastive loss is defined as: Li = − log expS(bi,b+i)/τ expS(bi,b+i)/τ + P b− i∈Ni expS(bi,b−i)/τ (2) ≈ The contrastive loss is defined as: Li = − log expS(bi,b+i)/τ expS(bi,b+i)/τ + P b− i∈Ni expS(bi,b−i)/τ. p. 3
Where the paper says it

For more details on the applied data augmentation, please refer to Sec. Loss calculation The contrastive loss is defined as: Li = − log expS(bi,b+ i )/τ expS(bi,b+ i )/τ + P b− i ∈Ni expS(bi,b− i )/τ (2) where τ is a temperature parameter, b + i is a positive crop, and Ni is the set of negative crops.

How the training signal is built

The training signal for the similarity network Fθ is built using contrastive learning to capture visual similarity between two text crops or between a text crop and a blank crop.<ref:2602.17322#pg4>. Defining positive pairs. p. 0

Where the paper says it

Motivated by this discrepancy, we propose a novel method for generating high-quality tampered document images. We first train an auxiliary network to compare text crops, leveraging contrastive learning with a novel strategy for defining positive pairs and their corresponding negatives.

We observe that adjacent text or blank regions along the same line in a document often share similar visual properties. p. 2
Where the paper says it

While a convolutional neural network is well-suited to this task, the primary challenge is obtaining appropriate training data, which motivates the use of contrastive learning. Defining positive pairs We observe that adjacent text or blank regions along the same line in a document often share similar visual properties.

<ref:2602.17322#pg4, We define negatives as crops bj that contain the same number of characters as bi and whose vertical distance to bi exceeds τ1 × h, with wj/hj ∈ [1 − ε, 1 + ε] >. p. 2
Where the paper says it

For more details on ExtractLineSegments, please refer to Sec. Defining negatives We define negatives as crops bj that contain the same number of characters as bi and whose vertical distance to bi exceeds τ1 × h, where h is the average character height in the image, and whose aspect ratio satis3

Defining negatives. p. 0
Where the paper says it

Motivated by this discrepancy, we propose a novel method for generating high-quality tampered document images. We first train an auxiliary network to compare text crops, leveraging contrastive learning with a novel strategy for defining positive pairs and their corresponding negatives.

We define negatives as crops bj that contain the same number of characters as bi and whose vertical distance to bi exceeds τ1 × h, with wj/hj ∈ [1 − ε, 1 + ε]. p. 2
Where the paper says it

For more details on ExtractLineSegments, please refer to Sec. Defining negatives We define negatives as crops bj that contain the same number of characters as bi and whose vertical distance to bi exceeds τ1 × h, where h is the average character height in the image, and whose aspect ratio satis3

p. 2
Where the paper says it

For more details on ExtractLineSegments, please refer to Sec. Defining negatives We define negatives as crops bj that contain the same number of characters as bi and whose vertical distance to bi exceeds τ1 × h, where h is the average character height in the image, and whose aspect ratio satis3

<ref:2602.17322#pg4>. We define negatives as crops bj that contain the same number of characters as bi and whose vertical distance to bi exceeds τ1 × h, with wj/hj ∈ [1 − ε, 1 + ε].<ref:2602.17322#pg4, In addition, we generate Malt altered versions of each anchor bi by applying random local shifts and visual transformations >. p. 3
Where the paper says it

We note that negative examples are first collected from the same image as the source crop, and then from other images if necessary, until the desired number of negative samples is reached. In addition, we generate Malt altered versions of each anchor bi by applying random local shifts and visual transformations.

To create hard negatives, we apply a series of randomized augmentations to the anchor crop itself. p. 3
Where the paper says it

Algorithm 1 Mining positive and negative crop pairs for training Fθ. 1: Input: Document image I0, character-level OCR, thresholds τ0, τ1, tolerance ε, negatives per anchor N, augmented hard negatives per anchor Malt, function ExtractLineSegments (Sec.

<ref:2602.17322#pg15>. This process is repeated Malt times per anchor, resulting in multiple hard negatives that maintain spatial structure but differ in appearance. p. 3
Where the paper says it

Algorithm 1 Mining positive and negative crop pairs for training Fθ. 1: Input: Document image I0, character-level OCR, thresholds τ0, τ1, tolerance ε, negatives per anchor N, augmented hard negatives per anchor Malt, function ExtractLineSegments (Sec.

<ref:2602.17322#pg15>

Where the gains come from

The primary gains come from leveraging both auxiliary networks to produce diverse and high-quality manipulations.<ref:2602.17322#pg1>. The combination of Fθ and Gθ is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models. p. 0

Where the paper says it

Evaluating these models on various open-source datasets shows that our pipeline yields consistent performance improvements across architectures and datasets. Introduction Due to the presence of sensitive information, document images are frequent targets of malicious tampering, making the development of robust detection methods essential.

<ref:2602.17322#pg18, Overall, this qualitative study confirms that the combination of Fθ and Gθ is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models >. p. 0
Where the paper says it

Evaluating these models on various open-source datasets shows that our pipeline yields consistent performance improvements across architectures and datasets. Introduction Due to the presence of sensitive information, document images are frequent targets of malicious tampering, making the development of robust detection methods essential.

p. 0
Where the paper says it

Evaluating these models on various open-source datasets shows that our pipeline yields consistent performance improvements across architectures and datasets. Introduction Due to the presence of sensitive information, document images are frequent targets of malicious tampering, making the development of robust detection methods essential.

The results confirm that both F and G contribute positively to the final model performance. p. 0
Where the paper says it

However, the resulting documents often suffer from limited variety and poor visual quality, typically leaving highly visible artifacts that are rarely observed in real-world manipulations. This undermines the model’s ability to learn robust, generalizable features and results in poor performance on real-world data.

p. 0
Where the paper says it

However, the resulting documents often suffer from limited variety and poor visual quality, typically leaving highly visible artifacts that are rarely observed in real-world manipulations. This undermines the model’s ability to learn robust, generalizable features and results in poor performance on real-world data.

p. 0
Where the paper says it

However, the resulting documents often suffer from limited variety and poor visual quality, typically leaving highly visible artifacts that are rarely observed in real-world manipulations. This undermines the model’s ability to learn robust, generalizable features and results in poor performance on real-world data.

<ref:2602.17322#pg19>

The bounding box quality network Gθ is trained to evaluate whether a given crop tightly encloses the intended characters without cutting off parts of characters or including parts of adjacent ones.<ref:2602.17322#pg1, We introduce a bounding box quality function Gθ(·) ∈ [0, 1], where lower output values indicate poorly defined crops >. p. 2

Where the paper says it

Moreover, when the source or target crop contains text, one common source of poor tampering quality is an ill-defined bounding box that cuts through characters, leaving detectable artifacts. To avoid this, we introduce a bounding box quality function Gθ(·) ∈ [0, 1], where lower output values indicate poorly defined crops.

To avoid this, we introduce a bounding box quality function Gθ(·) ∈ [0, 1], where lower output values indicate poorly defined crops. p. 2
Where the paper says it

Moreover, when the source or target crop contains text, one common source of poor tampering quality is an ill-defined bounding box that cuts through characters, leaving detectable artifacts. To avoid this, we introduce a bounding box quality function Gθ(·) ∈ [0, 1], where lower output values indicate poorly defined crops.

<ref:2602.17322#pg3>. Our model is about 12 times faster than the employed data-filtering process explained below. p. 2
Where the paper says it

The red box denotes the anchor, the green its positive, and the blue boxes the negatives. the training data can compromise the training process by constituting shortcuts for the model, undermining its ability to generalize to genuine real-world manipulations.

<ref:2602.17322#pg14, We note that we use a neural network instead of relying on rules and background/foreground estimation algorithms because those approaches are slow >

The performance gains are significant when comparing models trained on our generated dataset with those trained directly on DocTamper.<ref:2602.17322#pg7>. Our approach yields significantly better results than training on the DocTamper dataset in terms of both image-level and pixel-level performance metrics. p. 7

Where the paper says it

To further confirm this, we compare the average performance of models trained directly on DocTamper with those trained on our generated dataset in Tab. Training on data generated by our approach yields significantly Table 2.

<ref:2602.17322#pg7>. The gains on these more challenging datasets are even more notable for the stronger models FFDN and ASC-Former. p. 7
Where the paper says it

The results also indicate that performance gains are more pronounced on RTM and FindItAgain, which were designed to reflect realistic manipulation scenarios, in contrast with FindIt, which was created by non-expert volunteers with heterogeneous skill levels and without explicit quality control. The gains on these more challenging datasets are even more notable for the stronger models FFDN and ASCFormer.

p. 7
Where the paper says it

The results also indicate that performance gains are more pronounced on RTM and FindItAgain, which were designed to reflect realistic manipulation scenarios, in contrast with FindIt, which was created by non-expert volunteers with heterogeneous skill levels and without explicit quality control. The gains on these more challenging datasets are even more notable for the stronger models FFDN and ASCFormer.

<ref:2602.17322#pg7>. The comparison above shows that our data generation strategy substantially outperforms the one used to create DocTamper. p. 7
Where the paper says it

7 percent relative pixel-level F1 score improvement on FindItAgain, increasing its pixel-level F1 score from 11. The comparison above shows that our data generation strategy substantially outperforms the one used to create DocTamper [25].

p. 7
Where the paper says it

7 percent relative pixel-level F1 score improvement on FindItAgain, increasing its pixel-level F1 score from 11. The comparison above shows that our data generation strategy substantially outperforms the one used to create DocTamper [25].

<ref:2602.17322#pg7>

The pipeline supports all five tampering types by unifying the procedure guided by both Fθ and Gθ <ref:2602.17322#pg1, Because ExtractLineSegments provides both text and blank segments, this unified procedure enables tampering via all five categories: insertion, inpainting, copy-move, splicing, and coverage >. p. 5

Where the paper says it

(8) The chosen crop cj ∗ replaces region r, and the tampering mask is updated accordingly. Because ExtractLineSegments provides both text and blank segments, this unified procedure enables tampering via all five categories: insertion, inpainting, copy-move, splicing, and coverage.

This unified procedure enables tampering via all five categories: insertion, inpainting, copy-move, splicing, and coverage. p. 5
Where the paper says it

(8) The chosen crop cj ∗ replaces region r, and the tampering mask is updated accordingly. Because ExtractLineSegments provides both text and blank segments, this unified procedure enables tampering via all five categories: insertion, inpainting, copy-move, splicing, and coverage.

<ref:2602.17322#pg15>. We summarize the full procedure in Algorithm 2. p. 5
Where the paper says it

In the second case, the embeddings of all crops using Fθ need to be precomputed, and ε ′ is set to zero. We summarize the full procedure in Algorithm 2.

For clarity, Algorithm 2 assumes that Gθ operates solely on the crop input, without incorporating the surrounding stripe information. p. 5
Where the paper says it

We summarize the full procedure in Algorithm 2. For clarity, Algorithm 2 assumes that Gθ operates solely on the crop input, without incorporating the surrounding stripe information.

<ref:2602.17322#pg15>

The robustness of the pipeline is confirmed by testing its sensitivity to OCR quality, showing that performance remains stable even when replacing the OCR engine with Tesseract.<ref:2602.17322#pg19, Replacing the OCR engine. p. 2

Where the paper says it

This observation motivates a simple yet effective contrastive learning paradigm, where such regions can be treated as positive pairs for training. We define ExtractLineSegments(OCR(I)) as a function that takes the per-character OCR bounding boxes OCR(I) and returns pairs {(bi , li)} n i=1, where each bi corresponds to either a text segment or a blank region and is assigned a line index li .

In the first experiment, we replace the default OCR back-end, Google OCR, with Tesseract, keeping all other components of the generation and training pipeline unchanged >. When evaluated in the same zero-shot setting as our main experiments, the average Pixel-level and Image-level F1 score decreases by only 0. p. 7
Where the paper says it

We assess performance in the zero-shot setting, reporting document-level classification and pixel-level segmentation results. The resulting models are evaluated on three humanmade document manipulation datasets, RTM [20], FindItAgain [28] and FindIt [2].

4 points compared to the original pipeline. p. 0
Where the paper says it

Leveraging Contrastive Learning for a Similarity-Guided Tampered Document Data Generation Pipeline Mohamed Dhouib LIX, Ecole Polytechnique, IP Paris, France ´ mohamed. dhouib@polytechnique.

<ref:2602.17322#pg19, Perturbing OCR bounding boxes. p. 2
Where the paper says it

This observation motivates a simple yet effective contrastive learning paradigm, where such regions can be treated as positive pairs for training. We define ExtractLineSegments(OCR(I)) as a function that takes the per-character OCR bounding boxes OCR(I) and returns pairs {(bi , li)} n i=1, where each bi corresponds to either a text segment or a blank region and is assigned a line index li .

In the second experiment, we keep the default OCR engine but artificially degrade its output before generation >. p. 3
Where the paper says it

A), function GetAlteredCrop (Sec. 1) 2: Output: contrastive pairs and corresponding negative crops 3: {(bi, ℓi)} n i=1 ← ExtractLineSegments(OCR(I0)) 4: w ← average character width in I0; h ← average character height in I0 5: Initialize collection S ← ∅ 6: for each anchor index i do 7: ci ← crop(I0, bi) 8: Let nchars,i be the number of characters in bi 9: Initialize Pi ← ∅, Ni ← ∅ 10: Step 1: Positive mining.

Despite this additional noise, the final detection performance remains stable: the average Pixel-level F1 score drops by only 0. p. 7
Where the paper says it

8 ASC-Former 51. 5 stronger models, with the average pixel-level F1 score increasing from 9.

7 points relative to the baseline. p. 8
Where the paper says it

2 [13] Rui Lan, Yancheng Bai, Xu Duan, Mingxing Li, Lei Sun, and Xiangxiang Chu. Flux-text: A simple and advanced diffusion transformer baseline for scene text editing.

<ref:2602.17322#pg19, This additional noise, the final detection performance remains stable: the average Pixel-level F1 score drops by only 0. p. 7
Where the paper says it

8 ASC-Former 51. 5 stronger models, with the average pixel-level F1 score increasing from 9.

7 points relative to the baseline >

The qualitative assessment confirms that disabling both auxiliary networks leads to the most degraded results.<ref:2602.17322#pg18>. Overall, this qualitative study confirms that the combination of Fθ and Gθ is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models. p. 0

Where the paper says it

Evaluating these models on various open-source datasets shows that our pipeline yields consistent performance improvements across architectures and datasets. Introduction Due to the presence of sensitive information, document images are frequent targets of malicious tampering, making the development of robust detection methods essential.

<ref:2602.17322#pg18, overall, this qualitative study confirms that the combination of Fθ and Gθ is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models >

The results show that models trained on data generated using our approach generalize well to AI-generated tampering without requiring additional fine-tuning.<ref:2602.17322#pg19, As shown in Tab. p. 7

Where the paper says it

The comparison above shows that our data generation strategy substantially outperforms the one used to create DocTamper [25]. To further confirm this, we compare the average performance of models trained directly on DocTamper with those trained on our generated dataset in Tab.

p. 7
Where the paper says it

The comparison above shows that our data generation strategy substantially outperforms the one used to create DocTamper [25]. To further confirm this, we compare the average performance of models trained directly on DocTamper with those trained on our generated dataset in Tab.

10, models trained on data generated by our approach generalize well to these AI-generated forgeries without requiring additional fine-tuning >. p. 7
Where the paper says it

Furthermore, we show in Sec. J that models trained on data generated using our approach generalize well to AI-generated tampering.

p. 7
Where the paper says it

Furthermore, we show in Sec. J that models trained on data generated using our approach generalize well to AI-generated tampering.

Models trained on data generated by our approach generalize well to these AI-generated forgeries without requiring additional fine-tuning. p. 7
Where the paper says it

Furthermore, we show in Sec. J that models trained on data generated using our approach generalize well to AI-generated tampering.

p. 7
Where the paper says it

Furthermore, we show in Sec. J that models trained on data generated using our approach generalize well to AI-generated tampering.

<ref:2602.17322#pg19, models trained on data generated by our approach generalize well to these AI-generated forgeries without requiring additional fine-tuning >

The time cost analysis shows that the auxiliary networks contribute a small fraction of the total processing time.<ref:2602.17322#pg19>. Generating the entire dataset of 2. p. 0

Where the paper says it

This undermines the model’s ability to learn robust, generalizable features and results in poor performance on real-world data. Motivated by this discrepancy, we propose a novel method for generating high-quality tampered document images.

8 million tampered images with corresponding pixel-level masks required about 290 hours on a single A100 with 16 CPU cores. p. 6
Where the paper says it

P, R, and F1 correspond to precision, recall, and F1 score, while Image and Pixel denote image-level classification and pixel-level localization performance. Note that the source images used to generate the training data are the same across models and data generation methods as described in Sec.

<ref:2602.17322#pg19>

The final results confirm that both F and G contribute positively to the final model performance.<ref:2602.17322#pg19>. The results confirm that both F and G contribute positively to the final model performance.<ref:2602.17322#pg19>

The qualitative comparison shows that when both networks are active, the replaced regions match the surrounding text, producing visually coherent manipulations with no artifact left by ill-defined crops.<ref:2602.17322#pg18>. Disabling Fθ while keeping Gθ (no similarity) often leads to noticeable inconsistencies: characters become slightly misaligned, spacing drifts, and the texture or color among other visual characteristics of the pasted crop differ from the surrounding line. p. 2

Where the paper says it

The training procedures for both networks are detailed in the following two subsections. Assessing crop similarity For copy-move and splicing, high-quality tampering requires that source and target patches share visual characteristics such as font style and size, foreground and background color, texture, and both vertical and horizontal text alignment.

<ref:2602.17322#pg18>. Conversely, disabling Gθ while keeping Fθ (no quality) results in bounding boxes that occasionally cut into neighboring characters or include traces of surrounding text. p. 2
Where the paper says it

We use a novel training framework for Fθ, based on contrastive learning, to capture visual similarity between two text crops or between a text crop and a blank crop. For Gθ, we adopt a supervised learning approach that considers both the crop and its surrounding context to assess bounding box quality.

<ref:2602.17322#pg18>. Finally, disabling both auxiliary networks (no sim no quality) leads to the most degraded results. p. 0
Where the paper says it

We also train a second auxiliary network to evaluate whether a crop tightly encloses the intended characters, without cutting off parts of characters or including parts of adjacent ones. Using a carefully designed generation pipeline that leverages both networks, we introduce a framework capable of producing diverse, high-quality tampered document images.

<ref:2602.17322#pg18>

The localization performance of models trained on data generated by our approach is superior, especially in harder cases.<ref:2602.17322#pg18, In both cases false positives are present, however, models trained on data generated by our approach show less false positives and localize more frequently hard tampered areas >. p. 7

Where the paper says it

In addition, we present qualitative comparisons and precisionrecall curves of the resulting tampering localization models trained on data generated by our approach versus previous work in Sec. 1 provides an analysis of the per-image generation time of our approach, showing that F and G together account for less than 20 percent of the total processing time.

These qualitative trends confirm that the proposed generation pipeline provides more informative supervision for challenging document forgeries, leading to sharper and more reliable localization. p. 7
Where the paper says it

In addition, we present qualitative comparisons and precisionrecall curves of the resulting tampering localization models trained on data generated by our approach versus previous work in Sec. 1 provides an analysis of the per-image generation time of our approach, showing that F and G together account for less than 20 percent of the total processing time.

<ref:2602.17322#pg18, The results show that models trained on data generated by our approach localize tampered regions more accurately, especially in the harder cases >

The precision-recall curves demonstrate that at equal precision, the recall of the final models trained using our data generation approach is higher.<ref:2602.17322#pg19>. To further demonstrate that our data generation approach surpasses the baselines, we provide in Fig. p. 7

Where the paper says it

Results and evaluation 4. Main results To demonstrate the superiority of our data generation approach, we train five models, DTD [25], ASC-Former [20], CAT-Net [10], PSCC-Net [18], and FFDN [4], on three datasets: one generated by our method and two produced by prior approaches proposed in [6] and [25].

9 the precision–recall curves for FFDN and ASC-Former. p. 7
Where the paper says it

Results and evaluation 4. Main results To demonstrate the superiority of our data generation approach, we train five models, DTD [25], ASC-Former [20], CAT-Net [10], PSCC-Net [18], and FFDN [4], on three datasets: one generated by our method and two produced by prior approaches proposed in [6] and [25].

<ref:2602.17322#pg19>. The same also holds at equal recall. p. 6
Where the paper says it

∆(%) indicates the relative performance gain of our generation method over the best of [25] and [6]. P, R, and F1 correspond to precision, recall, and F1 score, while Image and Pixel denote image-level classification and pixel-level localization performance.

<ref:2602.17322#pg19>

The localization performance of models trained on data generated with and without using the auxiliary networks Fθ and Gθ is superior. p. 1

Where the paper says it

Models trained on data generated with our approach consistently surpass the baselines across different datasets. Our main contributions are: • We introduce two auxiliary networks: one for crop similarity estimation trained using contrastive learning and another for evaluating bounding box quality.

<ref:2602.17322#pg18, Overall, this qualitative study confirms that the combination of Fθ and Gθ is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models >. The localization performance of models trained on data generated with and without using the auxiliary networks Fθ and Gθ is superior.<ref:2602.17322#pg18, Overall, this qualitative study confirms that the combination of Fθ and Gθ is essential for producing high-fidelity forgeries suitable for training robust tampering-detection models >

The paper concludes by showing that models trained on data generated using our approach generalize well to AI-generated tampering without requiring additional fine-tuning.<ref:2602.17322#pg19, As shown in Tab. 10, models trained on data generated by our approach generalize well to these AI-generated forgeries without requiring additional fine-tuning >. Models trained on data generated by our approach generalize well to these AI-generated forgeries without requiring additional fine-tuning.<ref:2602.17322#pg19, models trained on data generated by our approach generalize well to these AI-generated forgeries without requiring additional fine-tuning >. p. 7

Where the paper says it

Furthermore, we show in Sec. J that models trained on data generated using our approach generalize well to AI-generated tampering.

The results confirm that both F and G contribute positively to the final model performance.<ref:2602.17322#pg19>

The benefits of using our proposed pipeline are most pronounced on RTM and FindItAgain, which were designed to reflect realistic manipulation scenarios.<ref:2602.17322#pg8, The results also indicate that performance gains are more pronounced on RTM and FindItAgain, which were designed to reflect realistic manipulation scenarios, in contrast with FindIt >. p. 7

Where the paper says it

This improvement is consistent across datasets and architectures, with stronger models such as FFDN and ASC-Former benefiting even more from being trained on the higher-quality data generated by our approach. The results also indicate that performance gains are more pronounced on RTM and FindItAgain, which were designed to reflect realistic manipulation scenarios, in contrast with FindIt, which was created by non-expert volunteers with heterogeneous skill levels and without explicit quality control.

The gains on these more challenging datasets are even more notable for the stronger models FFDN and ASC-Former.<ref:2602.17322#pg8, FFDN, for example, benefits from a 125. p. 7
Where the paper says it

The gains on these more challenging datasets are even more notable for the stronger models FFDN and ASCFormer. FFDN, for example, benefits from a 125.

7 percent relative pixel-level F1 score improvement on FindItAgain >. p. 7
Where the paper says it

FFDN, for example, benefits from a 125. 7 percent relative pixel-level F1 score improvement on FindItAgain, increasing its pixel-level F1 score from 11.

The comparison above shows that our data generation strategy substantially outperforms the one used to create DocTamper.<ref:2602.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. Improve data generation by training two auxiliary networks to compare text crops using contrastive learning and evaluate bounding box quality using a supervised learning approach. This allows for generating diverse, high-quality tampered document images that better reflect real-world manipulations by ensuring both visual similarity and tight enclosure of intended characters.

  2. Implement a unified data generation pipeline that leverages both the crop similarity network Ftheta and the crop quality network Gtheta to support all five tampering types: copy-move, splicing, insertion, inpainting, and coverage. This pipeline enables tampering via all five categories by using the similarity function S(x, u) and bounding box quality function Gtheta to select the best matching source crops or apply inpainting based on defined probabilities.

  3. Enhance model training robustness by employing a Syn2Real Protocol that involves training models on synthetic data generated by different approaches and then fine-tuning them on each target dataset's training split. This strategy confirms that models pretrained with data generated by our approach still achieve the best results on average, confirming that our data generation approach provides a stronger starting point even when real annotations are available.

  4. Improve localization performance of detection models by training them on synthetic datasets generated using the full pipeline (including both auxiliary networks) versus those generated using only one auxiliary network or neither. This comparison shows that models trained on data generated by our approach localize tampered regions more accurately, especially in the harder cases, leading to sharper and more reliable localization and lower F1 scores at both image and pixel levels for tampering quality assessment.

  5. Increase generalization to AI-generated tampering by constructing a dedicated benchmark using FLUX-Text and AnyText models, alongside untampered examples, sourced from the CC-MAIN-2021-31-PDF corpus excluding pretraining data. Results show that models trained on data generated by our approach generalizes well to these AI-generated forgeries without requiring additional fine-tuning.

Abstract

Detecting tampered text in document images is a challenging task due to data scarcity, which has led previous work to propose rule-based pipelines for generating tampered documents. In this work, we identify two recurring failure modes in these pipelines: visual mismatches between source and target regions, and poorly defined crops that cut through characters or include neighboring content. Both leave highly visible artifacts that are rarely observed in real-world manipulations, undermining the ability of detectors trained on such data to learn robust, generalizable features. To address these failure modes, we introduce a crop-similarity network that compares source and target regions and a bounding-box quality assessment network that evaluates whether a crop tightly encloses the intended characters. We train the crop-similarity network using contrastive learning with a novel strategy for mining visually consistent positives. Our similarity-guided generation framework leverages both networks to produce high-quality tampered document images. To isolate the effect of the generation strategy, we train seven models under identical protocols on datasets generated from the same source images using our method and existing approaches. Across architectures and open-source datasets, our framework yields consistent performance improvements, with an average relative pixel-level F1 gain of 23.1%.

Sources

Related papers