Self-Control of LLM Behaviors by Compressing Suffix Gradient into Prefix Controller

Min Cai, Yuchen Zhang, Shichang Zhang, Fan Yin, Dan Zhang +3 more
6/4/2024
cs.CLcs.AI

No official code found. Best implementation: HenryCai11/LLM-Self-Control (18 stars, MIT, last commit 2024-08-13). 1 more below.

Abstract

We propose SelfControl, an inference-time model control method utilizing gradients to control the behavior of large language models (LLMs) without explicit human annotations. Given a desired behavior expressed in a natural language suffix string concatenated to the input prompt, SelfControl computes gradients of the LLM's self-evaluation of the suffix with respect to its latent representations. The gradients are used to directly control the auto-regressive generation process towards desired behaviors, which eliminates human supervision, achieves precise and transparent control, and offers on-the-fly adaptability. To further enhance efficiency, we introduce SelfControl_{Prefix}, a compact module that encapsulates the learned representations from gradients into a SelfControl_{Prefix}, facilitating efficient inference-time control with no latency compared to the original model and allowing control for multiple behaviors simultaneously. Our experiments demonstrate SelfControl's efficacy across multiple domains, where it improves over SOTA for 8.3% in detoxification, 3.1% in truthfulness enhancement, 4%~10% in controlling on emotion tones, and 48.2% in privacy protection, i.e., completely remove privacy leakage issue. Additionally, we demonstrate that SelfControl can be used for data synthesis and to improve reasoning abilities.

View on arXivView PDF

Code Implementations(2)

MIT

The official repo of paper "Self-Control of LLM Behaviors by Compressing Suffix Gradient into Prefix Controller"

182Shell, PythonNov 8, 20232 years agoMIT
llmllm-finetuningllm-inference

Website for the paper "Self-Control of LLM Behaviors by Compressing Suffix Gradient into Prefix Controller"

00CSS, HTMLMay 30, 20241 years ago

Similar Papers

Cite this paper

@article{cai2024selfcontrol,
  title  = {Self-Control of LLM Behaviors by Compressing Suffix Gradient into Prefix Controller},
  author = {Min Cai and Yuchen Zhang and Shichang Zhang and Fan Yin and Dan Zhang and Difan Zou and Yisong Yue and Ziniu Hu},
  year   = {2024},
  eprint = {2406.02721},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.02721v3}
}

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/2406.02721.svg)](https://codeofpaper.com/paper/2406.02721)

Discussion