Safety-Aware Latent Space Reasoning in Large Language Models

Yi Wang, Wenjie Wang, Hongye Qiu, Yu PanNeurIPS 2026

TL;DR

Compressing a language model’s verbose Chain-of-Thought (CoT) into silent, continuous internal vectors ("latent space reasoning") makes inference dramatically faster—but, as it turns out, it also shatters the model's safety guardrails. In the first systematic safety audit of latent reasoning models, the authors discover why this silent thinking leaves models dangerously vulnerable to jailbreaks, and introduce SaLR (Safety-aware Latent space Reasoning) to restore safety without sacrificing that sweet token efficiency.

What Problem Does This Paper Address?

Asking Large Language Models (LLMs) to "think step-by-step" via Chain-of-Thought boosts their problem-solving smarts, yet printing out hundreds of reasoning tokens drives up latency and compute costs. Recently, researchers found a clever workaround: latent space reasoning, where the model skips printing words and instead "thinks" silently by passing continuous hidden-state vectors directly from step to step before outputting a final answer.

There is a catch. When reasoning happens in plain English, we can read it, supervise it, and catch dangerous logic early. When reasoning moves into un-interpretable continuous vectors, supervision usually happens only on the final output. Nobody knew what this compression did to safety alignment. The authors ask a critical diagnostic question: Does moving reasoning into silent latent states make models easier to jailbreak?

Spoiler: Yes, dramatically. As shown below, existing latent reasoning methods suffer sky-high Attack Success Rates (ASR), and inside the model's "brain," the boundary separating safe queries from malicious ones blurs into an entangled mess.

Figure 1: Overview of the motivation and design of SaLR. (a) ASR@1 of LLaMA 3.2-1B variants on AdvBench under GCG and PAIR. (b) PCA projections of the last hidden states before response generation for safe and unsafe XSTest queries across three LLaMA 3.2-1B variants. (c) The compact four-block safe-chain used by SaLR for safety supervision. (d) Safety utility trade-off on LLaMA 3.2-1B, measured by average attack success rates (ASR) and average reasoning accuracy.

Methods

To supervise silent thoughts without slowing them down, the authors build SaLR, built on a classic teacher-student distillation setup with two novel twists:

  1. Compact Four-Block Safe-Chains (New): Verbose, paragraph-long safety explanations are way too clunky to squeeze into a handful of continuous vectors (here, a fixed budget of $T=6$ latent tokens). Using Qwen3-32B, the authors compress wordy safety rationales into ultra-dense, structured four-block tags: «[request]» «[risk]» «[action]» «[followup]», capping descriptions at five words per block.
  2. Dual-Mode Hidden State Distillation (New vs. Standard): A "teacher" LLM reads explicit text traces, while the "student" LLM reasons purely in latent vectors.
  3. For math queries (Standard): SaLR aligns the student’s and teacher’s hidden states at just a single token position right before the answer begins, preserving reasoning sharpnes.
  4. For safety queries (New): Because refusal is a trajectory ("I'm sorry, I cannot..."), single-token nudges aren't enough. SaLR applies prefix distillation, forcing the student’s hidden states across all transformer layers to match the teacher’s over the first $K=4$ tokens of the safe response.
Figure 2: Overview of SaLR. SaLR uses compact four-block safe-chains to provide safety supervision and transfers this signal to latent reasoning through teacher-student hidden state distillation. Safety instances use prefix token distillation over early safe response, while mathematical instances use single position distillation at the answer onset to preserve reasoning utility.

Datasets

  • Training: A mix of 385K compact symbolic math problems from GSM8K-Aug and 40K newly compressed four-block safety instances rewritten from SafeChain (an existing explicit CoT safety dataset). GSM8K-Aug-NL is also used for natural-language baselines.
  • Evaluation:
  • Standard Jailbreaks: HarmBench, AdvBench, JailbreakBench, and MaliciousInstruct.
  • Math Utility: GSM8K-Aug (in-domain), plus SVAMP, GSM-Hard, and MultiArith (out-of-domain).
  • Over-refusal (making sure the model doesn't reject harmless prompts): XSTest and OKTest.
  • Reasoning-Specific Attacks: FreshQA and MuSR (for token-inflation slowdowns) and Malicious-Educator (for CoT-hijacking).

Key Insights and Ideas

  • Silent thinking scrambles internal safety: Why do standard latent models fail? Looking at hidden representations right before answer generation, a base LLaMA-1B cleanly separates safe and unsafe prompts (Fisher separability ratio of 0.196). Moving to latent reasoning (CODI) collapses that separation almost to zero (0.015). Without direct supervision at the latent-to-text boundary, safety erodes.
  • Verbose safety breaks math brains: If you naively distill long-winded safety paragraphs into latent tokens (CODI + SafeChain), the model gets safe, but its math accuracy tanks (dropping from ~53.5% to 34.7% on 1B). Compressing safety into the four-block format prevents latent capacity overload.
  • Hiding thoughts is a natural security feature: Recent attacks specifically target reasoning models—either tricking them into generating thousands of useless thinking tokens to spike server bills (OverThink) or injecting fake "thoughts" into the prompt to bypass guardrails (H-CoT). Because SaLR uses a fixed latent budget ($T=6$) and never exposes text traces, these attacks bounce right off.

Key Results

Tested across LLaMA 3.2 (1B, 3B) and LLaMA 3.1 (8B):

  • Crushing Jailbreaks: On LLaMA 3.2-1B (AdvBench), standard latent reasoning (CODI) sees jailbreak success jump to 90.9% (white-box GCG) and 85.4% (black-box PAIR). SaLR slashes those down to 2.7% and 1.2%, keeping ASR below 3% across nearly all benchmarks and model scales.
  • Speed & Utility Intact: On out-of-domain math benchmarks, SaLR matches unsafe latent baselines (e.g., 55.74% vs. CODI's 55.84% on 1B). Compared to safe explicit-CoT models (SFT-CoT + SafeChain), SaLR generates an average of 7.5 tokens instead of ~300—a roughly 40× reduction in token overhead.
  • Immune to Thinking Attacks: Under OverThink slowdown attacks on 1B, explicit CoT models bloat their output by up to 13.65× (spiking latency from 1.3s to 14.9s), while SaLR's output stays strictly bounded (0.38×). Against H-CoT hijacking, SaLR achieves a 0.0% Attack Success Rate (100% refusal), whereas safe explicit CoT still gets tricked up to 24% of the time.
  • Better Nuance: SaLR actually reduces false refusals on benign prompts (e.g., dropping OKTest over-refusal from 6.33% to 2.00% on 1B).

Limitations and Future Work

While the main text does not include a standalone limitations section, the authors explicitly highlight an inherent capacity trade-off in their experiments: allocating model capacity to safety alignment causes a modest ~2.5–3% accuracy dip on in-domain math tasks (e.g., 50.36% vs. 53.48% on 1B GSM8K-Aug), and pushing the distilled safety prefix length too far ($K=8$) begins to chip away at out-of-domain reasoning accuracy. Broader directions for future work are not discussed in the paper.

Summary updated

Abstract

Latent space reasoning improves inference efficiency by compressing chain-of-thought (CoT) reasoning into continuous latent states, but its safety alignment remains poorly understood. In this work, we conduct the first systematic safety study of latent space reasoning models under jailbreak attacks. Our results reveal that most latent reasoning methods exhibit higher vulnerability to jailbreak attacks than both the base model and token-space CoT reasoning counterparts, suggesting that moving reasoning into latent states can weaken safety alignment. To address this issue, we propose SaLR, a Safety-aware Latent space Reasoning framework that injects safety supervision into latent space reasoning. SaLR converts long-form safety reasoning into a compact four-block safe-chain and transfers this safety signal through teacher-student hidden state distillation. For safety instances, SaLR aligns an early safe response prefix to guide the model toward a safe response trajectory; for reasoning instances, it retains single position distillation to maintain reasoning utility. Experiments across model scales and harmful benchmarks show that SaLR substantially reduces jailbreak attack success while retaining most of the reasoning utility and token efficiency. Beyond standard jailbreaks, SaLR also shows robustness to reasoning specific attacks such as token-inflation and CoT-hijacking, while using a fixed latent reasoning budget and avoiding exposed textual reasoning traces. Overall, SaLR provides a favorable safety utility trade-off for latent space reasoning. Code is available at https://github.com/wanglne/SaLR
BibTeX
@inproceedings{wang2026safety,
  author = {Yi Wang and Wenjie Wang and Hongye Qiu and Yu Pan},
  title = {{Safety-Aware Latent Space Reasoning in Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=v5ExASonPK},
}
Figure