arXiv:2510.26847cs.CRcs.AI2025-10被引 1

通过统计字符/词元数识别加密提示,高效防御大模型越狱攻击。

Broken-Token: Filtering Obfuscated Prompts by Counting Characters-Per-Token

  • 利用词元化中字符/词元平均值异常检测加密文本。
  • 在十万级提示数据上验证,阈值法对短输入仍保持高准确率。
  • 无需额外模型,可实时部署,适合安全防护与数据清洗。

大型语言模型易受越狱攻击,攻击者通过密码和字符级编码伪装恶意提示以绕过安全机制。尽管安全护栏无法解析编码内容,但底层模型仍能理解有害指令。本文提出一种名为CPT-Filtering的新方法,基于字节对编码(BPE)分词器的内在特性,实现模型无关、开销极低且近乎完美的防御。其核心思想是:自然语言训练的分词器对分布外文本(如密码)会产生更多更短的词元。该方法利用语言模型的简单特征——文本的平均字符/词元数(CPT)。相比依赖额外模块(如专用LLM或困惑度模型)的高成本方法,本方法计算高效。我们在超过10万条提示上测试了多种编码方案及主流分词器,实验表明,仅用一个简单的CPT阈值即可高精度识别编码文本,即使对极短输入也有效。CPT-Filtering可作为即时文本过滤与离线数据清洗的实用防御层。

原文摘要 · Abstract (English)

Large Language Models (LLMs) are susceptible to jailbreak attacks where malicious prompts are disguised using ciphers and character-level encodings to bypass safety guardrails. While these guardrails often fail to interpret the encoded content, the underlying models can still process the harmful instructions. We introduce CPT-Filtering, a novel, model-agnostic with negligible-costs and near-perfect accuracy guardrail technique that aims to mitigate these attacks by leveraging the intrinsic behavior of Byte-Pair Encoding (BPE) tokenizers. Our method is based on the principle that tokenizers, trained on natural language, represent out-of-distribution text, such as ciphers, using a significantly higher number of shorter tokens. Our technique uses a simple yet powerful artifact of using language models: the average number of Characters Per Token (CPT) in the text. This approach is motivated by the high compute cost of modern methods - relying on added modules such as dedicated LLMs or perplexity models. We validate our approach across a large dataset of over 100,000 prompts, testing numerous encoding schemes with several popular tokenizers. Our experiments demonstrate that a simple CPT threshold robustly identifies encoded text with high accuracy, even for very short inputs. CPT-Filtering provides a practical defense layer that can be immediately deployed for real-time text filtering and offline data curation.

越狱攻击安全防护词元化

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。