Episodic Memory Retrieval from LLM s: A Neuromorphic Mechanism to Generate Commonsense Counterfactuals for Relation Extraction (2024)

Abstract: Large language models (LLMs) have achieved satisfactory performance in counterfactual generation. However, confined by the stochastic generation process of LLMs, there often are misalignments between LLMs and humans which hinder LLMs from handling complex tasks like relation extraction. As a result, LLMs may generate commonsense-violated counterfactuals like ‘eggs were produced by a box’. To bridge this gap, we propose to mimick the episodic memory retrieval, the working mechanism of human hippocampus, to align LLMs’ generation process with that of humans. In this way, LLMs can derive experience from their extensive memory, which keeps in line with the way humans gain commonsense. We then implement two central functions in the hippocampus, i.e., pattern separation and pattern completion, to retrieve the episodic memory from LLMs and generate commonsense counterfactuals for relation extraction. Experimental results demonstrate the improvements of our framework over existing methods in terms of the quality of counterfactuals.

## introduction generating counterfactual augmented data to mitigate spurious correlations in neural networks is a rising trend in recent years @xcite . the counterfactual is usually generated by flipping the label of an instance with minimal editing @xcite . large language models (llms) @xcite ) are proven to be proficient in generating counterfactuals for coarse-grained tasks @xcite such as sentiment analysis and natural language inference. however, confined by the inherent stochastic generation process, llms confront challenges when generating counterfactuals original: eggs were moved into a box. counterfactual: eggs were produced by a box moved into eggs box. ## experiments this section presents the experimental settings, results, and corresponding analyses. ## conclusion in this paper, inspired by cognitive neuroscience, we propose a novel neuromorphic mechanism to align llms with humans during the experience gaining process in counterfactual generation for relation extraction. we realize this mechanism with the pattern separation and pattern completion functions which first decompose entities into attributes and then combine the attributes to reconstruct a scenario. our method enables the retrieval of entities' scenarios from the model's extensive memory, and thus provides factual basis for the relation between entities of the generated counterfactual. extensive experiments prove the effectiveness of our proposed mechanism and its implemented functions. we believe this is an interesting exploration of neuroscience based researches and wish it can inspire more studies along this direction.