Prompts play a crucial role in guiding the responses of Large Language Models (LLMs). However, the intricate role of individual tokens in prompts, known as input saliency, in shaping the responses remains largely underexplored. Existing saliency methods either misalign with LLM generation objectives or rely heavily on linearity assumptions, leading to potential inaccuracies. To address this, we propose Token Distribution Dynamics (TDD), a \textcolor{black}{simple yet effective} approach to unveil and manipulate the role of prompts in generating LLM outputs. TDD leverages the robust interpreting capabilities of the language model head (LM head) to assess input saliency. It projects input tokens into the embedding space and then estimates their significance based on distribution dynamics over the vocabulary. We introduce three TDD variants: forward, backward, and bidirectional, each offering unique insights into token relevance. Extensive experiments reveal that the TDD surpasses state-of-the-art baselines with a big margin in elucidating the causal relationships between prompts and LLM outputs. Beyond mere interpretation, we apply TDD to two prompt manipulation tasks for controlled text generation: zero-shot toxic language suppression and sentiment steering. Empirical results underscore TDD's proficiency in identifying both toxic and sentimental cues in prompts, subsequently mitigating toxicity or modulating sentiment in the generated content.
翻译:提示在引导大型语言模型(LLM)的响应中发挥着关键作用。然而,提示中单个标记(即输入显著性)在塑造响应过程中的复杂作用仍未得到充分探索。现有的显著性方法要么与LLM生成目标不一致,要么过度依赖线性假设,这可能导致潜在的不准确性。为此,我们提出标记分布动力学(TDD)方法,这是一种简单而有效的途径,用于揭示和操控提示在生成LLM输出中的作用。TDD利用语言模型头(LM head)强大的解释能力来评估输入显著性:它将输入标记投影到嵌入空间,然后基于词汇表上的分布动态估计其重要性。我们引入了三种TDD变体:前向、后向和双向,每种变体都能提供对标记相关性的独特见解。大量实验表明,TDD在阐明提示与LLM输出之间的因果关系方面,以显著优势超越了最先进的基线方法。除了单纯的解释外,我们还应用TDD处理两项提示操控任务以控制文本生成:零样本毒性语言抑制与情感导向。实证结果凸显了TDD在识别提示中毒性及情感线索方面的能力,并随后在生成内容中降低毒性或调节情感。