Batch prompting packs several questions into one prompt, so the shared instructions are paid for once instead of once per question. In text-only models this cuts cost several-fold and sometimes raises accuracy. Vision-language models, which answer questions about images, are a natural place to use it. Product-catalog extraction and object-presence checking both generate thousands of small, schema-shaped queries. But these models have a known weakness called modality bias: they lean on language habits and on text they have already produced, and give too little weight to the image. In a batched prompt, every answer the model writes becomes text that later answers can see. We hypothesize that batching therefore creates a specific failure we call answer contagion. The model's answer to question $i$ is pulled toward its own answers to questions $1,\dots,i-1$ rather than toward the image. One example is a run of "yes" answers that breeds more "yes" answers. Another is a hallucinated brand on one product ad being copied onto the next.
The proposal is to measure this effect and then remove it surgically. Grammar-constrained decoding forces output to follow a formal schema, here a JSON array with one element per question. Because the parser always knows which array element is being written, we know exactly which earlier tokens are other questions' answers. We use that knowledge to hide earlier answer values from the model's attention while it writes the current answer. Everything else in the batch stays visible: the shared instructions, the other questions, and the other images. This keeps the cost savings and the cross-question comparison that make batching useful, and cuts the one channel through which text priors spread from answer to answer. If we can show, by ablation, that the contagion channel exists and that closing it recovers single-query grounding at batched cost, practitioners will have a specific reason to batch structured vision-language workloads differently than text ones.
Core Claim
We claim three things. First, in batched vision-language prompting the share of errors explained by preceding answers grows with batch position, and it is largest on the questions where modality bias is already worst, namely POPE's adversarial split. Second, these errors come mainly from attention to previously generated answer tokens, not from the presence of other questions or images. Third, a grammar-gated attention mask removes most of that excess error while keeping the token savings of batching. The masking idea needs exact instance boundaries, and only constrained decoding provides them reliably. For this reason structured output adherence is not a side constraint here. It is the instrument that makes the intervention possible.
Grounding in Prior Work
Three text-only batching papers motivate the question without answering it. Batch Prompting indexes questions and answers as Q[i]/A[i], reports about 5x cost reduction at batch size 6, and names error propagation from early answers as an open risk. BatchPrompt reports over 80% input-token savings on data tasks. Reasoning Under Constraint finds that batching cuts reasoning-model tokens by 76% and raises average accuracy from 75.0% to 78.2%. That last finding is the main counterweight to our hypothesis: cross-instance context can regularize rather than contaminate. None of the three involves images. Our study asks which effect dominates once the model's weakest input is visual. Optimized Batch Prompting chooses which questions to group, and entity-resolution batching shows that comparison across instances helps. Both suggest the benefit of batching lives partly in seeing other inputs. That is why our mask keeps inputs visible and hides only outputs.
Two lines of modality-bias work motivate the mechanism and also constrain the design. Re-Balancing Contrastive Decoding reports that visual tokens receive only about 25% of attention in deep layers of LLaVA-v1.5. It fixes this by contrasting a noise-corrupted branch against a clean one, at the price of extra forward passes. LLaVA Steering shifts visual hidden states with a tiny learned linear map and measures imbalance with a layer-wise attention ratio. Hallucination snowballing shows that a model's own hallucinated tokens, once in its cache, compound across turns. We extend that observation from one response to many sibling responses. All three studies use single-instance prompts. Our intervention differs from contrastive decoding and steering because it does not try to raise visual attention in general. It removes a specific competing text source that batching introduces. POPE supplies the yes-bias diagnosis: yes-rates near 99% for some models, and MiniGPT-4 F1 falling from 78.86 on the random split to 71.37 on the adversarial split. This is exactly the bias a run of prior "yes" tokens could amplify.
On the structured-output side, SynCode and GREATGRAMMA supply the method. They are incremental parsers that mask invalid tokens. SynCode reports zero JSON syntax errors on JSON-Mode-Eval, and GREATGRAMMA reports 5–32 ms per-token overhead. We reuse their parser state as a span tracker. mSOP-765k supplies the realistic application: structured extraction from product ads, where frontier models hallucinate attributes that are implicit or not visible. That paper evaluates only single-instance, unconstrained prompting.
Research Program
The work has three stages.
The first stage is a diagnostic. On POPE we batch $b \in \{1,4,8\}$ object questions about the same image into one prompt. This keeps LLaVA-v1.5-7B within its single-image training regime. We decode a constrained JSON array of yes/no answers. For each position we estimate an anchoring coefficient: the change in the probability of answering "yes" when the previous answer was "yes" versus "no", computed within strata of identical ground truth. This conditioning separates contagion from genuine correlation among the questions. We also record the visual attention share per position, in the style of RBD's measurement, and test whether it falls with position. Random permutations of question order give a causal handle. Under contagion, the same question's answer should change with what precedes it.
The second stage is the intervention. A grammar for the array lets the parser label every generated token as belonging to answer span $j$. While decoding span $i$, the attention mask hides the value tokens of spans $j<i$. The structural tokens and index keys stay visible, so the model can still track where it is. Position indices are left unchanged. Masked tokens are cached but never attended to, so the intervention adds no forward passes. One risk is that hiding tokens the model expects to see is itself out of distribution. We test this directly with a control that hides randomly chosen preamble tokens of the same count.
The third stage applies the method to extraction with mSOP-765k. Several ads go into one prompt, using an open multi-image vision-language model, and each ad's output is a schema-constrained record. Here contagion should appear as copied brands, categories, and prices.
Baselines
The naive reference point is single-instance prompting ($b=1$) with constrained JSON output. It has no contagion by construction and pays full preamble cost. It defines the accuracy ceiling we aim to reach and the cost we aim to cut. The second reference is naive batching: the same batch with the same grammar but no mask, following the Q[i]/A[i] design of Batch Prompting rendered as JSON. Comparing these two measures the contagion gap.
The strongest existing competitor for grounding is RBD (Re-Balancing Contrastive Decoding). It reports 88.0% POPE accuracy on LLaVA-v1.5-7B and a CHAIR sentence-hallucination drop from 20.8% to 17.8%. We run RBD on the same model, same POPE splits, and same grammar, using its published hyperparameters, at $b=1$ and inside naive batches. We report accuracy, wall-clock time, and forward passes per answer token. LLaVA Steering reports 88.2 on POPE for LLaVA-3B. That model is different, so we cite it as context rather than as a head-to-head number. We do not have a matching trained steering checkpoint, and we will not claim to beat its figure. For batched vision-language prompting itself, we found no reported result on Lacuna, and for mSOP-765k no per-metric numbers are reported on Lacuna. We therefore establish both baselines ourselves.
The key ablation separates the three channels a batch opens. The first variant hides other answers only (the proposal). The second hides other answers and other questions. The third hides everything belonging to other instances, which is equivalent to independent requests sharing a cached preamble. All variants share decoding settings, grammar, and prompts, and none is tuned on the test splits. Beating the baselines means two things. Our method must close at least most of the gap between naive batching and $b=1$ on adversarial POPE at $b=8$, with no extra forward passes. It must also match or exceed RBD-in-batch accuracy at lower latency. We count it a stronger win if it beats the full-isolation variant, because that would show that seeing other inputs adds value once answers are hidden.
Why not just…?
Why not just use independent requests with a shared prefix cache? This is the most serious threat. Prefix caching gives isolation and amortizes the preamble, with no masking machinery. Our full-isolation ablation is this alternative, run under identical conditions. Suppose it matches answer-only masking on accuracy, and the cost difference is limited to output-side overhead. Then the honest conclusion is that, for vision-language models, batching's value is only cost, and prefix-cached isolation is the right design. We would report that. The proposal survives only if comparison across visible inputs measurably helps, as the entity-resolution findings of Cost-Effective In-Context Learning for Entity Resolution suggest it can.
Why not just shuffle order and vote across permutations? Voting averages out contagion rather than removing it, and it multiplies passes by the number of permutations, which spends the savings batching was meant to bring. We include a three-permutation majority vote as a cost-matched comparison. Our permutation analysis also shows directly whether contagion is symmetric enough for voting to cancel it.
Why not just apply contrastive decoding or steering inside the batch? These methods raise visual reliance in general but leave the earlier answers fully visible. They also add passes, in RBD's case doubling the work per step. If RBD-in-batch closes the contagion gap as well as masking does, the contagion account loses explanatory force. The RBD baseline above tests this. The two approaches also compose, and we report RBD combined with masking.
Why not just use smaller batches? Batch size is a dial in every experiment. We plot accuracy against tokens per answer for $b \in \{1,4,8\}$, with and without masking. The method is worth adopting only if its curve lies strictly above the naive-batching curve.
Proposed Experiments and Decisive Checks
On POPE's random, popular, and adversarial splits with LLaVA-v1.5-7B, we report accuracy, F1, yes-rate, the anchoring coefficient, per-position visual attention share, and parse validity, which should be 100% under the grammar for all methods. On mSOP-765k batches of 1, 4, and 8 ads, we report per-field exact match for brand and category and absolute error for price. We also report a cross-record copy rate: how often a predicted value equals a value predicted for an earlier record in the batch but not that record's ground truth. Token counts and latency are logged throughout.
Four outcomes would settle the claims. First, a positive anchoring coefficient under naive batching that rises with position and is largest on the adversarial split, while staying near zero under answer masking. Second, permutation experiments showing that a fixed question's answer flips with the labels that precede it under naive batching but not under masking. Third, answer-only masking recovering at least most of the $b=1$ adversarial accuracy at $b=8$ while the random-preamble-masking control does not change accuracy. That control result would rule out "any masking helps." Fourth, on mSOP, the cross-record copy rate falling under masking without a drop in fields that legitimately repeat across ads. If the first check fails, meaning naive batching shows no contagion, we would report that the regularizing effect seen by Reasoning Under Constraint carries over to vision-language models. That would also be a useful, publishable answer to the open question.
References
- Batch Prompting: Efficient Inference with Large Language Model APIs
- BatchPrompt: Accomplish more with less
- Reasoning Under Constraint: How Batch Prompting Suppresses Overthinking in Reasoning Models
- Optimized Batch Prompting for Cost-effective LLMs
- Cost-Effective In-Context Learning for Entity Resolution: A Design Space Exploration
- Mitigating Hallucination in Visual-Language Models via Re-balancing Contrastive Decoding
- LLaVA Steering: Visual Instruction Tuning with 500x Fewer Parameters through Modality Linear Representation-Steering
- Investigating and Mitigating the Multimodal Hallucination Snowballing in Large Vision-Language Models
- Evaluating Object Hallucination in Large Vision-Language Models
- SynCode: LLM Generation with Grammar Augmentation
- Flexible and Efficient Grammar-Constrained Decoding
- mSOP-765k: A Benchmark For Multi-Modal Structured Output Predictions