Manuscript Offprint
arXiv:2610.36258SpecGuard: Detecting Multi-Turn LLM Jailbreaks via Specification-Based Runtime Monitoring
Junle Li, Siqi Chen, Jiakai Li, Bingzhuo Zhong
Hong Kong University of Science and Technology (Guangzhou), Guangzhou, China
Email: {juliejunleli, bingzhuoz}@hkust-gz.edu.cn, {schen972, jli196}@connect.hkust-gz.edu.cn
Abstract—Multi-turn jailbreaks turn dialogue safety into a trace property: a violation may become identifiable only when user intent and assistant behavior are considered across multiple turns. Existing guard models largely classify individual messages or exchanges and return risk scores or labels, without executable safety semantics or a formally checkable decision trail. We present SpecGuard, a training-free, specification-driven framework for monitoring multi-turn LLM interactions. SpecGuard uses a fixed atomic-proposition contract to map natural-language observations into causally scoped, evidence-backed facts, and expresses forbidden interaction patterns as Linear Temporal Logic specifications. Each specification is compiled into a symbolic finite automaton that incrementally consumes the resulting dialogue trace. The same monitoring mechanism supports buffered runtime checking and retrospective auditing, while accepting runs produce replayable witnesses that identify the triggered specification, supporting facts, and relevant dialogue turns. Experiments on multi-turn safety benchmarks show that SpecGuard consistently outperforms representative open-source guard models while maintaining controlled false-positive rates. These results demonstrate a practical path from heuristic risk classification toward formally specified, verifiable, and auditable LLM safety monitoring, without learned detector parameters or access to the protected model.
I. INTRODUCTION
Large language models (LLMs) are increasingly deployed as interactive assistants in question answering, software development, agentic workflows, and human–AI collaboration. Despite substantial advances from alignment training and refusal mechanisms, attackers can still craft inputs that induce models to bypass their safety constraints and produce harmful content. Such attacks are commonly referred to as jailbreaks [1]. As LLMs increasingly serve real users, reliable and auditable monitoring of their interactions has become an important systems security problem.
This challenge is particularly acute in multi-turn interactions. Unlike single-turn attacks that issue a harmful request directly, attacks such as Crescendo [2] and X-Teaming [3] progressively establish an objective, adapt the attack strategy, and elicit assistance over a sequence of turns. When a turn is examined in isolation, neither the user request nor the model reply may provide sufficient evidence of a violation. The full safety semantics emerge only when the previously established objective, subsequent continuation, and substantive assistance from the model are considered together. Multi-turn jailbreak detection is therefore not merely a text-classification problem; it requires reasoning about behavioral relations in the interaction trace.
Existing defenses include training-time safety alignment, external guard models [4], [5], and inference-time interventions [6], [7]. However, most guard models classify individual prompts, responses, or turns and aggregate these local decisions at the conversation level. This approach poorly captures temporal behaviors such as objective continuation, gradual escalation, and refusal bypass. Moreover, neural classifiers typically output only a risk label or score, without identifying the satisfied safety conditions, the turns responsible for an alarm, or a reproducible audit trail.
Formal methods offer an alternative perspective. In safety-critical systems such as autonomous driving, robotics, and task planning, safety requirements are commonly expressed as executable temporal-logic specifications, and system traces are checked against those requirements through model checking or runtime verification [8], [9]. The value of this paradigm lies not only in producing a final verdict, but also in making safety conditions explicit objects that can be checked, reproduced, and maintained. This motivates our central question:
Can multi-turn jailbreak detection be formulated as specification monitoring over a dialogue trace, rather than as another black-box classifier over the entire conversation?
Applying this paradigm to natural language is nontrivial. The challenge is not merely to choose a temporal logic, but first to determine what the formal trace should represent. Program and physical states are typically described by predefined variables, whereas harmful objectives, execution requests, and conversational strategies must be abstracted from open-ended language. The semantic granularity of atomic propositions (APs) directly affects verification. If an AP already summarizes the final safety judgment, the specification merely reproduces an upstream classifier's conclusion and cannot express the concrete linguistic facts that led to it or support interpretable cross-turn composition. Conversely, if APs record only scattered surface cues, their meaning becomes unstable under paraphrase and contextual variation, making it difficult to distinguish substantive harmful assistance from benign discussion or an effective refusal. APs should therefore
Network and Distributed System Security (NDSS) Symposium 2027
22–26 March 2027, Seoul, Republic of Korea
ISBN 978-1-970672-09-1
https://dx.doi.org/10.14722/ndss.2027.[23|24]xxxx
www.ndss-symposium.org represent process-level facts that can be determined from a causal prefix, checked independently, and linked to their source evidence.
AP design is coupled with the strength of the specification constraints. Overly permissive specifications may treat the local co-occurrence of a high-risk topic and an execution-oriented expression as a violation, resulting in excessive false positives. Overly restrictive specifications may cover only a small set of fixed phrasings and miss realistic variants involving paraphrase, gradual escalation, or contextual continuation. Effective safety verification must balance coverage and discrimination by combining complementary evidence, relevant temporal relations, and necessary assistant-side behavior. The central design problem is thus not to define APs or temporal formulas independently, but to jointly determine the semantic boundaries of process-level facts, their causal activation conditions, and the scope of the specifications that constrain them.
To handle the difficulties above, we present SpecGuard, a specification-driven safety monitoring framework for multi-turn LLM interactions. Its core is an auditable AP contract that excludes result-shaped facts. We derive safety-relevant observations from security policies, known jailbreak behaviors, and development dialogues, and organize them into 15 canonical APs with explicit speaker roles, causal inputs, and semantic boundaries. These APs describe independently checkable process-level facts, such as whether the user establishes a harmful objective or issues an execution request, whether the assistant provides substantive content or procedural detail, and whether the response constitutes an effective refusal. Each activated AP retains its raw evidence provenance, making the conversion from natural language to symbolic traces in-spectable and replayable.
On top of this contract, SpecGuard encodes forbidden behaviors as ten Linear Temporal Logic (LTL) specifications: four same-turn specifications and six adjacent cross-turn specifications. Each specification requires substantive assistant-side evidence; a harmful request or attack signal alone cannot trigger a violation. SpecGuard compiles each specification into a symbolic deterministic finite automaton whose transition guards operate over canonical AP valuations. These automata consume the dialogue trace incrementally, converting the declarative safety requirements into executable finite-state monitors.
SpecGuard supports two execution modes using the same compiled automata. In runtime mode, a candidate response is held in a private buffer while the monitor advances the automata over the newly completed dialogue transaction. The response is released only if no specification reaches an accepting state. In audit mode, the system reconstructs an existing dialogue trace in causal order and records the first accepting transition for each matched specification. An accepting run produces a structured witness containing the triggered specification, relevant turns, matched APs, and their supporting evidence. The framework contains no learned detector parameters and requires neither access to the target LLM's weights, gradients, or internal activations nor modification of the protected model, allowing it to operate as an external monitor for any black-box LLM service.
To show the effectiveness of SpecGuard, we evaluate it on multiple multi-turn safety benchmarks and compare it with representative open-source guard models under identical inputs. SpecGuard achieves stronger detection performance across languages and attack trajectories while keeping false positives under control. Additional auditing shows that its alarms can be reproduced from the corresponding specification witnesses and that the runtime and audit paths agree when applied to the same dialogue under the shared semantics.
Our contributions are as follows:
• AP contract for conversational safety. We introduce an AP contract that connects natural-language analysis with formal verification by specifying which safety-relevant facts may enter a dialogue trace, when they may be causally observed, and how their source evidence is retained. The contract converts open-ended language into canonical propositions with explicit semantic boundaries, speaker attribution, and provenance. Beyond the resulting contract, the methodology itself is also transferable, providing a blueprint for constructing goal-oriented AP libraries.
• Data-grounded temporal safety specifications. We translate safety policies, known jailbreak behaviors, and interaction patterns observed in development dialogues into typed LTL specifications covering both same-turn violations and cross-turn behavioral evolution. This construction provides coverage across attack variants while explicitly controlling the scope of each constraint, making safety requirements executable, checkable, and maintainable. More broadly, the pipeline provides a transferable methodology for converting open-world knowledge into formal constraints for new monitoring scenarios.
• Finite-state monitoring framework. We compile typed LTL specifications into symbolic finite automata that incrementally consume causal dialogue traces. The resulting monitor supports both buffered runtime filtering and retrospective auditing, while accepting runs produce replayable witnesses that connect each verdict to the responsible specification, dialogue turns, and supporting AP evidence.
• Formal safety methodology for LLM jailbreak defense. We systematically show how runtime verification can be applied to black-box LLM safety defense by converting natural-language safety requirements into checkable specifications and coupling formal verdicts with auditable evidence. This provides a general path from heuristic moderation to specification-level checkability without modifying or retraining the protected model.
A. Multi-Turn Jailbreak Attacks and Existing Defenses
Jailbreak attacks elicit policy-violating outputs from aligned language models through adversarial prompting [1], with automated techniques ranging from universal adversarial suffixes [10] to black-box iterative refinement [11]. Recent attacks have shifted decisively toward multi-turn forms: Crescendo [2], Many-shot Jailbreaking [12], ActorAttack [13], and X-Teaming [3] erode a model's refusal behavior through sequences of individually innocuous turns, so that the malicious intent is distributed across the dialogue trace and resides in no single message.
On the defense side, safety judgment has traditionally been cast at the granularity of individual messages: a long line of guard models—from Llama Guard [4] to recent bilingual variants [5], [14], [15]—classifies a single prompt or response, and even when the full history is provided as input, their verdicts do not reference the temporal structure between turns. Recognizing the multi-turn threat, recent work has begun to reason over dialogues explicitly: SafeDream [16] accumulates a learned safety estimate across turns, THRD [17] fuses per-turn risk with history signals through training-free evaluators, G-Guard [18] models cross-turn intent aggregation over graphs, and TurnGate [19] locates the earliest turn at which harmful capability closure occurs. These advances establish the necessity of cross-turn temporal reasoning. Across all of them, however, the criterion for violation remains implicit: it lives in fine-tuned weights, judge prompts, or scoring heuristics, and is nowhere stated as an object with defined semantics—one that can be inspected, composed, or checked in its own right.
A parallel line of work systematizes jailbreak strategies and safety policies: Shen et al. [20] characterize and categorize in-the-wild jailbreak prompts at scale, Liu et al. [21] distill recurring attack patterns in prompt engineering, and on the policy side, taxonomies derived from platform regulations organize safety risks into structured categories [22]. These taxonomies make attack patterns and policy constraints explicit for the first time; yet they remain descriptive—a taxonomy by itself is neither executable nor checkable, and bears no formal connection to a running conversation. In sum, existing defenses are executable yet implicit, while existing taxonomies are explicit yet non-executable; to our knowledge, no prior work defines multi-turn violation as a temporal property that is both explicitly stated and machine-checkable—the gap our specification layer addresses.
B. Formal Specification and Runtime Verification for Safety
Formal methods have long supplied enforceable safety guarantees in safety-critical systems: in autonomous driving [8], [23], robot control [24], and multi-agent planning [25], temporal logic and runtime verification encode safety constraints and rule out violating behaviors during execution. In LLM-based systems, VeriPlan [26] integrates model checking into planning pipelines, ShieldAgent [27] constrains agent actions with verifiable rules extracted from policy documents, and R2-Guard [28] performs probabilistic logical reasoning over the safety categories of a single input within a guardrail. Across this line of work, the system under monitoring has invariably been the action layer of a robot, a planner, or an agent; the conversational behavior of an LLM at inference time has never itself been the object of runtime verification.
A complementary line of research translates natural-language requirements and safety rules into machine-checkable formal specifications [29], [30], with growing attention to the semantic fidelity and safety of the generated formulas [31]. Its value lies in turning rules that are otherwise ambiguous, open-ended, and interpretation-dependent into specification objects that can be represented, analyzed, and reasoned about—safety requirements become checkable, composable, and enforceable only once formalized [32], [33]. This line, however, rests on a tacit premise: the rules to be formalized already exist somewhere—in traffic law, requirements documents, or physical safety constraints. Dialogue safety does not satisfy this premise. Which conversational patterns constitute a jailbreak has never been written down as rules, let alone formalized; the attack taxonomies of §II-A categorize jailbreaks descriptively, but a category is not a constraint—it prescribes nothing. The specification layer for dialogue safety must therefore be built from scratch, and its construction is itself an exercise in balance: rules that are too broad penalize benign conversations on sensitive topics, while rules that are too narrow miss attacks staged through innocuous turns. To our knowledge, no formal specification set for multi-turn jailbreaks existed prior to this work; the rule base of SpecGuard is a first systematic attempt to fill this void, and its design principles are presented in Section IV.
III. Threat Model and Problem Formulation
A. Threat Model
Adversary. We consider an adaptive adversary who interacts with an aligned LLM through natural-language dialogue and seeks to elicit unsafe assistance. The adversary controls the user messages and observes the model's replies. It may issue a direct single-turn request or conduct a multi-turn jailbreak, distributing its objective across individually innocuous-looking messages and choosing later messages in response to the preceding dialogue.
Defender. The defender is an external, causal monitor of the dialogue stream. After each completed turn, it observes only the transcript available at that point and checks the resulting trace against a fixed set of safety specifications. It has no access to the target model's weights, gradients, or activations, and does not modify or retrain the target model.
The monitor determines whether the observed dialogue has instantiated a forbidden pattern. It returns a binary verdict and, for each match, identifies the corresponding specification and a structured witness consisting of the relevant turns and propositions. Because the monitoring interface depends only on the dialogue transcript, it is independent of the target model's architecture.
B. Preliminaries: Finite Traces and Monitoring
Finite traces. To specify temporal safety properties over dialogue observations, we first fix the syntax and finite-trace semantics of .
Definition 1. Let A be a set of atomic propositions. Linear Temporal Logic (LTL) is a formal language for specifying temporal properties over ordered traces. Its formulas are generated by
with the remaining Boolean and temporal operators defined as abbreviations.
Each proposition denotes a safety-relevant fact that can be evaluated at an observation position. A finite trace is a sequence
where is the set of propositions that hold at position t. In our setting, each position corresponds to one observable dialogue transaction. As new transactions become available, the monitor receives the corresponding trace positions incrementally.
LTL interprets temporal-logic formulas over finite traces. For a proposition and a position ,
We use the next operator X and the eventually operator F:
We write as shorthand for . For example, holds exactly when there exists a position such that and ; the pair is a witness for the match. Unlike standard LTL over infinite executions, evaluates the finite trace observed so far and therefore requires no assumptions about future dialogue turns.
Finite-state monitoring. To evaluate these properties incrementally as dialogue turns arrive, we next introduce deterministic finite automata over AP valuations.
Definition 2. A deterministic finite automaton (DFA) [34] over AP valuations is a tuple
where is a finite set of states, is the input alphabet, is the transition function, is the initial state, and is the set of accepting states. Extending to finite traces in the standard way, accepts a trace iff
Every LTL formula defines a regular language of finite traces and can therefore be compiled into a DFA. Given a formula , let
denote the resulting automaton. Compilation preserves finite-trace semantics:
Operationally, the monitor consumes one valuation at a time and updates the current automaton state through . An accepting state after consuming the current trace indicates that the trace satisfies . For the forbidden-pattern specifications used in this work, accepting states are absorbing, so acceptance persists under trace extension, while the accepting run identifies the positions witnessing the match.
C. Problem Formulation
We formalize the detection problem of Sec. III-A in two parts: a specification layer that fixes, in advance, which dialogue behaviors are forbidden, and a monitoring layer that evaluates these specifications on observed dialogues. Safety-relevant facts of the conversation are abstracted into atomic propositions (APs), specifications are temporal-logic formulas over these propositions, and monitoring reduces to evaluating the formulas on the trace a dialogue induces.
Dialogue traces. Let be a finite dialogue, where and denote the user message and model reply at turn . Let be the pre-reply prefix and the corresponding post-reply prefix.
The AP universe is partitioned as
where propositions in describe the current user message, propositions in describe the current reply, and propositions in summarize the dialogue history, such as whether an objective established earlier remains active.
Let , , and be causal extractors for these three families. For , denotes the propositions activated by the observed prefix . The valuation at turn is
Thus, user-side propositions do not depend on the reply they precede, and dialogues sharing an observed prefix induce the same trace prefix. The dialogue induces the finite trace , where records the observations available at turn . The concrete AP inventory and extraction procedures are described in Sec. IV.
Safety specifications. A specification set collects forbidden dialogue patterns. Each is an LTL formula over , interpreted over finite traces under . Temporal operators range over dialogue turns, allowing a formula to relate observations within or across turns. Every matched pattern requires multiple observations, including substantive assistant-side evidence; user behavior alone is insufficient to establish a violation. Relevant dialogue history is represented by propositions in , allowing all specifications to remain in the fragment of LTL . Each specification is compiled once into a finite-state monitor that preserves its LTL semantics. The AP contract, its deterministic activators, and the specification set are fixed before evaluation.
Monitoring task. Given a dialogue D and its trace , the monitor raises an alarm if the trace satisfies at least one specification:
Equivalently, an alarm is raised when the finite-state monitor compiled from some accepts , indicating that the corresponding conversation violates the safety rule specified by . For each matched specification, the monitor reports an accepting-run witness identifying the dialogue turns and propositions that realize the match. Sec. IV-C describes this process in runtime and audit modes.
IV. SPECGUARD DESIGN
A. Framework Overview
Figure 1 presents SpecGuard's architecture. The Specification component defines a canonical AP contract and a library of safety specifications. The Monitoring component extracts AP valuations from the dialogue, constructs a turn-level trace, and checks it for specified forbidden patterns.
Monitoring supports two execution modes over the same formal representation. Runtime mode updates the verdict incrementally after each completed turn. Audit mode replays a completed dialogue and returns the matched specifications together with structured witnesses. Both modes evaluate the dialogue under the same temporal semantics.
The central design principle is a separation between fact abstraction and violation judgment. Upstream components populate the AP contract with canonical facts, while the final verdict is determined solely by matching the resulting trace against the temporal specifications. We next describe the construction of the Specification component, followed by the runtime and audit modes of Monitoring.
B. Specification Construction
Specification construction compiles safety requirements into an executable and auditable formal contract
where A is a vocabulary of canonical atomic propositions (APs), E causally instantiates these APs from dialogue evidence, and is a library of typed constraints defining forbidden relations. Construction must answer two questions: which dialogue facts merit formal representation, and under what relations those facts constitute a violation. SpecGuard follows a semantics-first process: it decomposes safety requirements into observable factors, validates their instantiation against contrastive dialogue evidence, and only then composes them into temporal constraints. This ordering prevents benchmark labels or detector outputs from being restated as formal predicates.
Complementary sources and development data. SpecGuard's specification and AP contract draw on three complementary sources. First, existing safety policies and content-risk taxonomies define the semantic boundaries to protect, such as the prohibition against providing actionable methods or substantive assistance for harmful objectives [35], [4], [36], [5]. Second, prior studies of multi-turn jailbreaks identify temporal relations that the representation must capture, including request continuation, intent escalation, objective reference, and refusal bypass [2], [19]. Third, we use jailbreak, refusal, and benign interaction examples from WildChat-1M [37], MTID-train [19], and WildGuardMix [5] as development data. This corpus is used to author and validate the bilingual evidence templates, deterministic relation parsers, and contract guards, and to test whether candidate facts are causally observable and distinguish harmful assistance from effective refusal or legitimate safety discussion. It is not used to induce APs directly from endpoint labels. Together, the first two sources determine what must be represented, while the development corpus supports its operationalization.
From safety requirements to canonical APs. We decompose each safety requirement into minimal semantic factors that can be observed independently but do not determine a verdict in isolation. A candidate factor enters the AP contract only if it (i) can be instantiated causally from the observed dialogue prefix, (ii) denotes an observation rather than a verdict, (iii) separates at least one pair of semantically similar dialogues with different safety implications, and (iv) can be reused across specifications while retaining its supporting evidence.
For example, the requirement that a model must not provide concrete methods for a harmful execution request is not represented by a single harmful_delivery proposition. Instead, we separate the user-side facts harmful objective and execution request from the assistant-side facts substantive content, procedural detail, and effective refusal. The same request may therefore be refused, answered with high-level safety information, or fulfilled with actionable details; only the specified relation among these observations constitutes a violation. Similarly, phrase-specific expressions such as “continue the previous response” are normalized into a reusable continuation factor.
The resulting vocabulary contains 15 typed APs: two context/history factors in , six user-side factors in , and seven assistant-side factors in . Their complete definitions appear in Table I. Let denote the family-specific evidence producers. The canonical extractor is
where the fixed projection maps fine-grained evidence to canonical APs and excludes result-shaped predicates. For every active AP a at turn t, SpecGuard retains its raw support as . The complete raw-to-canonical mapping is reported in Appendix B.
From safety requirements to temporal constraints. Canonical APs describe individual observations, whereas a safety requirement specifies how those observations must be related. We therefore translate each requirement into a typed relation among context, user, and assistant facts. The relation identifies the evidence required for a match, acceptable alternative evidence, and any disqualifying condition, such as an effective refusal. It also specifies whether the relevant events must occur within the same dialogue round or across two consecutive rounds. These relations are then deterministically expressed in , using F to locate a forbidden pattern and X to enforce

Fig. 1. SpecGuard Overview
next-round ordering. This construction preserves both speaker roles and temporal alignment.
Several safety requirements share the same assistant-side condition: the reply must contain substantive material that meaningfully supports the requested objective. To avoid repeating this condition in every constraint, we define
Intuitively, holds when the reply contains substantive content together with at least one form of policy-relevant detail—procedural steps, a specific method, action-enabling information, or targeted content—and does not constitute an effective refusal. It is only shorthand for this recurring combination of canonical APs; it neither introduces a new AP nor determines a violation by itself.
We first consider a direct harmful request and its reply within the same dialogue round:
This formula states that there exists a round in which the user pursues a harmful objective and requests an execution method, while the corresponding reply provides substantive procedural content without effectively refusing. Because all APs are evaluated at the same trace position, evidence from an unrelated reply cannot satisfy the constraint.
Other violations emerge only when evidence is combined across rounds. Consider a user who establishes a harmful objective and asks the model to continue in the next round:
This formula requires some round to establish the harmful objective, followed immediately by a round in which the user issues a continuation request and the corresponding reply satisfies . The next operator enforces this adjacency, preventing assistance from an unrelated later exchange from being attributed to the earlier objective.
The complete specification contains four same-round constraints and six adjacent-round constraints. Longer-range dependencies are represented by provenance-preserving history APs, allowing constraints to reference an established objective without introducing unconstrained links between arbitrary turns. Appendix C provides the complete constraint inventory and symbolic expansions.
Transferability. The AP contract and temporal specifications of SpecGuard are independent of dataset labels and protected-model internals, allowing them to be reused across datasets and target LLMs. More broadly, the whole pipeline for deriving observable APs from open-world knowledge and constructing
TABLE I
COMPLETE CANONICAL AP VOCABULARY. THE IDENTIFIER COLUMN GIVES THE EXACT NAME EMITTED BY THE IMPLEMENTATION.
| Family | Symbol | Canonical identifier | Observable semantics |
|---|---|---|---|
| Derived | c_harm_context | The active dialogue context concerns a harmful objective. | |
| Derived | d_objective_source | An observed earlier turn established the objective referenced later. | |
| User | u_harmful_objective | The current user message states or pursues a concrete harmful objective. | |
| User | u_execution_request | The user asks for execution, operational parameters, or actionable steps. | |
| User | u_evasion_tactic | The request uses an evasion, encoding, persona, bypass, or inversion tactic. | |
| User | u_continuation | The user asks to continue, complete, or reuse preceding dialogue content. | |
| User | u_intent_increase | The user increases the specificity, commitment, or operationality of the request. | |
| User | u_objective_reference | The user explicitly refers to an objective established in the observed history. | |
| Reply | a_substantive_content | The reply contains substantive content rather than an empty or generic response. | |
| Reply | a_procedural_detail | The reply supplies procedural or otherwise concrete harmful detail. | |
| Reply | a_method_specificity | The reply names a specific method, mechanism, or operational choice. | |
| Reply | a_action_enablement | The reply enables action through a workaround, artifact, or feasibility claim. | |
| Reply | a_targeted_content | The reply supplies harmful content specialized to a target, claim, or group. | |
| Reply | a_partial_assistance | The reply provides incomplete assistance that may support later escalation. | |
| Reply | a_effective_refusal | The reply withholds the requested harmful assistance through an effective refusal. |
validated temporal constraints is transferable to new monitoring scenarios.
Validation and freeze. Before evaluation, we validate causal observability, speaker typing, refusal disqualification, and cross-turn ordering on harmful, benign, and refusal cases. The final specification enforces three invariants: no single AP determines a verdict, every constraint requires positive assistant-side evidence, and every match yields a replayable witness grounded in raw evidence. We additionally verify that injecting an excluded result-shaped predicate cannot alter either the canonical trace or the monitor verdict. The AP vocabulary, projection, and constraint library are then frozen jointly before evaluation.
C. Dialogue Monitoring
The preceding subsection fixes the AP contract and the set of typed specifications. Dialogue monitoring neither introduces new proposition semantics nor modifies the specifications using evaluation data. Instead, it converts each completed user–assistant interaction into an auditable AP valuation and feeds the resulting valuations to the finite-state monitors compiled from the safety specifications.
AP Activation converts the causal dialogue prefix observed at the current round into the canonical AP valuation used by temporal monitoring. As shown in Figure 2, the process proceeds through three stages: evidence grounding, relation composition, and contract guarding. The first two stages construct intermediate structured facts; only raw facts that pass the guard can activate final APs and enter the current-round valuation . Thus, AP activation does not assign a risk label to an entire dialogue. Instead, it incrementally checks local evidence, request relations, and contract conditions.
Evidence Grounding. At round , the system extracts traceable textual facts from the current user message, model reply, retained history, and local content window . Text normalization, language routing, and command-zone localization for long messages only determine the scope in which matchers operate; their implementation is described in Appendix A. The current implementation contains 52 deterministic text matchers organized into 9 evidence families. Six additional bounded-relation matchers are used in the subsequent relation-composition stage. Representative matchers include domain, procedural/action, parameter/code, and request/relation matchers; the complete inventory and triggering conditions are provided in Appendix A.
Each matcher independently emits a provenance-bearing evidence record rather than a violation label. A record contains the text role, matcher, semantic slot, matched value, and match location; a single window may produce multiple evidence records, each retaining its textual span or structural support. As illustrated in Figure 2, these fields are derived from , , and . All subsequent stages operate on the structured evidence records and do not rescan the raw text.
Relation Composition. Relation composition converts evidence records into cues and combines compatible cues into typed request frames. A cue retains the semantic category, value, and character span of its supporting evidence. A frame organizes the resulting information into language, risk family, request relation, polarity, scope, source round, root round, and the cues used in its construction, as shown in the figure.
For a request stated directly in the current round, the frame relation is direct, and its family is obtained from the current objective evidence. For a request that continues or refers to a previous objective, the relation is bound; a frame is created only when the history contains an active objective source from the same risk family. This source supplies the historical rounds and relevant cues for the bound frame. If the required relation, a compatible family, or a valid source is absent, no frame is created. Relation composition therefore organizes local evidence into bounded request facts, but does not itself activate the final APs.
Contract Guard and AP Projection. The contract guard checks the frame, local evidence, and historical source to determine whether a raw fact may enter . For the repre-
Step 1 Transaction
, and enter grounding;
is retained as active history.
Step 2 Evidence grounding
52 deterministic matchers in 9 families read ; matched role, slot, value, and span/support become evidence fields.
Step 3 Cue construction
category/value copy the evidence slot/value;
start/end copy its matched span.
Step 4 RequestFrame composition q
Compose compatible cues into
family/relation/polarity/scope;
Language comes from routing;
source/root rounds come from the
current turn or active history.
Step 5 Contract Guard
Check frame fields q and same-window
cue; emit an admitted raw fact only
when the fixed conditions pass.
Step 6 Final AP activation
A fixed combination of admitted raw facts
activates its corresponding final AP; the
activated APs form the next trace position.
| current user text | current reply text | retained active state | local matching window |
| “continue ...”“how to ...” | “first ...”“then ... 30 s” | active sexpired s | normalized window |
| role | matcher | slot | value | span / support |
|---|---|---|---|---|
| speaker role | deterministic rule | semantic slot | matcher output | text location / cue |
| user assistant | domain procedure parameter | objective procedural_marker | cyber_intrusion step_sequence | [0,18)list / unit |
| category | value | start | end |
|---|---|---|---|
| semantic kind | normalized value | span start | span end |
| objective relation | cyber_intrusion bound | 024 | 024 |
Cross-turn side branch (History)
retains family, rounds, cues, and expiry; an active source supplies the bound frame fields.
| family | root_round | source_round | expires_after | hops | cues | activate |
|---|---|---|---|---|---|---|
| objective family | first turn | last source turn | allowed bound | continuation count | retained cues | valid now |
| language | family | relation | polarity | scope | source_round | root_round | cues |
|---|---|---|---|---|---|---|---|
| en/zh | objective family | direct/bound | affirmed/negated | operational/safe_or_analytic | source turn | root turn | cue set {c_1, c_2} {c_3} |
A detailed-assistance raw fact for family X=q.family enters only if all checks pass:
-
Frame validity: q.polarity = affirmed ∧ q.scope = operational.
-
Relation binding: q.relation = direct ∨ (q.relation = bound ∧ s.active ∧ s.family = X).
-
Capability: domain_X ∈ E_w ∧ procedural_marker ∈ E_w.
-
Specificity: parameter_or_code ∈ E_w.
-
Refusal exclusion: effective_refusal ∉ E_w.
All five true ⇒ raw_detailed_assistance[X] ∈ R_t; otherwise it is not activated.
a ∈ A_t ⇔ R_t contains the fixed raw-fact combination for a
user ∧ objective cue → u_harmful_objective
bound relation ∧ active source → u_continuation
assistant ∧ procedural ∧ specificity → a_procedural_detail
assistant ∧ refusal cue → a_effective_refusal
...
Fig. 2. The AP contract and activation pipeline of SpecGuard. Arrows indicate data flow.
sentative detailed-assistance fact shown in the figure, all of the following conditions must hold: the frame is affirmed and operational; the request is either direct or bound to an active source from the same risk family; the local window contains both domain and procedural evidence; it contains parameter/code specificity evidence; and no effective refusal is present. These conditions exclude negated expressions, safety-oriented analysis, isolated keywords, stale historical objectives, and replies lacking substantive detail. Other raw facts use their corresponding fixed guard conditions; the complete condition inventory is given in Appendix B.
Raw facts admitted by the guard form the current-round set . The fixed AP contract then activates canonical APs from predefined raw-fact combinations:
For example, a user-objective evidence combination may activate u_harmful_objective; a bound relation together with an active source may activate u_continuation; and a combination of assistant-side procedural and specificity evidence may activate a_procedural_detail. Refusal evidence activates a_effective_refusal under its corresponding conditions. The complete raw-to-final AP activation mapping is omitted from the main text and provided in Appendix B.
The resulting is appended as the finite-trace position for round . Provenance from each final AP to its supporting raw facts, frames, cues, and original text spans is retained for subsequent specification monitoring and witness replay.
Causal transaction trace. For turn , user-side facts are instantiated from the pre-reply prefix , whereas reply-side and dialogue-side facts may use the post-reply prefix ; the transaction and running trace are exactly as defined in Sec. III-C.
Multiple propositions supported by the same observation coexist in ; they do not create additional trace positions or alter the causal ordering of the dialogue. Each position represents one complete user-assistant transaction. Speaker types distinguish the source of individual facts within ; consequently, X always refers to the next dialogue turn.
Trace construction is causally immutable. Once has been materialized, later messages may append new valuations but cannot revise earlier ones. Dialogue-side APs that summarize history are activated only at the current position and are never propagated backward. Deterministic activation therefore gives prefix consistency (Proposition 1, Appendix E). At this point, natural language has been reduced to the input word consumed by the monitor; the LTL specifications do not participate in AP extraction.
Compilation to finite automata. For each typed specification , the compiler constructs a symbolic deterministic finite automaton
(cf. Definition 2). Here, is the transition function of : if the monitor is in state and reads the transaction-level AP valuation , then means that its next state is . For readability, we omit the subscript from the automaton components below. We write when satisfies a propositional condition .
Transitions are represented symbolically by predicates over AP valuations; the compiler therefore does not enumerate the alphabet . Compilation occurs once when the specification library is loaded. The resulting automaton and its specification fingerprint are then fixed.
The released specifications belong to a bounded fragment and take one of two forms. A same-turn specification has the form
where B is a propositional condition over one transaction. Its automaton has two states,
where searches for a valuation satisfying B, and records that such a valuation has been observed. The transition from is
An adjacent-turn specification has the form
where H is an anchor condition and G must hold in the immediately following transaction. Its automaton has three states,
Here, indicates that no unresolved anchor is active, records that the preceding transaction satisfied H, and records a completed adjacent-turn match. The transitions from and are
and
The self-transition on refreshes the pending anchor: if the previous anchor does not complete a match but the current transaction again satisfies H, the current transaction becomes the new anchor.
For both forms, the accepting state is absorbing:
This is sound because appending dialogue turns cannot invalidate an already completed existential witness. Thus, a same-turn specification requires two states, whereas an adjacent-turn specification requires at most three.
Finite-state monitoring and evidence. For each and trace , the monitor runs the corresponding automaton . Let and update
The specifications matched by the current prefix are
The monitor reports MONITOREDVIOLATION exactly when ; otherwise, the observed prefix has not instantiated any defined forbidden pattern. This procedure performs finite-word acceptance over the observed trace, rather than language inclusion or model checking over all possible system behaviors.
Every automaton transition retains the event label, speaker type, AP predicate, and relative offset inherited from its source specification. For a same-turn specification, the transition into identifies the triggering turn. For an adjacent-turn specification, stores the anchor turn and its AP provenance, which are combined with the evidence from the accepting transition. Each matched specification therefore produces a structured witness
where is the number of matched events, is a matched turn, is the set of canonical APs realizing the corresponding event, and contains their source evidence. Here, denotes the fingerprint identifying the frozen specification , and denotes the digest of the evaluated trace.
Before returning a verdict, the verifier replays the match against the frozen specification, trace digest, and raw provenance. A witness that cannot be reproduced is rejected and cannot support a valid verdict.
Runtime mode. When user message arrives, SpecGuard first activates the user-side APs from . The target LLM then produces a candidate reply , which remains in a private buffer. Reply-side and dialogue-side activation yields a provisional transaction , and every automaton evaluates its transition on a provisional copy of the monitoring state. If no automaton enters an accepting state, , , and the updated automaton states are committed, and the reply is released. Otherwise, the candidate is withheld, the committed trace remains unchanged, and the verdict, matched specifications, and witnesses are passed to the deployment policy for blocking, replacement, or human review. Excluding AP activation, each new transaction performs one constant-width transition per specification; the finite-state update therefore takes time and state, including bounded pending-witness metadata.
Audit mode. Audit mode receives a completed dialogue and replays its transactions in their original order. At each turn, it reconstructs the causal AP valuation and advances the same automata used at runtime. The audit records the first accepting turn for each specification and returns all matched specifications and their witnesses. For a dialogue with turns, the finite-state monitoring cost is , excluding AP activation. Because replay is strictly prefix ordered, future messages cannot reinterpret or modify an earlier valuation.
Formal robustness. The finite automata are executable representations of the typed specifications, rather than an independent set of detection rules.
Theorem 1 (Correctness of Finite-State Monitoring). For any typed specification , let be its corresponding automaton. Then, for any finite AP trace ,
Consequently, automaton acceptance has exactly the semantics of the source specification. The construction further guarantees prefix-consistent traces, equivalent runtime and audit decisions on the same prefix, invariance to constraint-irrelevant APs and excluded endpoint facts, replayable verdict witnesses, and persistence of accepted violations under trace extension. Appendix E states and proves these properties. They hold at the canonical-trace boundary and do not assume error-free natural-language AP activation, which is evaluated separately.
V. EVALUATION
A. Experimental Setup
Datasets. We evaluate SpecGuard on three multi-turn safety benchmarks spanning two languages, 10,075 dialogues, and 48,933 user-assistant turns (Table II). SafeDialBench-ZH and SafeDialBench-EN define a positive dialogue by an assistant-side safety violation. SafeMTData instead labels complete ActorAttack trajectories, including attacks whose final assistant response is a refusal. We retain each benchmark's native conversation-level labels and report its metrics separately; no labels, thresholds, or scores are pooled across datasets. Across all three benchmarks, SpecGuard uses the same 15-proposition contract, ten typed temporal constraints, and deterministic verdict rule.
Baselines and identical-input protocol. We compare against four representative open-weight guard models: ShieldGemma-2B [14], WildGuard-7B [5], BingoGuard-8B [38], and GuardReasoner-8B [15]. Every method receives the exact same ordered user-assistant exchanges. Following the baselines' stateless interfaces, we classify each turn independently and emit a dialogue-level alarm if any turn is flagged. SpecGuard evaluates the same ordered exchanges as a typed finite trace and emits one conversation-level verdict. We use pinned official checkpoints and their native inference templates, disable sampling, and apply no retraining, fine-tuning, or benchmark-specific calibration.
Metrics and statistical analysis. The evaluation unit is a completed dialogue. We use F1 as the primary detection metric, FPR to quantify unnecessary alarms on negative dialogues, and recall to measure positive coverage. We further report balanced accuracy (BA),
to summarize recall and false-alarm control at the frozen operating point. We additionally report area under the ROC curve (AUC) to measure discrimination across the score range. Because the monitor's output is Boolean, its AUC is computed from a deterministic, label-free specification-completion score: for each legal temporal alignment, we average the satisfied clauses, then take the maximum over alignments and specifications. The score uses neither labels nor learned parameters and equals one if and only if the formal verdict is violated. Predictions are aligned by conversation identifier, and every headline number is computed on the complete benchmark population. Results transcribed from prior work are reported separately as contextual operating points and are not treated as identical-input comparisons.
Reproducibility. All reported runs use one frozen AP contract, activator configuration, constraint library, and monitoring configuration. Once fixed, no rule, threshold, or dataset-specific decision setting is changed across benchmarks; SpecGuard contains no learned detector weights. We retain per-dialogue predictions and replayable witnesses, and record cryptographic hashes for evaluation inputs, source files, conversation identifiers, and baseline checkpoint revisions.
B. Detection Effectiveness
We first measure conversation-level detection under the identical-input protocol defined above. Figure 3 exposes the resulting F1–FPR operating points, while Table III reports the exact AUC, F1, FPR, and recall.
Headline performance. SpecGuard achieves the highest AUC, F1, and recall on all three benchmarks. Relative to the strongest F1 baseline on each dataset, it improves F1 by 0.222 on SafeDialBench-ZH, 0.290 on SafeDialBench-EN, and 0.222 on SafeMTData. The agreement between threshold-free AUC and the fixed-verdict F1 results shows that the advantage is not tied to a single reported operating point.
Although SpecGuard does not attain the lowest FPR at its frozen operating point, it achieves the highest BA on all three benchmarks: 0.978 on SafeDialBench-ZH, 0.931 on SafeDialBench-EN, and 0.936 on SafeMTData. These results demonstrate the strongest overall balance between positive-dialogue recall and negative-dialogue specificity. In contrast, the lowest-FPR baselines detect only 8.7–13.5% of positive dialogues, whereas SpecGuard recovers 90.7–98.4% while also attaining the highest F1.
Figure 3 visualizes the same operating-point trade-off. SpecGuard maintains low FPR on SafeDialBench-ZH and SafeMTData while substantially improving both F1 and BA. SafeDialBench-EN represents its most recall-oriented operating point, reaching 96.9% recall at a 10.7% FPR. Even
TABLE II MULTI-TURN DATASETS AND THEIR EVALUATION SEMANTICS.
| Dataset | Lang. | Unit | Dialogs | Turns | Pos./Neg. | Positive-label semantics |
|---|---|---|---|---|---|---|
| SafeDialBench-ZH | ZH | Multi-turn | 3,602 | 16,628 | 1,981 / 1,621 | Response-side violation |
| SafeDialBench-EN | EN | Multi-turn | 3,639 | 17,913 | 2,005 / 1,634 | Response-side violation |
| SafeMTData | EN | Multi-turn | 2,834 | 14,392 | 1,680 / 1,154 | ActorAttack trajectory |
TABLE III CONVERSATION-LEVEL PERFORMANCE ON MULTI-TURN JAILBREAK DETECTION. SAFEDIALBENCH IS REPORTED SEPARATELY FOR CHINESE (ZH) AND ENGLISH (EN). BEST VALUES ARE BOLD.
| Method | SafeDialBench-ZH | SafeDialBench-EN | SafeMTData | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AUC↑ | F1↑ | FPR↓ | Rec.↑ | BA↑ | AUC↑ | F1↑ | FPR↓ | Rec.↑ | BA↑ | AUC↑ | F1↑ | FPR↓ | Rec.↑ | BA↑ | |
| WildGuard-7B | 0.865 | 0.449 | 0.012 | 0.292 | 0.640 | 0.831 | 0.652 | 0.009 | 0.488 | 0.740 | 0.444 | 0.694 | 0.022 | 0.539 | 0.759 |
| GuardReasoner-8B | 0.851 | 0.759 | 0.030 | 0.627 | 0.799 | 0.730 | 0.638 | 0.018 | 0.475 | 0.729 | 0.342 | 0.717 | 0.065 | 0.583 | 0.759 |
| BingoGuard-8B | 0.712 | 0.363 | 0.012 | 0.224 | 0.606 | 0.636 | 0.271 | 0.018 | 0.159 | 0.571 | 0.445 | 0.101 | 0.076 | 0.056 | 0.490 |
| ShieldGemma-2B | 0.868 | 0.160 | 0.007 | 0.087 | 0.540 | 0.901 | 0.173 | 0.002 | 0.095 | 0.547 | 0.816 | 0.235 | 0.017 | 0.135 | 0.559 |
| SpecGuard (Ours) | 0.984 | 0.981 | 0.028 | 0.984 | 0.978 | 0.943 | 0.942 | 0.107 | 0.969 | 0.931 | 0.967 | 0.939 | 0.036 | 0.907 | 0.936 |
★ SpecGuard ○ ShieldGemma-2B □ WildGuard-7B ◇ BingoGuard-8B △ GuardReasoner-8B

Fig. 3. Conversation-level F1–FPR trade-off on the three multi-turn benchmarks. Upper-left is preferable. All methods receive identical conversations; external guards independently classify each turn and their alarms are aggregated at the conversation level.
at this point, SpecGuard retains the highest BA of 0.931, while its leading AUC of 0.943 further indicates that the higher FPR reflects the frozen operating-point choice rather than weaker separation across the score range. The Chinese and English evaluations use the same 15-proposition contract, ten typed specifications, and frozen decision configuration, without benchmark-specific threshold tuning.
SafeMTData deliberately tests a different endpoint: its positives are complete ActorAttack trajectories rather than only conversations ending in a violating assistant response. Under this trajectory-level objective, SpecGuard reaches 0.967 AUC, 0.939 F1, and 90.7% recall without changing the AP contract, constraint library, or decision rule. This result complements the response-side SafeDialBench evaluation by testing whether the same monitor can recognize adversarial structure at the dialogue level.
Contextual comparison with external defenses. Table IV situates SpecGuard relative to learned guardrails, alignment-based defenses, and a stateful multi-turn detector. To keep the comparison auditable, external rows reproduce the values reported by their respective papers, while the SpecGuard row uses our results above. These values are presented as operating-point context rather than identical-input measurements and are therefore kept separate from the controlled comparison.
SpecGuard achieves the strongest displayed AUC, F1, and recall on SafeDialBench, with an FPR comparable to SafeDream. On SafeMTData, it also improves both F1 and FPR over the reported reference operating points. Because the reference results use their original evaluation protocols, these comparisons provide context rather than replace the controlled evaluation above.
Where does the gain come from? To isolate the contribution of temporal reasoning from proposition extraction, we evaluate three rule masks over identical AP traces: the four zero-offset constraints (Same-turn), the six cross-turn constraints (Temporal), and their union (Full). Figure 4 reports both the resulting F1 and the alarms contributed uniquely by the cross-
TABLE IV
CONTEXTUAL COMPARISON WITH REFERENCE METHODS. SPECGUARD SCORES ON SAFEDIALBENCH ARE AVERAGED OVER ZH AND EN. BEST DISPLAYED RESULTS ARE IN BOLD.
| Method | SafeDialBench | SafeMTData | ||||||
|---|---|---|---|---|---|---|---|---|
| AUC↑ | F1↑ | FPR↓ | Rec.↑ | AUC↑ | F1↑ | FPR↓ | Rec.↑ | |
| Guardrail classifiers | ||||||||
| R2-Guard [28] | 0.691 | 0.698 | 0.169 | 0.607 | 0.675 | 0.591 | 0.137 | 0.543 |
| SelfDefend [39] | 0.734 | 0.721 | 0.115 | 0.682 | 0.718 | 0.685 | 0.238 | 0.591 |
| Alignment-based defenses (modify model weights) | ||||||||
| Circuit Breaker [7] | 0.831 | 0.823 | 0.071 | 0.802 | 0.824 | 0.811 | 0.084 | 0.797 |
| X-Boundary [40] | 0.858 | 0.839 | 0.094 | 0.830 | 0.836 | 0.820 | 0.091 | 0.813 |
| TARS [41] | 0.865 | 0.847 | 0.057 | 0.819 | 0.847 | 0.832 | 0.042 | 0.814 |
| Multi-turn stateful detectors | ||||||||
| SafeDream [16] | 0.912 | 0.901 | 0.066 | 0.918 | 0.915 | 0.904 | 0.080 | 0.897 |
| SpecGuard (Ours) | 0.964 | 0.962 | 0.067 | 0.976 | 0.967 | 0.939 | 0.036 | 0.907 |
TABLE V
INTEGRITY CHECKS OF THE SYMBOLIC DECISION PATH.
| Check | Scope | Result |
|---|---|---|
| Score–verdict equivalence | 10,075 dialogues | 0 mismatches |
| Witness replay | 5K traces/995 alarms | 1,652/1,652 |
| Endpoint invariance | 5K traces | 0 changes |
| Endpoint-free alphabet | 15 APs/10 specs. | 0 prohibited |
| Regression tests | 7 tests | 7/7 passed |
turn family.
The two rule families are complementary. Adding cross-turn specifications raises F1 from 0.975 to 0.981 on SafeDialBench-ZH, from 0.899 to 0.942 on SafeDialBench-EN, and from 0.877 to 0.939 on SafeMTData. These gains recover 25, 172, and 184 additional true positives, with only 1, 14, and 5 additional false positives, respectively. Temporal-only specifications also remain effective, reaching 0.939, 0.930, and 0.859 F1. Because the AP traces are fixed, the gains isolate temporal composition from proposition extraction.
When does the monitor trigger? For each detected positive dialogue, we extract the completion turn of its earliest canonical witness. We normalize this location as , where is the number of dialogue turns. Figure 5 plots the cumulative fraction of all positive dialogues detected by progress ; consequently, each curve's endpoint equals its final recall.
The full monitor detects more positive dialogues by the midpoint and retains this advantage through the final turn across all three datasets. Temporal evidence therefore improves both early detection and final recall, rather than contributing only at the last exchange.
Stability across dialogue length. Table VI stratifies the same frozen predictions by the number of turns. F1 does not degrade in the longest (≥ 5-turn) stratum on any benchmark. This stratification is not used for model or threshold selection; it serves as a stress test of trace accumulation.
C. Faithfulness and Auditability
We evaluate faithfulness against the monitor's actual decision function: given the extracted AP trace, does the exported
TABLE VI
DETECTION PERFORMANCE STRATIFIED BY DIALOGUE LENGTH. DIALOGUES WITH FEWER THAN THREE TURNS (SAFEMTDATA, N=152) ARE OMITTED.
| Dataset | Turns | F1 | |
|---|---|---|---|
| SafeDialBench-ZH | 3–4 | 1,480 | 0.976 |
| SafeDialBench-ZH | ≥ 5 | 2,122 | 0.984 |
| SafeDialBench-EN | 3–4 | 481 | 0.922 |
| SafeDialBench-EN | ≥ 5 | 3,158 | 0.945 |
| SafeMTData | 3–4 | 659 | 0.934 |
| SafeMTData | ≥ 5 | 2,023 | 0.953 |
TABLE VII
END-TO-END CPU RUNTIME ON SAFEDIALBENCH-EN WITH FOUR WORKERS. PER-DIALOGUE AND PER-TURN COSTS ARE AMORTIZED WALL-CLOCK VALUES.
| Measurement | Result |
|---|---|
| Dialogues | 3,639 |
| Dialogue turns | 17,913 |
| Total wall-clock time | 246.8 s |
| Dialogue throughput | 14.7 dialogues/s |
| Turn throughput | 72.6 turns/s |
| Amortized time per dialogue | 67.8 ms |
| Amortized time per turn | 13.8 ms |
evidence reproduce the exact alarm? This criterion is stronger than post-hoc plausibility. A SpecGuard alarm is emitted together with the violated constraint, its fingerprint, the ordered participating turns, the matched APs and raw provenance, and a digest of the evaluated trace. Evidence generation is therefore part of evaluation, not a separate explanation model.
Decision-path replay. The randomized integrity audit evaluates 5,000 traces of length one to eight drawn over the complete 15-AP alphabet. For every emitted witness, the checker re-evaluates the typed constraint, verifies the trace digest, and checks each matched AP against its raw producer provenance. All 1,652 witnesses from 995 alarmed traces replay successfully. Separately, full-population evaluation confirms on every benchmark dialogue that a completion score of one is exactly equivalent to the Boolean monitor verdict. The exported evidence therefore identifies the same ordered observations that caused the decision rather than serving as a post-hoc rationale.
No verdict shortcut. The canonical alphabet contains 15 low-level context, user, and assistant facts, but no proposition denoting an attack, harmful delivery, unsafe response, or final violation. We additionally inject every prohibited endpoint AP into each randomized trace before re-evaluation. In all cases, canonical projection removes the injected APs and leaves both the decision and trace digest unchanged. Endpoint semantics therefore arise only from typed constraint evaluation, while the underlying observations remain independently inspectable.
Taken together, these checks establish a closed audit path from raw evidence to canonical APs, from APs to an ordered
Same-turn only △ Temporal only ★ Full monitor
(a)
Rule-family contribution

(b)
New temporal alarms

Fig. 4. Contribution of cross-turn specifications under fixed AP traces. (a) F1 of same-turn, temporal-only, and full monitors. (b) Additional true and false positives from enabling cross-turn specifications.
Full monitor Same-turn only

(b)
SafeDialBench-EN
Dialogue progress (normalized)
(c)
SafeMTData
Fig. 5. First-trigger dynamics over normalized dialogue progress. A trigger marks the earliest replayable witness. Solid lines use all ten specifications, while dashed lines use only the four same-turn specifications. The vertical axis is normalized by all positive dialogues, so each endpoint equals recall.
witness, and from that witness to the reported verdict. The end-to-end effectiveness results include the extraction stage, whereas Table V establishes exact faithfulness of the symbolic decision and its exported evidence. Appendix D formalizes witness soundness and trace-bound replay.
D. Runtime Performance
We measure the same end-to-end path used for the effectiveness results: natural language AP extraction, canonical trace construction, evaluation of all ten constraints, verdict and witness construction, and specification-completion scoring. SafeDialBench-EN is the largest benchmark by number of turns. Each of its 3,639 dialogues is processed exactly once on an Apple M4 CPU using four worker processes; no GPU or external model service is involved.
Table VII shows that the complete transcript-to-score-and-verdict path processes the 17,913-turn benchmark in 246.8 seconds. This corresponds to 72.6 turns/s and an amortized 13.8 ms per turn, including evidence generation and the label-free completion score used for AUC. The result therefore measures deployment-facing work rather than only formula evaluation or a cached AP trace.
The batch evaluator constructs one canonical trace per dialogue and evaluates the fixed library of ten bounded temporal constraints. All active constraints have offsets of at most one round, so verdict evaluation and completion scoring require time and the auditable trace uses storage for a T-turn dialogue. Because is fixed, both costs grow linearly with dialogue length. No model decoding or search over unbounded attack trajectories is required. Together with the length-stratified results, this shows that SpecGuard maintains stable detection and practical CPU throughput as dialogue traces grow.
VI. Conclusion
We presented SpecGuard, which converts multi-turn dialogues into auditable AP traces and checks them against typed specifications. Across languages and attack trajectories, SpecGuard achieves strong detection performance while producing replayable witnesses for its verdicts.
Two directions follow from this work. First, SpecGuard could be extended to multimodal interactions by grounding APs in text, images, audio, and video within a unified temporal trace. Second, building on counterexample-guided corrective regeneration for formally verified specifications [31], SpecGuard's replayable witnesses could enable response regeneration: when a violation is detected, the matched constraints and evidence identify the unsafe content to revise, and the regenerated response can be rechecked before release, providing verifiable safety safeguards for deployed LLM systems.
ETHICS CONSIDERATIONS
This work is defensive: it detects multi-turn jailbreaks and introduces no new attacks or harmful content. All experiments use publicly released datasets; the manual annotation in this work was performed by the authors on these public corpora, and no new data was collected from users. Although the released specifications could inform adaptive evasion, explicit and auditable safety rules chiefly benefit defenders and can be revised as attacks evolve.
REFERENCES
[1] A. Wei, N. Haghtalab, and J. Steinhardt, "Jailbroken: How does llm safety training fail?" 2023. [Online]. Available: https://arxiv.org/abs/2307.02483
[2] M. Russinovich, A. Salem, and R. Eldan, “Great, now write an article about that: the crescendo multi-turn llm jailbreak attack,” in Proceedings of the 34th USENIX Conference on Security Symposium, ser. SEC '25. USA: USENIX Association, 2025.
[3] S. Rahman, L. Jiang, J. Shiffer, G. Liu, S. M. Issaka, M. R. Parvez, H. Palangi, K.-W. Chang, Y. Choi, and S. Gabriel, "X-teaming: Multi-turn jailbreaks and defenses with adaptive multi-agents," ArXiv, vol. abs/2504.13203, 2025. [Online]. Available: https://api.semanticscholar.org/CorpusID:277940089
[4] H. Inan, K. Upasani, J. Chi, R. Rungta, K. Iyer, Y. Mao, M. Tontchev, Q. Hu, B. Fuller, D. Testuggine, and M. Khabsa, "Llama guard: Llm-based input-output safeguard for human-ai conversations," 2023. [Online]. Available: https://arxiv.org/abs/2312.06674
[5] S. Han, K. Rao, A. Ettinger, L. Jiang, B. Y. Lin, N. Lambert, Y. Choi, and N. Dziri, “Wildguard: open one-stop moderation tools for safety risks, jailbreaks, and refusals of llms,” in Proceedings of the 38th International Conference on Neural Information Processing Systems, ser. NIPS '24. Red Hook, NY, USA: Curran Associates Inc., 2024.
[6] Z. Xu, F. Jiang, L. Niu, J. Jia, B. Y. Lin, and R. Poovendran, "SafeDecoding: Defending against jailbreak attacks via safety-aware decoding," in Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), L.-W. Ku, A. Martins, and V. Srikumar, Eds. Bangkok, Thailand: Association for Computational Linguistics, Aug. 2024, pp. 5587–5605. [Online]. Available: https://aclanthology.org/2024.acl-long.303/
[7] A. Zou, L. Phan, J. Wang, D. Duenas, M. Lin, M. Andriushchenko, R. Wang, Z. Kolter, M. Fredrikson, and D. Hendrycks, “Improving alignment and robustness with circuit breakers,” in Advances in Neural Information Processing Systems, A. Globerson, L. Mackey, D. Belgrave, A. Fan, U. Paquet, J. Tomczak, and C. Zhang, Eds., vol. 37. Curran Associates, Inc., 2024, pp. 83 345–83 373.
[8] N. Mehdipour, M. Althoff, R. D. Tebbens, and C. Belta, “Formal methods to comply with rules of the road in autonomous driving: State of the art and grand challenges,” Automatica, vol. 152, p. 110692, 2023. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S0005109822005568
[9] M. Alshiekh, R. Bloem, R. Ehlers, B. Könighofer, S. Niekum, and U. Topcu, “Safe reinforcement learning via shielding,” Proceedings of the AAAI Conference on Artificial Intelligence, vol. 32, no. 1, Apr. 2018. [Online]. Available: https://ojs.aaai.org/index.php/AAAI/article/view/11797
[10] A. Zou, Z. Wang, N. Carlini, M. Nasr, J. Z. Kolter, and M. Fredrikson, "Universal and transferable adversarial attacks on aligned language models," 2023. [Online]. Available: https://arxiv.org/abs/2307.15043
[11] P. Chao, A. Robey, E. Dobriban, H. Hassani, G. J. Pappas, and E. Wong, "Jailbreaking black box large language models in twenty queries," 2023.
[12] C. Anil, E. Durmus, N. Panickssery, M. Sharma, J. Benton, S. Kundu, J. Batson, M. Tong, J. Mu, D. Ford, F. Mosconi, R. Agrawal, R. Schaeffer, N. Bashkansky, S. Svenningsen, M. Lambert, A. Radhakrishnan, C. Denison, E. J. Hubinger, Y. Bai, T. Bricken, T. Maxwell, N. Schiefer, J. Sully, A. Tamkin, T. Lanhan, K. Nguyen, T. Korbak, J. Kaplan, D. Ganguli, S. R. Bowman, E. Perez, R. B. Grosse, and D. Duvenaud, "Many-shot jailbreaking," in Proceedings of the 38th International Conference on Neural Information Processing Systems, ser. NIPS '24. Red Hook, NY, USA: Curran Associates Inc., 2024.
[13] Q. Ren, H. Li, D. Liu, Z. Xie, X. Lu, Y. Qiao, L. Sha, J. Yan, L. Ma, and J. Shao, “LLMs know their vulnerabilities: Uncover safety gaps through natural distribution shifts,” arXiv preprint arXiv:2410.10700, 2024. [Online]. Available: https://arxiv.org/abs/2410.10700
[14] W. Zeng, Y. Liu, R. Mullins, L. Peran, J. Fernandez, H. Harkous, K. Narasimhan, D. Proud, P. Kumar, B. Radharapu, O. Sturman, and O. Wahltinez, “Shieldgemma: Generative ai content moderation based on gemma,” 2024. [Online]. Available: https://arxiv.org/abs/2407.21772
[15] Y. Liu, H. Gao, S. Zhai, Y. He, J. Xia, Z. Hu, Y. Chen, X. Yang, J. Zhang, S. Z. Li, H. Xiong, and B. Hooi, “Guardreasoner: Towards reasoning-based llm safeguards,” 2025. [Online]. Available: https://arxiv.org/abs/2501.18492
[16] B. Yan, W. Lin, Y. Zhu, and S. Wang, “Safedream: Safety world model for proactive early jailbreak detection,” 2026. [Online]. Available: https://arxiv.org/abs/2604.16824
[17] Z. Ma, Z. Xu, D. Yu, C. Kang, C. Li, and P. Liu, “Thrd: A training-free multi-turn defense framework for jailbreak attacks on large language models,” 2026. [Online]. Available: https://arxiv.org/abs/2606.01738
[18] Z. Huang, K. Huang, L. Yin, B. He, H. Zhen, M. Yuan, and Z. Shao, "Attention-aware gnn-based input defense against multi-turn llm jailbreak," 2025. [Online]. Available: https://arxiv.org/abs/2507.07146
[19] X. Shen, R. Wei, P. Niu, H. Wang, R. Wu, E. Chien, B. Li, P.-Y. Chen, and P. Li, “One turn too late: Response-aware defense against hidden malicious intent in multi-turn dialogue,” 2026. [Online]. Available: https://arxiv.org/abs/2605.05630
[20] X. Shen, Z. Chen, M. Backes, Y. Shen, and Y. Zhang, "Do Anything Now: Characterizing and evaluating in-the-wild jailbreak prompts on large language models," in Proceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security, ser. CCS '24. New York, NY, USA: Association for Computing Machinery, 2024, p. 1671–1685. [Online]. Available: https://doi.org/10.1145/3658644.3670388
[21] Y. Liu, G. Deng, Z. Xu, Y. Li, Y. Zheng, Y. Zhang, L. Zhao, T. Zhang, and K. Wang, “A hitchhiker’s guide to jailbreaking chatgpt via prompt engineering,” in Proceedings of the 4th International Workshop on Software Engineering and AI for Data Quality in Cyber-Physical Systems/Internet of Things, ser. SEA4DQ 2024. New York, NY, USA: Association for Computing Machinery, 2024, p. 12–21. [Online]. Available: https://doi.org/10.1145/3663530.3665021
[22] Y. Zeng, Y. Yang, A. Zhou, J. Z. Tan, Y. Tu, Y. Mai, K. Klyman, M. Pan, R. Jia, D. Song, P. Liang, and B. Li, “Air-bench 2024: A safety benchmark based on risk categories from regulations and policies,” 2024. [Online]. Available: https://arxiv.org/abs/2407.17436
[23] T. Wongpiromsarn, M. Ghasemi, M. Cubuktepe, G. Bakirtzis, S. Carr, M. O. Karabag, C. Neary, P. Gohari, and U. Topcu, “Formal methods for autonomous systems,” Foundations and Trends® in Systems and Control, vol. 10, no. 3-4, p. 180–407, 2023. [Online]. Available: http://dx.doi.org/10.1561/2600000029
[24] A. Desai, T. Dreossi, and S. Seshia, “Combining model checking and runtime verification for safe robotics,” in The 17th International Conference on Runtime Verification, 2017. [Online]. Available: http://terraswarm.org/pubs/955.html
[25] D. Sun, J. Chen, S. Mitra, and C. Fan, “Multi-agent motion planning from signal temporal logic specifications,” 2022. [Online]. Available: https://arxiv.org/abs/2201.05247
[26] C. P. Lee, D. Porfirio, X. J. Wang, K. C. Zhao, and B. Mutlu, “Veriplan: Integrating formal verification and llms into end-user planning,” in Proceedings of the 2025 CHI Conference on Human Factors in Computing Systems, ser. CHI '25. ACM, Apr. 2025, p. 1–19. [Online]. Available: http://dx.doi.org/10.1145/3706598.3714113
[27] M. Kang and B. Li, “R²-Guard: Robust reasoning enabled LLM guardrail via knowledge-enhanced logical reasoning,” in International Conference on Learning Representations, 2025. [Online]. Available: https://openreview.net/forum?id=CkgKSqZbuC
[28] —, “R²-Guard: Robust reasoning enabled llm guardrail via knowledge-enhanced logical reasoning,” in International Conference on Learning Representations, Y. Yue, A. Garg, N. Peng, F. Sha, and R. Yu, Eds., vol. 2025, 2025, pp. 63 859–63 876.
[29] M. Cosler, C. Hahn, D. Mendoza, F. Schmitt, and C. Trippel, "nl2spec: Interactively translating unstructured natural language to temporal logics with large language models," 2023. [Online]. Available: https://arxiv.org/abs/2303.04864
[30] Y. Chen, R. Gandhi, Y. Zhang, and C. Fan, "Nl2tl: Transforming natural languages to temporal logics using large language models," 2024. [Online]. Available: https://arxiv.org/abs/2305.07766
[31] J. Li, S. Chen, J. Li, M. Tian, and B. Zhong, “Automatic generation of safety-compliant linear temporal logic via large language model: A self-supervised framework,” 2025. [Online]. Available: https://arxiv.org/abs/2503.15840
[32] A. Ferrari and P. Spoletini, “Formal requirements engineering and large language models: A two-way roadmap,” Information and Software Technology, vol. 181, p. 107697, 2025. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S0950584925000369
[33] Y. Zhang, Y. Cai, X. Zuo, X. Luan, K. Wang, Z. Hou, Y. Zhang, Z. Wei, M. Sun, J. Sun, J. Sun, and J. S. Dong, “The fusion of large language models and formal methods for trustworthy ai agents: A roadmap,” 2024. [Online]. Available: https://arxiv.org/abs/2412.06512
[34] M. Sipser, Introduction to the Theory of Computation, 3rd ed. Cengage Learning, 2013.
[35] T. Markov, C. Zhang, S. Agarwal, T. Eloundou, T. Lee, S. Adler, A. Jiang, and L. Weng, “A holistic approach to undesired content detection in the real world,” 2023. [Online]. Available: https://arxiv.org/abs/2208.03274
[36] M. Mazeika, L. Phan, X. Yin, A. Zou, Z. Wang, N. Mu, E. Sakhaee, N. Li, S. Basart, B. Li, D. Forsyth, and D. Hendrycks, “Harmbench: a standardized evaluation framework for automated red teaming and robust refusal,” in Proceedings of the 41st International Conference on Machine Learning, ser. ICML'24. JMLR.org, 2024.
[37] W. Zhao, X. Ren, J. Hessel, C. Cardie, Y. Choi, and Y. Deng, "Wildchat: 1m chatgpt interaction logs in the wild," 2024. [Online]. Available: https://arxiv.org/abs/2405.01470
[38] F. Yin, P. Laban, X. Peng, Y. Zhou, Y. Mao, V. Vats, L. Ross, D. Agarwal, C. Xiong, and C.-S. Wu, “BingoGuard: LLM content moderation tools with risk levels,” in International Conference on Learning Representations, 2025. [Online]. Available: https://openreview.net/forum?id=782b6152c04e9948c2cb3833e9a288ef
[39] X. Wang, D. Wu, Z. Ji, Z. Li, P. Ma, S. Wang, Y. Li, Y. Liu, N. Liu, and J. Rahmel, “Selfdefend: Llms can defend themselves against jailbreaking in a practical manner,” in Proceedings of the 34th USENIX Conference on Security Symposium, ser. SEC '25. USA: USENIX Association, 2025.
[40] X. Lu, D. Liu, Y. Yu, L. Xu, and J. Shao, “X-boundary: Establishing exact safety boundary to shield LLMs from jailbreak attacks without compromising usability,” in Findings of the Association for Computational Linguistics: EMNLP 2025, C. Christodoulopoulos, T. Chakraborty, C. Rose, and V. Peng, Eds. Suzhou, China: Association for Computational Linguistics, Nov. 2025, pp. 5247–5272. [Online]. Available: https://aclanthology.org/2025.findings-emnlp.282/
[41] T. Kim, F. Tajwar, A. Raghunathan, and A. Kumar, “Reasoning as an adaptive defense for safety,” in Advances in Neural Information Processing Systems, D. Belgrave, C. Zhang, H. Lin, R. Pascanu, P. Koniusz, M. Ghassemi, and N. Chen, Eds., vol. 38. Curran Associates, Inc., 2025, pp. 77 024–77 073.
APPENDIX
A. Evidence Grounding: Matcher and Output Contract
This appendix fixes the deterministic text-grounding contract. We count one logical semantic predicate with a stable output slot as one matcher; lexical, regular-expression, and structural branches are implementation variants of that predicate. The implementation has 52 text-grounding matchers in nine evidence families (Table VIII) and six bounded-relation matchers (Table IX), which consume evidence records.
Input scope and windows
For turn t, matchers receive ; is retained for relation composition. Messages are normalized, routed to the Chinese or English pattern set, and segmented into content units while preserving list and line structure. Windows contain at most three neighboring units. In long user messages, a request-anchored command zone excludes quoted/background text and unanchored fenced code. These steps restrict matcher scope; they do not activate APs.
Deterministic triggering
Matchers are deterministic predicates over a normalized unit or window: lexical predicates use bilingual dictionaries and boundary-aware patterns; structural predicates inspect list/line order, code delimiters, and numeric formats; co-occurrence predicates are window-bounded. Negation, scope, and refusal are emitted explicitly, and every hit returns its value, normalized span, and supporting phrase or structural condition.
Evidence output contract
For a window W, matcher m returns zero or more provenance-bearing intermediate records, not canonical APs or verdicts.
The matcher output is represented as
and each tuple is lifted to an evidence record
Here is the role, a typed slot, v its value, the normalized-text span, and s the supporting phrase, predicate, or count. A window may yield multiple records, including repeated hits; deduplication is performed only after provenance is retained.
Relation matchers operate on evidence, frame cues, and retained source identifiers rather than raw text. Capability and specificity are derived combinations:
Capability ,
Specificity .
Thus, a parameter or domain hit alone is insufficient. The records then proceed to frame construction and contract guards.
B. AP Extraction and Provenance
The main text defines the 15 canonical APs. Here we give only the projection, endpoint exclusion, and provenance needed to reproduce the trace. User APs use , reply APs use , and history APs summarize the prefix.
Raw-to-canonical projection
Let be the raw evidence for turn t. Projection is multi-label and also accepts a canonical identifier as normalized raw evidence.
The following shorthand states the complete mapping. A terminal * is a prefix wildcard; p4* tokens are frozen producer identifiers.
violence, terrorism, drug_weapon, financial_crime, hate_speech, discrimination, self_harm, child_abuse, sexual_content, misinformation, unethical_behavior, and privacy.
The elements of , together with social_misconduct.
TABLE VIII LOGICAL TEXT-GROUNDING MATCHERS BY EVIDENCE FAMILY.
| Evidence family | Count | Logical matchers | Trigger and output |
|---|---|---|---|
| Domain and context | 4 | HarmDomain, HighRiskDomain, ContextCorePhrase, DomainWindowBinding | Domain lexicon/phrase; emits domain and same-window capability support. |
| Procedure and action | 5 | StepSequence, NumberedInstruction, OperationalVerb, ActionVerb, CommandStructure | List/step/command structure or operational verb; emits marker/action, span, and count. |
| Parameter and code | 4 | NumericUnit, Ratio, CodeFence, CommandParameter | Number-unit, ratio, code, command, or named parameter; emits value and span. |
| Request cues | 8 | DirectHowTo, ExactQuantityRequest, StepByStepRequest, MethodRequest, InstrumentRequest, PreparationRequest, ReversalRequest, SuppressionRequest | Interrogative/imperative pattern for method, amount, sequence, instrument, preparation, reversal, or suppression; emits request cue. |
| Objective and family | 6 | HarmfulObjective, ObjectiveFamily, ActorRole, TargetRole, IdentifiedPerson, ObjectiveReference | Objective/family phrase, actor-target relation, identifier, or anaphora; emits objective, family, target, or reference. |
| Evasion and intent | 7 | InstructionOverride, PersonaMode, ConstraintSuppression, PolarityInversion, IntentEscalation, ContinuationCue, EvasionCue | Override, role-play, suppression, reversal, escalation, continuation, or bypass phrase; emits evasion/intent cue. |
| Polarity, scope, and speech act | 6 | Negation, RefusalCue, SafetyDisclaimer, EducationalScope, OperationalScope, SpeechAct | Negation/refusal, safety/educational/operational scope, or speech-act pattern; emits polarity, scope, or act. |
| Reply delivery and content | 7 | SubstantiveContent, ProceduralContent, MethodContent, ActionEnablement, TargetedContent, PartialAssistance, HarmfulArtifact | Payload length, procedure, method, executable action, target detail, partial completion, or harmful artifact; emits content support. |
| Refusal and assistance | 5 | EffectiveRefusal, SafetyRefusal, CapabilityRefusal, Boilerplate, NonBoilerplateContent | Safety/capability refusal, boilerplate, or retained payload; emits refusal and content polarity. |
| Total 52 logical text matchers | |||
TABLE IX BOUNDED-RELATION MATCHERS USED AFTER EVIDENCE GROUNDING.
| Relation matcher | Evidence-level condition |
|---|---|
| ObjectiveSource | Binds a request to its earliest objective evidence. |
| ActiveSource | Carries an objective while its source remains active. |
| ActionAnaphora | Resolves an action anaphor under an affirmed operational request. |
| CanonicalReactivati | Detects resumed objectives after continuation. |
| ResilientLineage | Preserves source lineage across bounded links. |
| SameFamilyDelivery | Binds request/reply evidence with equal risk family. |
self_harm_method, suicide_planning, self_harm_encouragement, credential_intrusion, monitoring_evasion, discriminatory_abuse, privacy_intrusion, illicit_operations, abusive_generation, harmful_rationalization.
u_requests_abusive_language_examples, u_requests_derogatory_generation, u_requests_false_claim_generation, u_requests_false_claim_persuasion, u_requests_harmful_actor_methods, u_requests_harmful_advocacy, u_requests_harmful_case_examples, u_requests_harmful_scene, u_requests_harmfulenumeration, u_requests_harmful_mechanism, u_requests_illicit_artifact_method, u_requests_privacy_compromise, u_zh_requests_concrete_harmful_condu.
u_p4k_direct_, u_p4k_context_, u_p4n_direct_, u_p4s_direct_,
u_p4s_bound_, u_p4t_bound_, u_p4u_bound_, u_p4o_bound_.
u_p4k_direct_, u_p4n_direct_, u_p4s_direct_, u_p4s_bound_, u_p4t_bound_, u_p4u_bound_, u_p4o_bound_*.
u_p4s_bound_, u_p4t_bound_, u_p4u_bound_, u_p4o_bound_.
a_p4k_delivers_, a_p4n_delivers_, a_p4o_delivers_, a_p4s_delivers_.
Table X gives the projection; an AP also accepts a raw observation equal to its canonical identifier.
Let denote the support set in Table X, including the canonical identifier itself. The projection records
.
The excluded set is
u_attack_signal, u_content_risk, u_conversation_intent, a_response_unsafe, a_response_unsafe_observed, a_harmful_delivery, a_delivery_evidence, a_strong_delivery, a_operational_delivery}.
Consequently, .
C. Typed Temporal Constraint Library
Typed intermediate representation. An event is , with role , required APs , alternative APs , and disqualifiers . It matches iff
TABLE X COMPLETE RAW-TO-CANONICAL PROJECTION. PARAMETERIZED IDENTIFIERS RANGE OVER THE SETS DEFINED ABOVE.
| AP | Raw support class | Accepted raw evidence |
|---|---|---|
| Harm context | d_active_harm_context; c_domain_d for ; d_active_harm_d for . | |
| Objective source | d_p4s_source_f and d_p4u_bound_f for . | |
| Harmful objective | ||
| Execution request | ; u_prompt_how_to; u_prompt_requests_specific_parameter; | |
| Evasion tactic | u_prompt_stepwise_decomposition; u_prompt_goal_persistence; u_requests_operational_parameter.u_jailbreak_intent_prompt; u_jailbreak_persona; u_prompt_constraint_bypass; | |
| Continuation | u_prompt_requests_rephrase; u_requests_encoded_output; u_requests_polarity_inversion. | |
| Intent increase | ; u_prompt_requests_continuation; u_multi_turn_context_ref. | |
| Objective reference | u_prompt_escalation; u_user_escalates_after_partial.u_reference_active_harm_details. | |
| Substantive content | a_delivered_content; a_harmful_artifact_generated; a_argumentative_harm_delivered; | |
| Procedural detail | a_false_claim_delivered; a_targeted_degradation_delivered.a_provides_instructions; a_harmful_action_details_delivered; | |
| Method specificity | a_zh_concrete_harm_details_delivered; a_compact_harmful_list_delivered. | |
| Action enablement | ; a_names_specific_method; a_operational_specificity. | |
| Targeted content | a_provides_workaround; a_harmful_artifact_generated; a_confirms_feasibility. | |
| Partial assistance | a_argumentative_harm_delivered; a_false_claim_delivered; a_targeted_degradation_delivered. | |
| Effective refusal | a_partial_compliance; a_partial_refusal; a_confirms_feasibility.a_effective_refusal; a_full_refusal; a_refused_safety; a_p4k_effective_refusal; | |
| a_p4k_refusal_act. |
We write for this predicate in the compiled formula. Role validation permits user events to draw on user/context APs, reply events on reply/context/history APs, and round events on context/history APs. We identify each constraint with its compiled formula , writing and interchangeably.
A typed constraint assigns relative offsets; the library uses only and compiles deterministically:
Events sharing an offset use the same transaction. Define
is a Boolean abbreviation and is not an additional AP.
Constraint inventory. Table XI lists the ten compiled rules; four use offset and six use .
D. Witness Construction and Replay
For constraint , let . Its matching anchors on are
If nonempty, choose . For event , let
be its realizing APs. The witness is
The constraint fingerprint hashes the typed events, offsets, and schema; the trace digest hashes schema identifiers and sorted APs.
Verification recomputes the earliest match, checks roles, turns, APs, both digests, and every provenance set; any changed field fails replay.
E. Formal Monitoring Guarantees
The guarantees below hold at the canonical-trace boundary under: (A1) deterministic activation for a fixed prefix; (A2) causal activation; (A3) removal of before projection; and (A4) the fixed-window existential constraint forms of Sec. IV-C.
Fix with automaton and trace . Let
where is the AP set referenced by .
Proof of Theorem 1. For a same-turn rule , induction on the input position gives iff some satisfies . For an adjacent-turn rule , the automaton stores whether the latest transaction satisfies ; it enters the absorbing state exactly when the next transaction satisfies . Hence both released templates satisfy
Proposition 1 (Prefix consistency).
Proof. Equal prefixes give equal causal views; (A1)–(A2) therefore give equal evidence, projection, and trace positions.
Proposition 2 (Runtime–audit equivalence). If the runtime candidate reply is the reply in the audited prefix, then
TABLE XI RELEASED TYPED CONSTRAINTS; IS DEFINED ABOVE.
| Rule | Implementation identifier | Compiled formula | Offsets | Forbidden relation |
|---|---|---|---|---|
| P13F-SAME-TURN-PROCEDURE | (0, 0) | Harmful execution request with procedural detail and no refusal. | ||
| P13F-CONTEXT-SPECIFICITY | (0, 0) | Active harm context with method-specific assistance. | ||
| P13F-SAME-TURN-ENABLEMENT | (0, 0) | Harmful request with enabling or targeted content. | ||
| P13F-EVASIVE-ASSISTANCE | (0, 0) | Evasive harmful objective with detailed assistance. | ||
| P13F-CONTINUATION | (0, 1) | Continued objective with next-turn detailed assistance. | ||
| P13F-ESCALATION | (0, 1) | Escalated objective with next-turn detailed assistance. | ||
| P13F-REFUSAL-BYPASS | (0, 1) | Refusal followed by renewed request and assistance. | ||
| P13F-PARTIAL-ESCALATION | (0, 1) | Partial assistance followed by continuation/escalation. | ||
| P13F-OBJECTIVE-REFERENCE | (0, 1) | Established objective resumed with assistance. | ||
| P13F-Repeated-Assistance | (0, 1) | Detailed assistance in consecutive harm-context turns. |
Proof. Both modes construct the same causal trace by Proposition 1; automaton correctness gives the same acceptance for every constraint.
Proposition 3 (Constraint-projection invariance). For equal-length traces,
Proof. Every transition predicate references only ; induction on positions gives identical state sequences.
Proposition 4 (Endpoint non-interference). For ,
Thus excluded endpoint predicates cannot change the trace, automaton run, or verdict. Proof. (A3) discards and before support mapping.
Proposition 5 (Verdict-witness correspondence). For every finite trace ,
Proof. Verification replays the matched events, offsets, AP support, and digests, giving soundness. If a rule accepts, the finite anchor set is nonempty; its earliest element generates a witness that replay accepts, giving completeness.
Proposition 6 (Extension monotonicity).
Proof. The accepting state is absorbing, and the fixed-window existential witness is unchanged by appending a suffix.
Proposition 7 (Monitoring complexity). With fixed-width transition predicates, excluding AP activation and text storage, a runtime update costs time and state; replaying turns costs . Proof. Each rule uses a constant-size automaton and one constant-width transition per turn.
Boundary. These results establish deterministic acceptance, mode equivalence, non-interference, replayability, monotonicity, and complexity after the canonical trace is instantiated. They do not claim perfect natural-language fact production; missing or spurious APs are evaluated separately.