从隐藏状态中恢复输入文本:仅解码器语言模型基于梯度的反演研究 Recovering Input Text from Hidden States: Study of Gradient-Based Inversion of Decoder-Only Language Models 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2026-07-01
👁️ 预览文献
💡 AI 中文简介
这项研究探讨如何从GPT-2等仅解码器语言模型的最后一层隐藏状态中,还原出原始输入的词序列。研究者没有采用一步到位的硬性还原,而是把反演看作在连续嵌入空间中的优化过程,只在最后才确定具体词元。这样能观察到模型内部的丰富信号,并判断还原是否正确。实验发现,高频功能词(如空格开头的词)最容易出错,而实义词几乎都能完美还原。在10词元的C4提示上,精确匹配率从66.9%提升到97.5%,平均相似度达0.994,说明大部分错误只是接近正确答案的偏差,而非真正的歧义。
领域自然语言处理 / 模型可解释性与隐私安全
适合谁读需要一定专业背景(了解语言模型、嵌入表示和梯度优化)
核心贡献1. 提出将隐藏状态反演视为连续嵌入空间优化,而非一步硬投影,使优化过程可观测、失败可检测;2. 发现词元恢复的类别不对称性:高频功能词主导失败,实义词几乎完美恢复,并证明多数错误是可通过扩大候选窗口修复的‘近失’。
关键数据在10词元C4提示上,精确匹配率从66.9%提升至97.5%,平均相似度0.994;与SIPIT参考相比,连续优化虽慢但可观测性更强。
推荐理由如果你好奇语言模型的隐藏状态到底泄露了多少输入信息,以及为什么有些词特别难还原,这篇论文用清晰的实验给出了反直觉的答案。
关键词["隐藏状态反演", "仅解码器语言模型", "梯度优化", "嵌入空间", "隐私泄露", "GPT-2"]

原文摘要

查看英文原文摘要

This work studies the hidden-state inversion problem: recovering the original input token sequence of a decoder-only language model from its last-layer hidden states. Rather than treating inversion as a one-shot reconstruction, we study it as a continuous embedding-space optimisation in which a soft proxy is driven towards the leaked target without any hard-token projection during the search, and a token is committed only once, at the end of the inner loop. This design choice has two consequences which are the main focus of this paper. First, keeping the optimisation entirely in continuous space exposes a rich set of internal signals: rank trajectories of the ground-truth token, per-position loss curves, and a discrete loss measured at commit time. Second, the discrete loss allows assessing the correctness of recovery via cumulative discrete loss. We further analyse which tokens break the reconstructions and find a sharp categorical asymmetry: space-prefixed, high-frequency function words in dense regions of the embedding matrix dominate the failures, while content-bearing tokens are recovered almost perfectly. On 10-token C4 prompts the exact-match rate rises from 66.9% to 97.5% (mean similarity 0.994) as the candidate window is widened, confirming that most errors are recoverable near-misses rather than genuine ambiguities. A comparison with the released SIPIT reference situates these findings: per-step hard projection is faster, but the continuous formulation is what makes the optimisation observable and its failures detectable. The results show that last-layer hidden states of GPT-2 are as sensitive as the original text.