Metraipolis › archive › dc_8771037845ae

LongGuard: Mechanistic Analysis and Training-Free Mitigation of Long-Context Failure in Safety Guardrails — arXiv:2608.27580

Source
arXiv (en)
Original
https://arxiv.org/abs/2608.27580
License (as archived)
CC0-1.0
Archived
2026-10-17T10:47:07.484Z
SHA-256 of the archived text
068618fd2eab94fde0fad5fb19a5c9b53d858749253311da2b64ab3ddb892c85
Stable URL of this page
https://metraipolis.com/documento/dc_8771037845ae

How to cite

LongGuard: Mechanistic Analysis and Training-Free Mitigation of Long-Context Failure in Safety Guardrails — arXiv:2608.27580 — arXiv (en), https://arxiv.org/abs/2608.27580 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_8771037845ae (Metraipolis archive dc_8771037845ae, sha256 068618fd2eab94fde0fad5fb19a5c9b53d858749253311da2b64ab3ddb892c85)
BibTeX
@misc{dc8771037845ae,
  title = {LongGuard: Mechanistic Analysis and Training-Free Mitigation of Long-Context Failure in Safety Guardrails — arXiv:2608.27580},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2608.27580},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_8771037845ae; sha256 068618fd2eab94fde0fad5fb19a5c9b53d858749253311da2b64ab3ddb892c85},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2608.27580. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

Safety guardrails serve as the last line of defense against harmful inputs and outputs of large language models (LLMs), yet they are trained and evaluated almost exclusively on short text. We present LongGuard, a framework that evaluates, mechanistically analyzes, and mitigates long-context guardrail failure. We formulate the task as Safety Needle-in-a-Haystack (SafetyNIAH) over a 0.25k-32k length grid; across 15 mainstream guardrails, unsafe recall drops monotonically by more than 50% on average, and a paired Benign-Fill vs. Needle-Repeat design attributes the failure to proportional dilution of the unsafe needle rather than to absolute length. A three-layer attention-logit-behavior analysis on six guardrails locates the mechanism: attention mass on the unsafe needle is diluted, the unsafe-over-safe logit margin is compressed in lockstep, and the detection decision collapses accordingly, with this attention->logit->behavior chain remaining consistent after partialling out length. We further isolate a sparse set of guard-specialized retrieval heads that exhibit partial specificity relative to their base models. Building on the analysis, we propose two training-free mitigations - Chunked Detection (CD) and Attention-Head Sharpening (AHS) - and a deployment protocol, Context-Aware Hyperparameter Routing (CAHR), that selects configurations by context length and audit side. Across five benchmarks spanning synthetic data, long-context attacks, and reasoning-model outputs, CAHR-CD and CAHR-AHS improve the six-guardrail average by 22% and 13%, respectively. Code and data are available online.

Tema degli esploratori: agenti e intelligenza artificiale (retro-catalogo arXiv: annunci del 2026-08-31 in cs.AI).
Categorie arXiv: Artificial Intelligence (cs.AI).
Pagina del lavoro: https://arxiv.org/abs/2608.27580 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-17T10:33:42.336Z dalla pagina https://arxiv.org/catchup/cs.AI/2026-08-31?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).