Unveiling and Manipulating Prompt Influence in Large Language Models

Zijian Feng, Hanzhang Zhou, Zixiao Zhu, Junlang Qian, Kezhi Mao
5/1/2024
12 citations

Official code: zijian678/TDD (14 stars, Python, last commit 2024-04-22).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

zijian678/TDDOfficial100%
140PythonFeb 20, 20242 years ago

Similar Papers

Cite this paper

@article{feng2024unveiling,
  title  = {Unveiling and Manipulating Prompt Influence in Large Language Models},
  author = {Zijian Feng and Hanzhang Zhou and Zixiao Zhu and Junlang Qian and Kezhi Mao},
  year   = {2024},
  eprint = {2405.11891},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2405.11891},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.11891.svg)](https://codeofpaper.com/paper/2405.11891)

Discussion