In plain words: When a model fumbles a question that needs several facts combined, this adds the missing fact directly into a key inner layer while it answers. That simple nudge raised the probability of the correct next word by up to 424%.
Abstract · Memory Injections: Correcting Multi-Hop Reasoning Failures during Inference in Transformer-Based Language Models
Answering multi-hop reasoning questions requires retrieving and synthesizing information from diverse sources. Large Language Models (LLMs) struggle to perform such reasoning consistently. Here we propose an approach to pinpoint and rectify multi-hop reasoning failures through targeted memory injections on LLM attention heads. First, we analyze the per-layer activations of GPT-2 models in response to single and multi-hop prompts. We then propose a mechanism that allows users to inject pertinent prompt-specific information, which we refer to as "memories," at critical LLM locations during inference. By thus enabling the LLM to incorporate additional relevant information during inference, we enhance the quality of multi-hop prompt completions. We show empirically that a simple, efficient, and targeted memory injection into a key attention layer can often increase the probability of the desired next token in multi-hop tasks, by up to 424%.
Mansi Sakarvadia, Aswathy Ajith, Arham Khan, Daniel Grzenda, Nathaniel Hudson, André Bauer, Kyle Chard, Ian Foster
arXiv:2309.05605 · cs.CL, cs.AI, cs.LG · submitted Sep 11, 2023 · updated Feb 28, 2024
abstract · pdf · html · Oral Presentation at BlackboxNLP Workshop at EMNLP 2023