Skip to content

Extracting Training Data from Document-Based Visual Question Answering ModelsExtracting Training Data from Document-Based VQA Models

arXiv· arXiv:2407.08707· Francesco Pinto, Nathalie Rauschmayr, Florian Tramèr, Philip Torr, Federico TombariDepartment of Engineering Science, University of Oxford; Google; ETH ZurichIndexed by this site · 27 days ago· Originally publishedAttacks

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors perform training data extraction attacks on three document VQA models, state that PII appearing only once can be extracted, and propose the EB defense, which reduces extractable PII to zero.

Threat modelThe attacker knows the original training question and holds a copy of the training document with the answer erased (partial context (I−a, Q)), and uses this to prompt the model to output the training answer; the paper also relaxes this assumption (no text, paraphrased question, image perturbation, modality shuffling). The victim systems are Donut, Pix2Struct, and PaLI-3 fine-tuned on DocVQA.

Questions
Document-Based VQA models may memorize training samples and still output answers when the answer has been erased from the input image, including PII that appears only once in the training set, posing a privacy risk.
Methods
The authors use OCR to locate and erase answers in document images, construct a canary set, and query the model with the original training questions; they use a generalization baseline trained without the canary set to distinguish memorization from generalization, and estimate counterfactual memorization scores with 50 random splits; finally they test several defenses.
Experiments and results
All three models can have some answers extracted, including PII that appears only once; lower training resolution leads to more memorization; the exact training question matters more than the original image; the authors report that the EB defense reduces the extractable samples of most models to 0 and slightly increases ANLS.
Limitations and future work
The authors state that EB is a heuristic method, may not withstand more sophisticated attacks, and may introduce a membership inference side channel; extending DP training to VLMs is beyond the scope of this paper. The experiments cover three models and one dataset, DocVQA, and the attack assumes knowledge of the training question and document.
Experimental setupDonut、Pix2Struct Base et al. · DocVQA · |E|、|M| = |E − G| et al.
Evaluated models
DonutPix2Struct BasePix2Struct LargePaLI-3
Benchmarks
DocVQA
Metrics
|E||M| = |E − G|PII数量Unique PII数量ANLSExtractable Memorization scoreExtractable Simplicity score
AI summaryThe researchers found that document-based visual question answering models memorize answers to training samples and can still recite them even when the relevant visual information is removed, including personally identifiable information that appears only once in the training set. The paper quantifies information extractability in controlled experiments, distinguishes whether recitation comes from generalization ability or memorization, and examines factors affecting memorization across multiple advanced models; the authors propose a heuristic countermeasure and experiments show it can prevent personally identifiable information from being extracted.

The researchers found that document-based visual question answering models memorize answers to training samples and can still recite them even when the relevant visual information is removed, including personally identifiable information that appears only once in the training set. The paper quantifies information extractability in controlled experiments, distinguishes whether recitation comes from generalization ability or memorization, and examines factors affecting memorization across multiple advanced models; the authors propose a heuristic countermeasure and experiments show it can prevent personally identifiable information from being extracted.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Document VQA models can still recite training answers after the answer is erased from the image (including PII that appears only once); the authors quantify and attribute this phenomenon.

    Core problem: Document-Based VQA models memorize training samples; even when the answer has been erased from the input image, they can still recite the answer from the question and the incomplete document, including PII that appears only once in the training set, posing a privacy risk.

    • Setting and importance: modern VLMs can read text directly from document images and answer questions (the DocVQA task). The authors state that when an answer is unique or sparsely repeated in the training set, the model can still give the correct answer, potentially leaking memorized sensitive information.
    • Gap in existing work: training data extraction has been studied on text generation models and text-to-image models, but the authors state that to their knowledge no work has studied private training sample extraction from VQA systems; existing VQA research focuses on shortcuts involving information shared across samples (generalization), not the memorization analyzed in this paper.
    • Core observation: Figures 1 and 2 show Donut and Pix2Struct-Base still answering PII that appears only once or twice after the answer region is blacked out (the authors have anonymized it).
    • Paper contributions: the authors propose an extractability definition and attribution method for DocVQA (distinguishing memorization from generalization), analyze the effects of resolution, context, modality, and other factors, and propose the Extraction Blocking (EB) defense, which the authors state reduces extractable PII to zero.
    • Threat model:
      • Attacker goal: extract answers to training samples from the model, especially PII.
      • Knowledge: knows the original training question Q and holds a copy of the training document with the answer erased, I−a (Figure 1); Section 5 relaxes this to not knowing the exact question wording, not knowing the document content, or having only an approximate scan.
      • Capability: can only issue queries to the model (prompt + image), with no internal access to the model.
      • Victim systems: Donut, Pix2Struct (Base/Large), PaLI-3 fine-tuned on DocVQA.
  2. What related research exists?

    Related work falls into three groups: training data extraction from generative models, the definition of memorization versus generalization, and VQA shortcut learning; the authors state that this paper is the first work to study training sample extraction from VQA.

    Training data extraction from generative models

    • Carlini et al. (2021; 2023b), Kandpal et al. (2022), Tirumala et al. (2022)——study LLM memorization and regurgitation of training data, even without overfitting on average; extractability depends on sample repetition count, but samples appearing once can also be extracted.
    • Carlini et al. (2023a), Somepalli et al. (2023a;b)——text-to-image models (e.g., Stable Diffusion) can reproduce training images given training caption prompts.
    • The paper notes that these works focus on near-verbatim reproduction of entire training samples, whereas this paper focuses on partial information extraction from VQA models and distinguishes whether successful extraction stems from memorization or generalization.

    Definition and measurement of memorization

    • Feldman (2019)——proposes the counterfactual definition of memorization: the difference in model performance when a sample is in versus out of the training set; empirical measurement is costly and requires training many models (Lukasik et al., 2023; Feldman & Zhang, 2020).
    • Carlini et al. (2021), Guo et al. (2023)——efficient heuristics comparing two models (with/without the sample), which this paper follows.
    • Zhang et al. (2021a)——proposes a simplicity score to complement the memorization score; the split-sampling procedure of Carlini et al. (2022) is used in this paper for K=50 splits.

    Privacy and shortcuts in VQA

    • Plant et al. (2022)——language models can infer sensitive information such as gender and nationality from contextual cues; Tito et al. (2023)——VQA systems can memorize information shared across diverse samples. The paper notes that these works exploit generalization properties rather than the concept of memorization analyzed in this paper.
    • Appendix D.2: Jabri et al. (2016), Niu et al. (2021), Goyal et al. (2017), Dancette et al. (2021), Si et al. (2022)——linguistic/visual/multimodal shortcuts in VQA; the concurrent Tito et al. (2023) demonstrates cross-invoice inference of vendor information on a federated learning invoice dataset, and the paper notes that this paper focuses on centralized training and attacks targeting training documents, with the goal of protecting individual answers rather than vendor identity.

    Baselines and benchmarks: the attribution baseline is the generalization baseline fG (same architecture, training set with the canary set removed); defense comparisons are ITP, PR/AR; the benchmark is DocVQA (about 40K training samples), and the utility metric is ANLS.

    Authors' positioning: to their knowledge, this paper is the first work to study private training sample extraction from VQA systems, and it proposes extractable memorization/simplicity scores adapted to DocVQA.

  3. How does the paper address this problem?

    Use OCR to erase answers and construct canaries, attribute memorization with a generalization baseline, validate with counterfactual scores over 50 splits, and finally test four defenses.

    Overall approach: embed manually screened canaries into the DocVQA training set, query the fine-tuned model with "answer-erased image + original training question," and count extractable samples; then use a same-architecture model that has never seen the canaries as a control to distinguish memorization from generalization, and validate the attribution with counterfactual scores; finally evaluate defenses. The core of the method is the Extractability definition and the Extraction Blocking (EB) defense.

    Task and Extractability Definition

    • Task: given a document image I and a question Q, the model f outputs an answer â=f(I,Q), with the goal â=a; DocVQA is a purely extractive task, so the answer must be explicitly written in the document, making it easy to locate and erase automatically.
    • Definition 3.1: A sample is extractable if f(I−a, Q) = a, where I−a is the image after using Tesseract OCR to locate the answer's bounding box and replace it with a blank box.
    • Canary construction: randomly select about 5400 answers (about 1200 images), manually inspect and remove OCR/matching failures (false positives where the answer is still in the image) and samples easily inferable from context, leaving 4654; these contain a large amount of PII, with the category distribution shown in Figure 7 of Appendix C.

    Attributing Memorization vs. Generalization

    • generalization baseline: fG has the same architecture as f, but its training set excludes the canaries (Dtr − DC; the authors note this does not affect generalization performance); answers that f can extract but fG cannot are regarded as memorization, denoted |M| = |E − G|.
    • Counterfactual validation: adapt Feldman (2019)'s memorization score into Extractable Memorization: ME = Pf ∼ A(Dtr)[f(Ii−ai, Qi) = ai] − Pf ∼ A(Dtr−i)[f(Ii−ai, Qi) = ai], i.e., the difference in extraction success probability between when the model has and has not seen the sample; Extractable Simplicity is the sum of the two terms.
    • Empirical estimation: following the sampling procedure of Carlini et al. (2022), generate K=50 random splits, with each canary in exactly 25 splits and out of 25, and compute M̂E and ŜE for Pix2Struct Base 1M and Donut 2560×1920.

    Context Ablations (Section 5)

    • No Text: erase all text in the image, simulating an attacker who knows only the document layout, not the content.
    • Paraphrasing: rewrite the question Q into Q′ with PaLM2, simulating an attacker who does not know the exact wording of the training question.
    • Image perturbations: brightness (×2/×1.3/×0.8/×0.5), rotation (±5°/±10°), translation (±20/±100 pixels), simulating differences from rescanning.
    • Modality shuffling: pair the image with an unrelated question, or provide only a constant image, to test whether a single modality can trigger extraction.

    Defenses (Section 6)

    • ITP: rewrite the question at inference time; PR/AR: prepend/append a 6-character random string to the question (inspired by Somepalli et al., 2023a).
    • EB (proposed in this paper): for each training sample (I,Q,a), add (I−a, Q, 'ANSWER NOT PRESENT') to the training set, teaching the model to refuse when the answer is not visible; the idea is similar to V-CSS of Chen et al. (2020).
    • Utility is measured by ANLS on a held-out test set; all models are fine-tuned following the original authors' procedure and early-stopped on validation loss to prevent overfitting.
  4. What experiments did the paper conduct?

    All three models can have answers extracted on 4654 canaries (including single-occurrence PII); low resolution exacerbates memorization; EB reduces the extractable samples of most models to 0.

    Experimental setup

    • Models tested: Donut (176M parameters), Pix2Struct Base (282M), Pix2Struct Large (1.3B), PaLI-3 (5B), all fine-tuned on DocVQA following the original authors' procedure with early stopping on validation loss; each model was trained at multiple image resolutions.
    • Dataset: DocVQA (about 40K training samples, purely extractive); canary set of 4654 samples (about 1200 images), manually screened and annotated with PII categories.
    • Attack method: by default queries with (I−a, Q); ablations include No Text, Paraphrasing (PaLM2 rewriting), Shuffling, rotation/translation/brightness perturbation.
    • Metrics: |E| (number extractable), |M|=|E−G| (number attributed to memorization), PII count, Unique PII count; utility metric ANLS; counterfactual scores M̂E, ŜE (K=50 splits, 25 in-splits per sample).
    • Determination method: exact answer match; false positives caused by OCR failure were manually removed; PII was manually annotated.
    • Training cost (Appendix A): Donut at the highest resolution requires 64 A100s for one day; counterfactual scores require 50 training runs, and the authors state that more runs are infeasible in compute and storage.

    Main results

    Key values from Figure 3 (|E|/|M|/|G|, Y-axis log scale) and Figure 4 (PII and Unique PII counts in M) (by model and resolution):

    Model (resolution)|M| (Figure 3)PII / Unique PII in M (Figure 4)
    Donut 2560×19206336 / 19
    Donut 1280×960109corresponding value in figure (bars labeled 107/22 etc., column alignment not fully certain)
    Donut 960×720168not matched individually
    Donut 640×480756180 / not determined
    Pix2Struct Large 1M122122 / not determined
    Pix2Struct Base 1M9494 / 23
    PaLI-3 1064×10644747 / 16
    PaLI-3 812×81244not determined

    Note: after pdftotext conversion, the alignment of bar labels and columns in Figures 3/4 is partly uncertain; the table above fills in only what can be determined. The main text explicitly states: Donut has |M|=63 at the highest resolution, increasing to 109, 168, 756 as resolution decreases; PaLI-3 has the lowest amount of information in M.

    • The authors state that all models can extract a non-zero number of answers from the canary set; a considerable portion of the extractable answers for Donut and Pix2Struct cannot be extracted by fG and may stem from memorization; most extractable answers for high-resolution PaLI-3 stem only from generalization.
    • Resolution effect: under a fixed architecture, the lower the training resolution, the more memorized samples; the authors explain that at low resolution the model has difficulty reading the answer from the image and more easily minimizes loss by memorizing.
    • Pretraining effect: fG extracts mostly high-frequency answers for Donut/Pix2Struct (page numbers, institution names); PaLI-3's fG can also answer questions that depend on common sense, which the authors attribute to its web-scale pretraining; PaLI-3 generalizes best (87.6 ANLS, versus Pix2Struct best 76.6 and Donut best 67.5).

    Counterfactual score validation (Figure 5)

    • What was measured: for Pix2Struct Base 1M and Donut 2560×1920, M̂E and ŜE were computed with 50 splits to validate the attribution in Section 4.1.
    • Results: for the vast majority of canary samples M̂E=ŜE=0 (not extractable); samples in G have low M̂E (answerable whether or not seen); samples in E−G have M̂E between 0 and 1, mostly close to the ŜE=M̂E line, i.e., extraction requires having been seen during training.
    • Authors' interpretation: the samples identified by the simple attribution method in Section 4.1 are indeed judged as memorized by the more expensive counterfactual scores.

    Context ablations (Figure 6)

    • No Text: Donut's |M| drops to 26, Pix2Struct from about 94 to 27; PII greatly reduced, mostly PII repeated 6 or more times; PaLI-3 has no extractable PII.
    • Paraphrasing: extractable counts decrease but are non-zero, and Donut and Pix2Struct still have several unique PII extracted; PaLI-3's extractable count instead rises, but the authors state these are all common-sense questions with no PII.
    • Image perturbation: under brightness perturbation the extractable count remains relatively high; rotation and translation have a greater effect, and the authors state that spatial information is more important than intensity information, and that the exact question is more critical than the exact original image.
    • Shuffling: with only unrelated questions, Donut extracts 4 answers, Pix2Struct 21 (including area codes, names, dates that appear only once or twice in the training set), PaLI-3 2 (no PII); with only images and no matching questions, no answers can be extracted, and the authors state that questions play a dominant role in extraction.

    Defenses (Table 1, Table 2)

    • Table 1 (ΔANLS / |M|): ITP gives Donut |M|=26 and ANLS drop of 12.5; PR/AR reduce |M| to 32–40 with ANLS drop of 1.9–3.7; EB gives Pix2Struct-B/L and PaLI-3 |M|=0 and Donut |M|=2, with ANLS +1.2/+3.4/+2.1/+1.5 respectively.
    • Table 2: EB remains effective against attack contexts not seen during training (No Text, Paraphrasing, Shuffling, various perturbations), with |M| mostly 0–3 across models and PII almost all 0; the authors state that EB's protection generalizes to context types not provided during training.
    • The authors state that ITP and PR/AR require a utility drop, and EB is the only method that both reduces extractable samples and improves test performance.

    Other ablations and analyses

    • Appendix A: Donut at the highest resolution requires 64 A100s for one day; Pix2Struct Base 32 TPUv2 for about 5 hours, Large 64 TPUv2 for about 5 hours; PaLI-3 64 TPUv2 for about 15 hours.
    • Appendix C/Figure 7: PII categories in the canary set include Places, Person, Temporal, Contact, NRP, URL, and various IDs.
    • Negative result: with constant images (pure black/white/mean), no answers can be extracted, which the authors suggest may be because they are too far out of distribution.
  5. What are some points that can be further explored?

    The authors state that EB is heuristic, may not withstand stronger attacks, and may introduce a membership inference side channel; the experiments cover three models and a single dataset.

    Limitations and future directions noted by the authors

    • EB is a heuristic defense (Impact statement): the authors state that it may not stop more sophisticated future attack techniques.
    • EB may introduce a side channel (Impact statement): the model's default refusal to answer may be used as a signal that a sample was in the training set, increasing exposure to membership inference attacks; the authors note that this may be irrelevant in applications where the protection target is document content rather than membership.
    • DP training is not addressed (Impact statement): the authors note that differential privacy can provide membership inference guarantees, but there is no closed-form formula translating it into an extraction-prevention guarantee; extending DP to VLMs without a clear loss in utility requires extensive tuning and is beyond the scope of this paper.
    • Attacks could be stronger (Impact statement): the authors state that this study is only a starting point and that attackers may develop more sophisticated attack strategies.
    • Low-resolution training is not recommended (Appendix A): the authors note that although lowering resolution saves cost, it increases the tendency to memorize and reduces generalization ability, so it is not recommended.

    Scope of the experiments

    • The models tested are Donut, Pix2Struct Base, Pix2Struct Large, and PaLI-3, three systems and four variants in total, all fine-tuned on DocVQA (Section 3).
    • The dataset is DocVQA only; the canary set has 4654 samples and about 1200 images, and PII was manually annotated (Section 3, Appendix C).
    • Counterfactual scores were computed only on two configurations, Pix2Struct Base 1M and Donut 2560×1920, with K=50 splits (Section 4.2, Figure 5).
    • Attack contexts covered: full context, no text, paraphrased question, image rotation/translation/brightness perturbation, modality shuffling (Section 5, Figure 6).
    • The paper does not report defense performance under adaptive attacks (attacks designed specifically against EB); EB training uses only one context, (I−a, Q) (Table 2 note).
  6. Summarize the main content of the paper

    Three document VQA models can be made to extract training answers (including single-occurrence PII); low resolution exacerbates memorization, and the EB defense reduces extractable PII to zero.

    An attack-and-defense study on the privacy risks of document VQA models. The authors find that Donut, Pix2Struct (Base/Large), and PaLI-3 fine-tuned on DocVQA memorize training samples: after erasing the answer region from the document image and querying with the original training question, the models can still answer the answer, including PII that appears only once in the training set (Figure 1, 2).

    • Method: use OCR to locate and erase answers to construct 4654 manually screened canaries; use a same-architecture generalization baseline trained without the canaries to distinguish memorization from generalization (|M|=|E−G|), and validate the attribution's reliability with counterfactual memorization scores over 50 random splits (Figure 5).
    • Main results: all models can have a non-zero number of answers extracted; Donut's |M| rises from 63 at the highest resolution to 756 as resolution decreases (Figure 3); most extractable answers of high-resolution PaLI-3 stem from generalization rather than memorization, and its generalization is also the best (87.6 ANLS).
    • Influencing factors: lower training resolution leads to more memorization; the exact training question matters more than the original image—paraphrasing the question reduces the extractable count but unique PII is still extracted, while image perturbations (especially brightness) still preserve relatively high extraction; with only an unrelated question, Donut can still extract 4 answers and Pix2Struct 21 (Figure 6).
    • Defenses: the authors' proposed Extraction Blocking (adding samples during training that refuse when the answer is missing) reduces |M| to 0 for Pix2Struct-B/L and PaLI-3 and to 2 for Donut, with ANLS rising by about 1.2–3.4, and remains effective against attack contexts unseen during training (Table 1, 2); ITP and PR/AR incur a utility cost.
    • Authors' conclusions and implications: the authors state that these models can memorize unique or sparsely repeated information and have it extracted under incomplete context, constituting a privacy risk; they also acknowledge that EB is a heuristic method that may not withstand stronger attacks and may introduce a membership-inference side channel, leaving DP training extended to VLMs for future work.

Related papers

Read originalarxiv.org