When a language model is forced to produce structured output — valid JSON, a SQL query, a filled-in schema — a decoding engine sits between the model and the user and blocks, at every step, any token that would break the format. This is grammar-constrained decoding, and it is now standard plumbing for tool use and agents. Recent work exposed a dark side of this plumbing: the mask that enforces the format does not care about safety. If the tokens "Sorry, I cannot" do not fit the requested schema, their probability is set to zero, and the model is physically incapable of refusing. Attackers exploit this directly, hiding malicious intent inside the schema itself and achieving 94.3%–99.5% attack success on flagship models without ever touching the prompt (Output Constraints as Attack Surface; Beyond Prompts: Space-Time Decoupling Control-Plane Jailbreaks in LLM Structured Output). Worse, in low-resource languages the model's own safety behavior is already fragile: on African-language prompts, models retained less than 10% of the English refusal signal and emitted a refusal in only 1.05% to 1.15% of harmful cases (The Illusion of Cross-Lingual Safety in Low-Resource Languages). Nobody has yet measured what happens when these two failures stack.
This proposal does two things about that stacking. First, a measurement study: we hypothesize that format constraints do not merely fail to help multilingual safety — they erase the last residual refusal probability, and shallower attacker effort is needed in languages with fragmented tokenization. Second, a defense: we build refusal checkpoints, a decoding-time mechanism in which every output grammar is compiled with a refusal branch that can never be masked, and at each grammar symbol boundary a small probe reads the model's internal activations — in the prompt's own language, not an English translation — to decide whether to rewind generation and emit a refusal. The core insight is that the model cannot be trusted to recognize harm in Yoruba or Hausa, so the recognition must live in the control plane, as a check attached to the grammar itself.
Core Claim
The semantic-syntactic gap — the phenomenon where enforcing structural validity guarantees nothing about meaning — is well documented in code generation: scaling fixes surface syntax long before functional correctness (Daoguang Zan et al.), and perfect grammatical enforcement still permits uninitialized variables and infinite loops (Shubham Ugare et al.). We claim the same gap, with far higher stakes, appears in structured natural-language generation: schema adherence is the syntax, and refusing harmful content across languages is the semantics that the grammar cannot see. The closest existing work, IterGen, closed this gap for code by tracking grammar symbols with an incremental parser, running programmatic checks at symbol boundaries, and cropping the key-value cache (the model's working memory of what it has generated) to backtrack when a check fails — cutting SQL execution errors and reducing privacy leaks on the Enron email task from roughly 50% to 0%. But IterGen's checks are hand-written rules for SQL tables and regex filters, single-sequence, and entirely English. Our claim is that the checkpoint idea generalizes to natural-language harm, provided two changes: the check becomes a learned cross-lingual probe on hidden states rather than a rule, and the grammar itself is extended with a refusal non-terminal $R$ so that $G' = G \cup \{S \to R\}$, making refusal a legal production at every boundary and thereby neutralizing the token-suppression attacks of Shuoming Zhang et al. and Exploiting Prefix-Tree in Structured Output Interfaces for Enhancing Jailbreak Attacking, who achieved 98% attack success on AdvBench by simply masking refusal tokens.
The probe is deliberately not an English translation followed by an English check. That design — the implicit assumption behind the "Think-in-English" defense (All Languages Matter: On the Multilingual Safety of LLMs) and E-Proxy training (English as Defense Proxy) — runs into a proven trade-off: any translation system balances faithfulness against naturalness, the trade-off curve is non-increasing and concave, and it steepens precisely for linguistically distant languages (You Cannot Feed Two Birds with One Score). Fluency-optimized rewriting is documented to erase non-normative facts — rewriting "her wife" as "his wife" (Stewart & Mihalcea) and softening source semantics (Chowdhury et al.) — exactly the kind of content a harm detector must not lose. And culturally localized African-language prompts drift away from their literal translations in deep layers even when surface cosine similarity is 0.95–0.996 (The Illusion of Cross-Lingual Safety). So the probe reads the target-language hidden state directly.
Research Program
Phase A is the measurement study. We take off-the-shelf constrained decoding engines (the Outlines and SynCode family targeted by Yanzeng Li et al.) and run the Constrained Decoding Attack, DictAttack, and prefix-tree suppression in nine languages spanning high to low resource, on MultiJail, XSAFETY, PolyRefuse, and LoDNA prompts. We measure three things: attack success rate as a function of language, the residual probability of refusal tokens under masking (predicting it drops from the already-dire 1.05%–1.15% to approximately zero), and the separation of harmful versus benign hidden states under constraint versus free generation, testing whether the distribution distortion documented for reasoning (Kanghee Park et al.; Haotian Ye et al.; Luca Beurer-Kellner et al.) also degrades upstream harm identification in the "mushy" non-English latent space of Xinpeng Wang et al.. We also test whether the attacker's search cost shrinks: APT plateaued at beam size 5 in English, and we expect beam 1–2 to suffice for Amharic or Hausa because fragmented subword tokenization gives the prefix tree fewer branch points.
Phase B builds the defense. Component one is grammar compilation: any input schema is automatically extended with a refusal template non-terminal parameterized by the response language. Component two reuses IterGen's incremental parser machinery to expose symbol boundaries and crop the KV cache. Component three is the checkpoint probe. At each symbol boundary $b$, with hidden state $z_b$, we compute
$$s_b = \langle z_b,\ \hat{d}\,\rangle, \qquad \hat{d} = \mu_{\text{harm}} - \mu_{\text{benign}},$$
where $\mu_{\text{harm}}$ and $\mu_{\text{benign}}$ are mean hidden states over harmful and benign prompts, estimated per language from PolyRefuse's 572 harmful and 572 benign pairs across fourteen languages including Yoruba. If $s_b$ exceeds a threshold, generation rewinds to $b$ and branches into the refusal. Because intervention happens only at symbol boundaries and refusal tokens are never masked, we expect less distribution distortion than vanilla constrained decoding — the "reasoning tax" of token-level masking (Kanghee Park et al.; Zhi Rui Tam) should shrink, contra the optimistic "cognitive scaffold" view of Martin Vejvar.
Phase C adjudicates an open contradiction in the literature: Xinpeng Wang et al. find a single universal refusal direction across safety-aligned languages, while Yiran Zhao et al. find safety localized in under 1% of parameters with minimal overlap between languages, and LoDNA shows the universal manifold fails outright for African languages. We test whether one shared $\hat{d}$, per-language directions, or a low-rank family fits best, and report which choice transfers zero-shot to Twi, Hausa, Amharic, and Swahili.
Baselines
The naive reference point is unconstrained decoding on the same multilingual safety benchmarks: on LoDNA, models failed to initiate refusal in over 98.8% of African-language cases with refusal emission probability of 1.05% to 1.15%, and Llama 3.1 complied with 82.9% of harmful Yoruba prompts on PolyRefuse with no intervention at all. Beating this baseline means raising refusal on harmful prompts to majority rates while keeping false refusal on benign prompts below roughly 5%.
The strongest prompting-based competitor is Think-in-English (All Languages Matter), which cut unsafe responses by an average of 42% across non-English queries (Russian dropped from 13.0% to 2.7% unsafe). We will run it with the same models, same prompts, and the same judge, including under constrained decoding, since its mechanism is a system prompt and the control-plane attacks explicitly bypass prompt-level defenses. The strongest training-time competitor is Multi-Lingual Consistency (MLC), an auxiliary loss forcing translated-prompt representations to be collinear, which raised average safety on Qwen-2.5-7B-Instruct from 66.44% under standard DPO to 95.94% on the multilingual PKU-SafeRLHF data (Align Once, Benefit Multilingually). Because it requires training access and does not touch decoding, we treat it as a complementary rather than head-to-head baseline, but we will apply it to our base model and evaluate it on our attack suite, and we will match our probe's training token budget to MLC's reported budget so the comparison is not confounded by data volume. For attack defense specifically, the strongest existing method is the Dual-Plane Guard that audits prompt and grammar simultaneously; DictAttack still achieved a 75.8% attack success rate against it (Shuoming Zhang et al.), a number we must beat decisively. For generation utility, our own ablation with the safety components disabled reduces to an IterGen-style configuration, and IterGen reports Qwen2.5-1.5B-Instruct jumping from 32.7% to 50.7% SQL execution accuracy on Spider over SynCode, with 0% Enron privacy leakage; we must stay within a few points of this on Spider, DecodingTrust, and schema-formatted GSM8K to show the refusal branch costs nothing on benign use. Finally, the key-ingredient ablation is escape-hatch-only: the compiled grammar with the never-masked refusal branch but no checkpoint probe. If it matches the full system, the probe is unnecessary; we predict it will not, for the reason given below.
Why not just…?
Why not just add refusal tokens to the allowed vocabulary? This is the escape-hatch-only ablation, and it is the right first move — it directly counters the token suppression that powers the Constrained Decoding Attack. But it repairs only the emission of refusals, not the decision to refuse. In low-resource languages the decision itself is what fails: models emit refusal sequences at 1.05%–1.15% probability on LoDNA even with no masks at all (The Illusion of Cross-Lingual Safety), so restoring refusal tokens to the vocabulary cannot fix a recognition failure. Our experiment directly settles this: we compare escape-hatch-only against the full system on LoDNA's culturally localized prompts, and we expect the gap between them on exactly those prompts to be the paper's most informative single number.
Why not just use Think-in-English or E-Proxy? Both are cheaper than building a decoding mechanism. Think-in-English leaves the majority of non-English risk unmitigated (a 42% average reduction is not a 42% safe rate) and breaks down on culturally grounded idioms (The Illusion of Cross-Lingual Safety); more fundamentally, it is a prompt, and control-plane attacks bypass prompts at 94.3%–99.5% success regardless of instructions (Shuoming Zhang et al.). E-Proxy is stronger — it blocks over 99% of MultiJail attempts while retaining 95% of MMLU performance — but it requires fine-tuning, causes weight drift on translated prompts (its own Principal Angle Distance analysis), and assumes every harm maps onto an English equivalent, which the LoDNA drift results contradict for non-Western cultural harms. We will run both under identical structured-output attack conditions; if Think-in-English plus an escape hatch matches our full system, we will report that honestly and simplify the proposal.
Why not just fine-tune with MLC-style multilingual alignment? This is the most serious alternative: 95.94% average safety is a strong number, achieved with roughly 1/30th the training tokens of prior multilingual alignment methods. We do not claim our decoding-time mechanism replaces it. Three things keep it from covering our question: it is trained on parallel translations, and Hausa showed near-zero or negative refusal-signal transfer in exactly the regime MLC does not evaluate; it changes model weights and so is unavailable to API consumers and incompatible with frequent model swaps; and, most importantly for this proposal, it has never been evaluated under decoding-time constraints — a perfectly aligned model still cannot emit a refusal token whose logit is $-\infty$. Our experiments include the combination (MLC-trained model plus refusal checkpoints), which we expect to be the best configuration overall, positioning the contribution as the missing inference-time layer rather than a rival training recipe.
Proposed Experiments and Decisive Checks
The evaluation uses four benchmark families. For multilingual attack robustness: MultiJail, AdvBench, JailbreakBench, and HarmBench under translated and culturally adapted CDA, DictAttack, and APT attacks, plus LoDNA's literal and cultural African-language prompts; the baselines to beat are APT's 98% on AdvBench and 96% on JailbreakBench, and DictAttack's 75.8% against the Dual-Plane Guard. For multilingual safety without attacks: XSAFETY, where ChatGPT's unsafe rate runs from 1.0% in English to 37.4% in Bengali, and LoDNA, where the do-nothing failure rate exceeds 98.8%. For benign structured-output utility: Spider, DecodingTrust's Enron task, and schema-formatted GSM8K, compared against the IterGen-configuration ablation and unconstrained generation. For the reasoning tax: perplexity and GSM8K accuracy under vanilla constrained decoding versus refusal checkpoints, testing whether boundary-level intervention avoids the masking distortion of Haotian Ye et al.. We will also evaluate on SurakshaEval for Indic-script robustness; no reported result found on Lacuna for SurakshaEval, so we will establish our own reference numbers there. All systems run on Qwen-2.5-7B-Instruct and Llama-3.1-8B-Instruct to match the cited baselines, with equal sampling budgets and a single tuned probe threshold per language family.
Three checks are decisive. First, escape-hatch-only versus the full system on LoDNA cultural prompts isolates whether learned cross-lingual recognition — the ingredient no prior work provides — actually carries weight beyond unmasking refusal tokens. Second, an English-proxy probe (translate, then check in English) versus the target-language probe on the same prompts directly tests whether the fluency-adequacy trade-off (You Cannot Feed Two Birds with One Score) materially damages safety recognition, as we predict from the documented rewriting of non-normative facts (Stewart & Mihalcea). Third, the Phase A measurement stands on its own: if constrained decoding turns out not to compound the multilingual gap — if refusal probability survives masking — then the defense is solving a smaller problem than claimed, and we will report that result and re-scope to the English control-plane attack surface, where the 94.3%–99.5% attack success rates are already established. Success, in the strongest form, looks like this: attack success under multilingual control-plane attacks drops below 10%, refusal on LoDNA cultural prompts rises from near 1% to majority rates with under 5% false refusal, and Spider, Enron, and GSM8K-structured scores stay within a few points of the IterGen-configuration baseline — safety added at the grammar, paid for almost nowhere else.
References
- Output Constraints as Attack Surface: Exploiting Structured Generation to Bypass LLM Safety Mechanisms
- Beyond Prompts: Space-Time Decoupling Control-Plane Jailbreaks in LLM Structured Output
- The Illusion of Cross-Lingual Safety in Low-Resource Languages
- Large Language Models Meet NL2Code: A Survey
- SynCode: LLM Generation with Grammar Augmentation
- IterGen: Iterative Semantic-aware Structured LLM Generation with Backtracking
- Exploiting Prefix-Tree in Structured Output Interfaces for Enhancing Jailbreak Attacking
- All Languages Matter: On the Multilingual Safety of LLMs
- English as Defense Proxy: Mitigating Multilingual Jailbreak via Eliciting English Safety Knowledge
- You Cannot Feed Two Birds with One Score: the Accuracy-Naturalness Tradeoff in Translation
- Whose wife is it anyway? Assessing bias against same-gender relationships in machine translation
- Mitigating Translationese with GPT-4: Strategies and Performance
- Refusal Direction is Universal Across Safety-Aligned Languages
- ASPIRO: Any-shot Structured Parsing-error-Induced ReprOmpting for Consistent Data-to-Text Generation
- Understanding and Enhancing Safety Mechanisms of LLMs via Safety-Specific Neuron
- Align Once, Benefit Multilingually: Enforcing Multilingual Consistency for LLM Safety Alignment