atlas

Research map / Architectures and efficiency / Attention and transformers

On the Robustness of Transformers against Context Hijacking for Linear Classification

NeurIPS 2025 · Architectures and efficiency › Attention and transformers · approach: Training dynamics of in-context learning · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Theoretically analyzes why deeper linear transformers are more robust to context hijacking in in-context linear classification, showing they implement optimized multi-step gradient descent whose robustness improves with depth and training context length.

Problem

Context hijacking: factually correct but misleading in-context examples can flip LLM predictions; the paper seeks a theoretical understanding of how transformer depth, training context length, and number of hijacking examples affect robustness.

Approach

Models multi-layer linear attention transformers as multi-step preconditioned gradient descent on in-context examples, derives the optimal learning rate and initialization (non-zero mean prior beta*), and uses this to bound classification error under hijacked contexts (boundary-projected, opposite-label examples) as a function of depth L, training context n, and hijack count N.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
increase the number of hijacking context exampleslinear transformers · synthetic test setclassification accuracyHurt
increase transformer depthlinear transformers · synthetic test setclassification accuracyHelped
increase training context lengthlinear transformers · synthetic test setclassification accuracy under hijackingHelped
increase training context lengthlinear transformers · synthetic training setclassification accuracyHelped
increase gradient descent steps while using the corresponding optimal learning ratemulti-step gradient descent · hijacking test distributionoptimization performanceHelped
increase the number of gradient descent stepsoptimal multi-step gradient descent · training-context-length sweepoptimal learning rateHurt
increase training context lengthoptimal multi-step gradient descent · gradient descent experimentoptimal learning rateHurt

Limitations

Experimental setup

Datasets: synthetic Gaussian in-context linear classification data

Metrics: classification error test robust accuracy optimal learning rate

Builds on: linear transformers implement gradient descent context hijacking (Zhang et al.) in-context learning with non-zero mean prior

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy