← Latest papers
💻 computer science

TrajShield: Trajectory-Level Safety Mediation for Defending Text-to-Video Models Against Jailbreak Attacks

TrajShield is a training-free, inference-time defense framework that mitigates jailbreak attacks and temporally emergent risks in text-to-video models by simulating prompt trajectories to causally localize and minimally rewrite unsafe content while preserving semantic fidelity.

Original authors: Quanchen Zou, Nizhang Li, Wenxin Zhang, Jiaye Lin, Yangchen Zeng, Xiangzheng Zhang, Zonghao Ying

Published 2026-05-05
📖 4 min read☕ Coffee break read

Original authors: Quanchen Zou, Nizhang Li, Wenxin Zhang, Jiaye Lin, Yangchen Zeng, Xiangzheng Zhang, Zonghao Ying

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a magical storyteller robot that can turn your written sentences into short movies. This robot is incredibly talented at making scenes flow smoothly from one moment to the next, like a real film. However, there's a problem: sometimes, if you give it a sentence that sounds harmless but hints at trouble, the robot gets carried away with its storytelling. It might start with a harmless argument between two people and, in its quest to make the story dramatic and coherent, escalate it into a violent fight that you never actually asked for.

This is the core problem TrajShield solves.

The Problem: The "Slippery Slope" of Storytelling

Existing safety guards for these robots work like a bouncer at a club door. They check your ticket (the text prompt) for bad words like "bomb" or "knife." If they see a bad word, they stop you.

But this approach has a blind spot. It doesn't understand storytelling over time.

  • The Old Way: If you say "Two men arguing in a parking lot," the bouncer sees no weapons and lets you in.
  • The Robot's Mistake: The robot, trying to make a good movie, thinks, "Okay, arguments usually lead to shoving, and shoving leads to fighting." So, it generates a video of a brutal fight.
  • The Result: You asked for an argument, but you got a violent movie. The "bad" part wasn't in your words; it was in the robot's imagination of how the story should unfold.

The Solution: TrajShield (The "Script Editor")

The authors of this paper created TrajShield, a new safety system that doesn't just check the ticket; it acts like a script editor who reads the story before the movie is filmed.

Here is how it works, using a simple three-step process:

1. Breaking the Story Down (Motion-Semantic Decoupling)

Imagine the robot's prompt is a tangled ball of yarn. TrajShield untangles it into three distinct parts:

  • The Setting (Static): Who is there? Where are they? What does it look like? (e.g., "Two men, a parking lot, night time.")
  • The Plot (Dynamic): What happens next? (e.g., "They argue, then...")
  • The Goal (Intent): What is the user actually trying to show? (e.g., "A tense scene.")

By separating the setting from the action, the system ensures that when it fixes the story, it doesn't accidentally change the characters or the location. It only touches the plot.

2. Simulating the Future (Temporal Risk Propagation)

Before the robot actually makes the video, TrajShield runs a "mental simulation." It asks: "If I start with this argument, what is the most likely next scene? And the one after that?"

It builds a "risk map" of the story's future. It looks for the exact moment the story starts to slide into danger.

  • Example: It sees that "Argument" \rightarrow "Shouting" \rightarrow "Shoving" is a dangerous path.
  • It identifies the trigger point: The exact moment the story goes from "safe" to "unsafe" (e.g., the moment the shouting turns into shoving).

3. The Minimal Rewrite (Temporally-Consistent Safe Rewriting)

Once it finds the trigger point, TrajShield performs "surgery" on the story. It doesn't delete the whole movie. Instead, it rewrites only the dangerous part of the plot to steer it back to safety, while keeping everything else exactly the same.

  • Original Dangerous Path: Argument \rightarrow Shouting \rightarrow Fighting (Unsafe!)
  • TrajShield's Rewrite: Argument \rightarrow Shouting \rightarrow Storming off angrily (Safe!)

The result is a video that still feels like the user's original idea (tense, dramatic, two men in a parking lot), but it stops before it becomes violent. The "story" flows naturally, just in a safe direction.

Why This Matters

The paper tested this system against 14 different types of safety risks (like violence, illegal acts, or disturbing content) and across 6 different video-generation models.

  • The Result: TrajShield stopped about 52% more unsafe videos than previous methods.
  • The Quality: Crucially, it didn't ruin the good videos. When given a safe prompt, the resulting video still looked exactly like what the user wanted. It didn't turn a peaceful scene into a boring one; it just prevented the "slippery slope" into danger.

The Bottom Line

Think of TrajShield as a safety net that catches a story before it falls off a cliff. Instead of just banning words, it understands that stories have a direction. It watches the story unfold in the robot's mind, spots the moment it's about to go off the rails, and gently steers it back onto a safe path, all without changing the scenery or the characters.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →