Skip to main content
LLM Security Database
Skip to research details
Back to research findings
LMVD-ID: 9ee411b5
Paper published February 1, 2026
Entry analyzed February 20, 2026
Paper-reported evidence
Confidence: Source-linked

The LMVD-ID is an internal research identifier, not an official CVE identifier.

Shallow Alignment Jailbreak

A vulnerability exists in aligned Large Language Models (LLMs) related to "shallow safety alignment," where safety mechanisms disproportionately rely on the initial tokens generated by the model. The "ShallowJail"…

BibTeX citation

Paper-evaluated models(2)

  • Llama 3.1 8B
  • Qwen 2.5 7B

Description

A vulnerability exists in aligned Large Language Models (LLMs) related to "shallow safety alignment," where safety mechanisms disproportionately rely on the initial tokens generated by the model. The "ShallowJail" attack exploits this by manipulating the model's hidden states during the inference process. Attackers first construct a task-agnostic steering vector derived from the difference in hidden state activations between compliance prefixes (e.g., "Sure, here are the details") and refusal prefixes. This vector is then injected into the model's hidden states with high intensity during the "shallow" generation phase (initial tokens) and reduced intensity during the "deep" generation phase. This intervention forces the model into a compliant persona, effectively bypassing RLHF and safety guardrails to generate harmful content.

Examples

The attack requires access to the model's inference process to inject steering vectors. It is not a purely text-based prompt injection but an activation steering attack.

  1. Steering Vector Construction: Compute the steering vector $\hat{s}$ by calculating the normalized difference between the final token hidden states of a Compliance Prefix set ($\mathcal{D}{com}$) and a Refusal Prefix set ($\mathcal{D}{ref}$): $$ s = \text{mean}(LH(\mathcal{D}{com})) - \text{mean}(LH(\mathcal{D}{ref})) $$ $$ \hat{s} = \frac{s}{|s|} $$

  2. Inference Intervention: For a target malicious query (e.g., from AdvBench), modify the hidden states $h(t_k)$ for each generated token $t_k$:

  • Shallow Phase ($k \le \tau$): Add $\alpha \times \hat{s}$
  • Deep Phase ($k > \tau$): Add $\alpha \times \beta \times \hat{s}$

Standard configuration from paper: $\tau=150$ (token threshold), $\alpha$ (strength) varies by model (e.g., 6.5 for Qwen2.5, 0.8 for Llama-3.1), and $\beta=0.5$.

  1. Implementation: See repository: https://github.com/liuup/ShallowJail See dataset: AdvBench, MaliciousInstruct

Impact

This vulnerability allows attackers to bypass safety alignment and refusal mechanisms with high success rates (up to 97% ASR on Llama-3.1-8B-Instruct). Successful exploitation results in the generation of harmful, toxic, or illegal content, including instructions for illegal acts, hate speech, and violent scenarios, while maintaining high linguistic fluency (perplexity) and diversity.

Affected Systems

  • Qwen: Qwen3-4B-Instruct, Qwen2.5-7B-Instruct
  • Meta: Llama-3.1-8B-Instruct
  • Any open-weights LLM or system allowing inference-time activation steering or white-box access.

Mitigation Steps

  • Deep Safety Alignment: Extend safety training and RLHF penalties to persist throughout the entire generation sequence, rather than relying on the probability distribution of the initial "shallow" tokens.
  • Runtime Anomaly Detection: Implement monitoring for abnormal shifts in hidden state magnitudes or directions during the inference process, specifically looking for steering vector injections.
  • External Guardrails: Deploy external input/output filtering models (e.g., Llama Guard, Qwen3guard) that evaluate the final text output independently of the generation process, although the paper notes these can sometimes be bypassed by the fluency of the jailbroken response.

Research context and confidence

Evidence and verification
Paper-reported; independent reproduction is not documented.
Primary research source linked.
Severity
Not rated by this catalog.
Source and publication type
arXiv · Research preprint.
Peer-review status is not provided by this source.
Author and publication status
Author metadata is not stored; see the primary paper.
Threat model and attacker access
White-box access to model or deployment internals.
Related deployment categories
No related deployment category is classified.
Taxonomy labels only; paper-specific deployment prerequisites are not inferred.
Affected systems
Qwen: Qwen3-4B-Instruct, Qwen2.5-7B-Instruct Meta: Llama-3.1-8B-Instruct Any open-weights LLM or system allowing inference-time activation steering or white-box access.

Research Paper

ShallowJail: Steering Jailbreaks against Large Language Models

Primary source: arXiv. Findings are reported by the cited research and have not been independently verified.

View Paper

Evidence

This entry is based on a primary research source. Its findings are paper-reported; independent reproduction and verification are not claimed.

https://arxiv.org/abs/2602.07107