Join our Newsletter — 33% off our NHI Course
Home› FAQ› AI Security› What is the difference between semantic leakage and…
AI Security

What is the difference between semantic leakage and verbatim leakage in prompt extraction?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated October 22, 2026 Domain: AI Security

Semantic leakage exposes meaning, such as a behavioural rule or tool description, even if the wording changes. Verbatim leakage exposes exact identifiers like endpoints, email addresses, version numbers, or tokens, where exact recovery matters. Good evaluations distinguish the two because they create different security outcomes and need different scoring methods.

Why semantic leakage and verbatim leakage are different failure modes

prompt extraction can fail in two distinct ways. Semantic leakage exposes the underlying meaning of a protected prompt or policy, even if the wording is paraphrased. Verbatim leakage is narrower and more exact, where the extracted content reproduces sensitive strings that should not be recoverable at all. The distinction matters because a system may be unsafe even when exact text is never copied.

Semantic leakage is usually the more subtle risk. An attacker may learn a hidden rule, a tool-use constraint, a routing instruction, or a safety boundary without recovering the original phrasing. That can be enough to bypass guardrails, imitate internal behaviour, or expose operational logic. Verbatim leakage is easier to spot, but it often signals a more concrete confidentiality failure because the model has reproduced identifiers that can be directly used.

What each kind of leakage reveals to an attacker

Semantic leakage usually tells the attacker how the system thinks. They may learn that a prompt instructs the model to prefer one tool over another, to reveal a category of data under a certain condition, or to follow a hidden decision tree. Even partial understanding can help an adversary craft better follow-up prompts and increase extraction success over time.

Verbatim leakage tells the attacker exactly what to reuse. A copied endpoint, API key fragment, email address, or version string can be operationally useful on its own, especially when the value is an exact identifier or token. The security outcome is different: semantic leakage may enable policy inference or jailbreak tuning, while verbatim leakage can create direct access, impersonation, or pivot opportunities.

That is why evaluations should score them separately. A model that faithfully paraphrases a prompt’s intent but never repeats exact secrets has a different failure profile from one that can regurgitate sensitive strings. Treating both as one generic "leakage" metric hides whether the system is failing at meaning retention, exact memorization, or both.

How to evaluate prompt extraction without conflating the two

Good test design separates meaning recovery from exact-string recovery. A semantic test should ask whether the model revealed the hidden rule, instruction, or tool behaviour in any form that preserves intent. A verbatim test should ask whether the model reproduced protected identifiers, tokens, version numbers, or other exact values that should never be emitted.

That separation also improves remediation. If semantic leakage is the main issue, the fix may involve prompt hardening, output constraints, tool scoping, or reducing how much policy detail is exposed to the model. If verbatim leakage is the issue, the stronger concern is usually secret handling, redaction, retrieval controls, and whether sensitive material was ever placed in model context in the first place. LLM Security Guide is useful when you need to distinguish prompt extraction from broader LLM attack surface issues such as system prompt leakage and data leakage.

Evaluation quality also depends on scoring thresholds. A permissive rubric that credits loose paraphrase as "no leak" can miss real policy exposure. A strict rubric that only counts exact text can miss the more common case where an attacker learns enough structure to defeat the system without seeing the original wording.

Risk and Threat Considerations

Semantic leakage can expose control logic, tool selection rules, or hidden constraints that make later attacks easier. Verbatim leakage can expose material that is directly reusable, such as credentials, endpoints, or internal references, which turns a disclosure problem into an immediate abuse problem. Generative AI Data Loss Prevention Guide is relevant where the concern is sensitive text entering or leaving prompts, while OWASP Top 10 for LLM Applications Guide helps frame prompt extraction as part of a wider LLM security failure pattern.

Failure mechanism: The attacker probes the model until it reveals either the underlying instruction set in paraphrased form or exact sensitive strings from context, training data, or conversation history. The former is a reasoning and policy exposure problem; the latter is a direct confidentiality failure.

Impact: Semantic leakage can enable targeted jailbreaks, tool abuse, and better prompt crafting, while verbatim leakage can expose secrets, operational identifiers, or internal data that may be reused immediately.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10, OWASP Agentic AI Top 10 and MITRE ATT&CK address the attack and risk surface, while OWASP ASVS and NIST AI RMF set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV16 — Security Logging and Error HandlingPrompt extraction testing depends on logging and reviewing leakage evidence.
Recommendation — Log prompt-extraction attempts and review outputs for leaked meaning or exact strings.
OWASP API Security Top 10API8 — Security MisconfigurationPrompt leakage often reflects overly permissive model or tool configuration.
Recommendation — Harden model and tool configuration to reduce exposed instructions and sensitive outputs.
NIST AI RMFGOVERN — GOVERNThis topic needs governance over how extraction risks are measured and handled.
Recommendation — Define leakage scoring rules that distinguish semantic from verbatim exposure.
OWASP Agentic AI Top 10ASI06 — Memory & Context PoisoningPrompt extraction can expose or manipulate the context that agents rely on.
Recommendation — Constrain agent context to reduce recoverable policy and secret material.
MITRE ATT&CKT1003 — OS Credential DumpingVerbatim leakage can expose credentials or token material that supports credential abuse.
Recommendation — Hunt for exposed credentials and rotate any secrets recovered during extraction.

Practitioner Guidance

What to verify: Check whether your evaluation harness separates "meaning recovered" from "exact text recovered" and whether reviewers can score paraphrase without awarding points for string fidelity. If the same rubric covers both, the results will blur two different security outcomes.

Decision rule: If the extracted output contains the intent, policy, or tool behaviour but not the exact text, treat that as a semantic failure even when it looks harmless. If it contains an exact identifier that should never be recoverable, treat it as a verbatim failure and escalate the response.

Practitioner takeaway: The key judgement is not whether the model "leaked," but what kind of information it leaked, because the remediation, scoring, and real-world impact differ materially.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on October 22, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org