ChatPaper.aiChatPaper

Guidez votre modèle sur où porter son attention : Pilotage post-hoc de l'attention pour les LLM

Tell Your Model Where to Attend: Post-hoc Attention Steering for LLMs

November 3, 2023
Auteurs: Qingru Zhang, Chandan Singh, Liyuan Liu, Xiaodong Liu, Bin Yu, Jianfeng Gao, Tuo Zhao
cs.AI

Résumé

Dans les articles rédigés par des humains, nous exploitons souvent les subtilités du style textuel, comme le gras et l'italique, pour guider l'attention des lecteurs. Ces emphases textuelles sont essentielles pour que les lecteurs saisissent les informations transmises. Lors de l'interaction avec les grands modèles de langage (LLMs), nous avons un besoin similaire : orienter le modèle à accorder une attention accrue aux informations spécifiées par l'utilisateur, par exemple une instruction. Les méthodes existantes, cependant, se limitent au traitement de texte brut et ne prennent pas en charge un tel mécanisme. Cela nous motive à introduire PASTA - Post-hoc Attention STeering Approach, une méthode qui permet aux LLMs de lire du texte avec des marques d'emphase spécifiées par l'utilisateur. Pour ce faire, PASTA identifie un petit sous-ensemble de têtes d'attention et applique un réajustement précis de l'attention sur celles-ci, dirigeant l'attention du modèle vers les parties spécifiées par l'utilisateur. Comme le prompting, PASTA est appliqué au moment de l'inférence et ne nécessite aucune modification des paramètres du modèle. Les expériences démontrent que PASTA peut considérablement améliorer la capacité d'un LLM à suivre les instructions de l'utilisateur ou à intégrer de nouvelles connaissances à partir des entrées de l'utilisateur, conduisant à une amélioration significative des performances sur une variété de tâches, par exemple une amélioration moyenne de la précision de 22 % pour LLAMA-7B. Notre code est disponible publiquement à l'adresse 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 .
PDF152December 15, 2024