Summary
This work presents a modified method to train Transformers with memory. The memory is based on k-Nearest Neighbors (with exact match). The work is based on the Memorizing Transformer paper from Y. Wu et al. 2022.
The model assumes a transformer model with a memory attention (an attention layer that has inputs from both current sequence and memory output). The (k-NN) memory returns the top-k matches for a query, and these are included in the input to the memory attention. One difference is the removal of a gating mechanism that mixes between memory and local context, becoming all input to an attention layer.
In addition, contrastive learning is proposed as a method to enhance the model capability to differentiate relevant keys from irrelevant ones in the memory layer. This is achieved by including negative samples from other documents, applying a forward pass up to the memory attention layer, and using these key,value pairs as simulated responses from the k-NN memory. These samples are mixed with the previous context block from the current sample. This method is differentiable and allows to backprop through these positive and negative samples, requiring only a modification to the data pipeline. The authors suggest that the contrastive learning is needed do reduce a "distracting issue" caused in a multi-document setup.
Eventually, the authors show the value of their method with a set of experiments that compare mainly against the memorizing transformer. The results show that memory can extend the effective context length for language modeling at inference time, they can solve a copy task using memory, a pre-trained model can be fine-tuned to introduce the memory attention layer, improves performance in single and multiple document scenarios, and an ablation study with the importance of the negative samples and the differentiable keys.
Strengths
The paper mixes the idea of negative sampling and a twist to the memorizing transformer model with a k-NN memory. The topic is of significance to this community.
* At inference time this model can increase the context length beyond the training length. Inheriting the original memorizing transformer property.
* It is possible to fine-tune from a pre-trained model with no memory to a model with external memory.
* The experiments show the value of the negative samples. The training methodology behind the idea is relatively simple.
Weaknesses
The contribution of this work has limited novelty: both negative sampling (and contrastive learning [2]) and memorizing transformers have been proposed in the past for language modeling.
The clarity and explanations in the work could be improved. The work continuously omits important details or descriptions, sending the reader in most cases to the appendix. The references could make a better exploration of contrastive learning methods applied to language modeling (e.g., [2]). Please, see questions for additional details that may need clarifications.
Retrieval-augmented language models are able to utilize memory to gain information from multiple documents. The "distracting issue" described in the paper suggests that the memory attention mechanism gets distracted by keys from different documents. However, this seems to contradict the findings in previous work (retrieval methods) that earn performance using multiple documents.
The experiments are mainly limited to the memorizing transformer and the vanilla transformer. However, retrieval language models solve the same multi-document problem. Also the dataset chosen follow the memorizing transformers, failing to compare with existing benchmarks in the long context use case, like SCROLLS [1].
[1] Shaham et al., SCROLLS: Standardized CompaRison Over Long Language Sequences, 2022
[2] Jain et al., CONTRACLM: Contrastive Learning For Causal Language Model, 2022
Questions
I would appreciate it if the authors could answer the following questions:
* Line 188: Why is layer 8 picked as the memory layer? How would someone choose the "right" layer for connecting the memory?
* What is the improvement of an existing language model (like OPT, LLaMA, etc.) when fine-tuned to introduce the memory attention layer?
* Why is your model not reaching perfect accuracy in the synthetic task? (Shallow) transformers are able to obtain and copy information. Is the same key related to multiple values in different documents in the dataset?
* What is stored in memory during the evaluation in Section 4.3? What is the data in the memory?
* What is the distance measure for k-NN?
* How is the number of neighbors $k$ chosen for the memory retrieval?
Rating
6: Weak Accept: Technically solid, moderate-to-high impact paper, with no major concerns with respect to evaluation, resources, reproducibility, ethical considerations.
Confidence
4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.
Limitations
The authors address limitations of their work in Section 5.
Scaling (approximate) k-NNs and memory has been addressed for quite some time. See the NeurIPS 2021 competition on Billion Scale Approximate Nearest Neighbor Search.