모델에게 주의를 기울일 위치를 알려주세요: LLM을 위한 사후 주의 메커니즘 조정
Tell Your Model Where to Attend: Post-hoc Attention Steering for LLMs
November 3, 2023
저자: Qingru Zhang, Chandan Singh, Liyuan Liu, Xiaodong Liu, Bin Yu, Jianfeng Gao, Tuo Zhao
cs.AI
초록
인간이 작성한 글에서는 종종 굵은 글씨나 기울임꼴과 같은 텍스트 스타일의 미묘한 차이를 활용하여 독자의 주의를 유도합니다. 이러한 텍스트 강조는 독자가 전달된 정보를 이해하는 데 매우 중요합니다. 대형 언어 모델(LLM)과 상호작용할 때도 비슷한 필요가 있습니다. 즉, 사용자가 지정한 정보(예: 지시사항)에 모델이 더 주의를 기울이도록 유도하는 것입니다. 그러나 기존 방법들은 일반 텍스트만 처리할 수 있어 이러한 메커니즘을 지원하지 못합니다. 이에 영감을 받아 우리는 PASTA(Post-hoc Attention STeering Approach)를 소개합니다. PASTA는 사용자가 지정한 강조 표시가 있는 텍스트를 LLM이 읽을 수 있도록 하는 방법입니다. 이를 위해 PASTA는 소수의 어텐션 헤드를 식별하고 이들에 대해 정밀한 어텐션 재가중을 적용하여 모델의 주의를 사용자가 지정한 부분으로 유도합니다. 프롬프팅과 마찬가지로 PASTA는 추론 시점에 적용되며 모델 파라미터를 변경할 필요가 없습니다. 실험 결과, PASTA는 LLM이 사용자 지시를 따르거나 사용자 입력으로부터 새로운 지식을 통합하는 능력을 크게 향상시켜 다양한 작업에서 상당한 성능 개선을 이끌어냄을 보여줍니다. 예를 들어, LLAMA-7B의 경우 평균 정확도가 22% 향상되었습니다. 우리의 코드는 https://github.com/QingruZhang/PASTA에서 공개되어 있습니다.
English
In human-written articles, we often leverage the subtleties of text style,
such as bold and italics, to guide the attention of readers. These textual
emphases are vital for the readers to grasp the conveyed information. When
interacting with large language models (LLMs), we have a similar need -
steering the model to pay closer attention to user-specified information, e.g.,
an instruction. Existing methods, however, are constrained to process plain
text and do not support such a mechanism. This motivates us to introduce PASTA
- Post-hoc Attention STeering Approach, a method that allows LLMs to read text
with user-specified emphasis marks. To this end, PASTA identifies a small
subset of attention heads and applies precise attention reweighting on them,
directing the model attention to user-specified parts. Like prompting, PASTA is
applied at inference time and does not require changing any model parameters.
Experiments demonstrate that PASTA can substantially enhance an LLM's ability
to follow user instructions or integrate new knowledge from user inputs,
leading to a significant performance improvement on a variety of tasks, e.g.,
an average accuracy improvement of 22% for LLAMA-7B. Our code is publicly
available at https://github.com/QingruZhang/PASTA .