Memory Injections: Correcting Multi-Hop Reasoning Failures during Inference in Transformer-Based Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Sakarvadia, Mansi, Ajith, Aswathy, Khan, Arham, Grzenda, Daniel, Hudson, Nathaniel, Bauer, André, Chard, Kyle, Foster, Ian
Format: Preprint
Published: 2023
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909123055976448
author Sakarvadia, Mansi
Ajith, Aswathy
Khan, Arham
Grzenda, Daniel
Hudson, Nathaniel
Bauer, André
Chard, Kyle
Foster, Ian
author_facet Sakarvadia, Mansi
Ajith, Aswathy
Khan, Arham
Grzenda, Daniel
Hudson, Nathaniel
Bauer, André
Chard, Kyle
Foster, Ian
contents 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%.
format Preprint
id arxiv_https___arxiv_org_abs_2309_05605
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Memory Injections: Correcting Multi-Hop Reasoning Failures during Inference in Transformer-Based Language Models
Sakarvadia, Mansi
Ajith, Aswathy
Khan, Arham
Grzenda, Daniel
Hudson, Nathaniel
Bauer, André
Chard, Kyle
Foster, Ian
Computation and Language
Artificial Intelligence
Machine Learning
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%.
title Memory Injections: Correcting Multi-Hop Reasoning Failures during Inference in Transformer-Based Language Models
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2309.05605