arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.26847cs.CRcs.AIcs.CLcs.ITmath.IT
收藏

Broken-Token:通过计算每Token字符数过滤混淆提示

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

JFrog

Shaked Zychlinski, Yuval Kainan

AI总结:

提出CPT-Filtering技术,通过计算文本每Token平均字符数(CPT)利用BPE分词器特性,以极低成本和高准确率识别并过滤利用密码和字符编码的越狱攻击,为LLMs提供可即时部署的防御层。

摘要:

大型语言模型(LLMs)容易受到越狱攻击,恶意提示利用密码和字符级编码进行伪装以绕过安全防护。虽然这些防护通常无法解释编码内容,但底层模型仍能处理有害指令。我们提出CPT-Filtering,这是一种新颖的、与模型无关的、成本可忽略且准确率近乎完美的防护技术,旨在通过利用Byte-Pair Encoding(BPE)分词器的内在行为来缓解这些攻击。我们的方法基于这样一个原理:在自然语言上训练的分词器在表示分布外文本(如密码)时会使用大量更短的token。我们的技术使用语言模型的一个简单但强大的产物:文本中每Token的平均字符数(CPT)。该方法的动机在于现代方法的高计算成本——依赖于专用LLMs或困惑度模型等附加模块。我们在包含超过100,000个提示的大型数据集上验证了我们的方法,测试了多种编码方案和几种流行的分词器。实验表明,简单的CPT阈值能高准确率地稳健识别编码文本,即使对于非常短的输入也是如此。CPT-Filtering提供了一个实用的防御层,可立即部署用于实时文本过滤和离线数据整理。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑