Memorilla / README.md
adibvafa's picture
Add files using upload-large-folder tool
b6784b8 verified
|
Raw History Blame Contribute Delete
16.7 kB
---
pretty_name: Memorilla
language:
- en
license: other
license_name: per-config
license_link: https://huggingface.co/datasets/MemoryAsModality/Memorilla#licensing
task_categories:
- question-answering
- summarization
- text-generation
tags:
- memory
- long-context
- personalization
- retrieval
- embeddings
size_categories:
- 1M<n<10M
configs:
- config_name: pv4
default: true
data_files:
- split: train
path: data/pv4/train-*
- split: validation
path: data/pv4/validation-*
- split: test
path: data/pv4/test-*
- config_name: pmv2
data_files:
- split: train
path: data/pmv2/train-*
- split: validation
path: data/pmv2/validation-*
- split: test
path: data/pmv2/test-*
- config_name: factkg
data_files:
- split: train
path: data/factkg/train-*
- split: validation
path: data/factkg/validation-*
- split: test
path: data/factkg/test-*
- config_name: triviaqa
data_files:
- split: train
path: data/triviaqa/train-*
- split: validation
path: data/triviaqa/validation-*
- split: test
path: data/triviaqa/test-*
- config_name: narrativeqa
data_files:
- split: train
path: data/narrativeqa/train-*
- split: validation
path: data/narrativeqa/validation-*
- split: test
path: data/narrativeqa/test-*
- config_name: pubmedqa
data_files:
- split: train
path: data/pubmedqa/train-*
- split: test
path: data/pubmedqa/test-*
- config_name: lamp4
data_files:
- split: train
path: data/lamp4/train-*
- split: test
path: data/lamp4/test-*
- config_name: lamp7
data_files:
- split: train
path: data/lamp7/train-*
- split: test
path: data/lamp7/test-*
- config_name: squad_v2
data_files:
- split: train
path: data/squad_v2/train-*
- split: validation
path: data/squad_v2/validation-*
- config_name: drop
data_files:
- split: train
path: data/drop/train-*
- split: validation
path: data/drop/validation-*
- config_name: coqa
data_files:
- split: train
path: data/coqa/train-*
- split: validation
path: data/coqa/validation-*
- config_name: quail
data_files:
- split: train
path: data/quail/train-*
- split: validation
path: data/quail/validation-*
- config_name: pwc
data_files:
- split: train
path: data/pwc/train-*
- split: validation
path: data/pwc/validation-*
- config_name: cnn_dailymail
data_files:
- split: train
path: data/cnn_dailymail/train-*
- split: validation
path: data/cnn_dailymail/validation-*
- config_name: samsum
data_files:
- split: train
path: data/samsum/train-*
- split: validation
path: data/samsum/validation-*
- config_name: dialogsum
data_files:
- split: train
path: data/dialogsum/train-*
- split: validation
path: data/dialogsum/validation-*
- config_name: msmarco
data_files:
- split: train
path: data/msmarco/train-*
- split: validation
path: data/msmarco/validation-*
- config_name: enwiki
data_files:
- split: train
path: data/enwiki/train-*
- split: validation
path: data/enwiki/validation-*
---
# Memorilla data
Training and evaluation data for [Memorilla](https://github.com/snap-stanford/memorilla), a memory module that compresses a collection of documents
into a small set of memory tokens for a frozen language model. Every row pairs a question and a reference answer with
the document collection the answer should be grounded in. Precomputed [Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B)
vectors for every document and every question are included, so training and evaluation start without an embedding
pass.
## Usage
```python
from datasets import load_dataset
pv4 = load_dataset("MemoryAsModality/Memorilla", "pv4", split="test")
row = pv4[0]
print(row["question"], row["answer"], len(row["documents"]))
```
The [Memorilla code](https://github.com/snap-stanford/memorilla) downloads the embeddings of a config on first use. To fetch them directly:
```python
import torch
from huggingface_hub import snapshot_download
from safetensors import safe_open
config, split = "pv4", "test"
root = snapshot_download(
"MemoryAsModality/Memorilla",
repo_type="dataset",
allow_patterns=[f"embeddings/qwen3-embedding-4b/{config}/{split}/*"],
)
folder = f"{root}/embeddings/qwen3-embedding-4b/{config}/{split}"
with safe_open(f"{folder}/index.safetensors", framework="pt") as f:
index = {key: f.get_tensor(key) for key in f.keys()}
def documents(collection_id: int):
position = int(torch.searchsorted(index["collection_ids"], torch.tensor(collection_id)))
shard, start, length = (int(index[k][position]) for k in ("shard", "start", "length"))
with safe_open(f"{folder}/documents-{shard:05d}.safetensors", framework="pt") as f:
return f.get_slice("embeddings")[start : start + length] # [num_documents, 2560]
with safe_open(f"{folder}/questions.safetensors", framework="pt") as f:
questions = f.get_tensor("embeddings") # [num_rows, 2560], row-aligned with the split
print(documents(row["collection_id"]).shape, questions[0].shape)
```
## Configs
### Benchmarks
| config | dataset | rows | collection | embeddings |
| --- | --- | --- | --- | --- |
| `pv4` | PersonalizationV4 | train 15,058 · validation 1,755 · test 4,237 | user | 364.5 MiB |
| `pmv2` | PersonaMem-v2 | train 18,521 · validation 2,059 · test 5,000 | persona | 1.1 GiB |
| `factkg` | FactKG | train 86,367 · validation 13,266 · test 9,041 | claim | 69.4 GiB |
| `triviaqa` | TriviaQA | train 138,384 · validation 17,444 · test 500 | question | 124.6 GiB |
| `narrativeqa` | NarrativeQA | train 32,747 · validation 3,461 · test 10,557 | story | 11.5 GiB |
| `pubmedqa` | PubMedQA | train 900 · test 100 | question | 23.9 MiB |
| `lamp4` | LaMP-4 | train 12,527 · test 1,925 | question | 19.1 GiB |
| `lamp7` | LaMP-7 | train 10,437 · test 1,500 | question | 1.1 GiB |
### Instruction mixture
| config | dataset | rows | collection | embeddings |
| --- | --- | --- | --- | --- |
| `squad_v2` | SQuAD 2.0 | train 86,821 · validation 5,928 | question | 1.2 GiB |
| `drop` | DROP | train 77,400 · validation 9,535 | question | 1.5 GiB |
| `coqa` | CoQA | train 108,647 · validation 7,983 | question | 2.5 GiB |
| `quail` | QuAIL | train 10,246 · validation 2,164 | question | 313.9 MiB |
| `pwc` | PwC | train 241,564 · validation 18,141 | question | 6.9 GiB |
| `cnn_dailymail` | CNN/DailyMail | train 287,113 · validation 13,368 | article | 14.9 GiB |
| `samsum` | SAMSum | train 14,731 · validation 818 | conversation | 190.5 MiB |
| `dialogsum` | DialogSum | train 12,460 · validation 500 | dialogue | 174.9 MiB |
| `msmarco` | MS MARCO | train 504,111 · validation 55,597 | query | 30.7 GiB |
### Pretraining corpus
| config | dataset | rows | collection | embeddings |
| --- | --- | --- | --- | --- |
| `enwiki` | English Wikipedia | train 1,979,809 · validation 10,017 | passage | 26.0 GiB |
- **`pv4`** (PersonalizationV4). A fictional user's 200 conversations with an assistant and a scenario question about what the user would most likely do or prefer. `train` and `validation` hold the training and held-out questions of 119 users; `test` holds every question of 30 further users, none of whom appear in `train` or `validation`. `hard` marks 629 test questions that Qwen3-4B-Instruct-2507 gets wrong either with no documents or with only the single most relevant conversation.
- **`pmv2`** (PersonaMem-v2). A simulated user's conversation history and a request whose best response depends on the user's preferences. Splits follow the per-persona files of the source: `test` holds 5,000 questions from 200 personas.
- **`factkg`** (FactKG). A claim to label `True` or `False` together with DBpedia triples about the claim's entities, written as `subject → relation → object`. Original train, dev (`validation`) and test claims.
- **`triviaqa`** (TriviaQA). A trivia question with the evidence documents of TriviaQA's reading-comprehension release (Wikipedia pages, or web search results when a question has none), split into passages. `test` is a fixed sample of 500 questions from the original validation set; `validation` holds the remaining 17,444. The original test questions are not included because their answers are not public.
- **`narrativeqa`** (NarrativeQA). A question about a book or movie script; the documents are the full story text split into chunks. Original train, validation and test splits.
- **`pubmedqa`** (PubMedQA). A biomedical research question over the sections of a PubMed abstract; the answer starts with yes, no or maybe followed by the long answer. The 1,000 expert-labeled questions (`pqa_labeled`), split 900 / 100 into `train` and `test`.
- **`lamp4`** (LaMP-4). Personalized news headline generation: an article to title, with the author's previous articles as documents. `train` and `test` are the user-based LaMP-4 train and development sets.
- **`lamp7`** (LaMP-7). Personalized tweet paraphrasing: a tweet to paraphrase, with the user's previous tweets as documents. `train` and `test` are the user-based LaMP-7 train and development sets.
- **`squad_v2`** (SQuAD 2.0). A question over a Wikipedia paragraph; only answerable questions are included. Original train and validation splits.
- **`drop`** (DROP). A question requiring discrete reasoning (counting, arithmetic, sorting) over a paragraph. Original train and validation splits.
- **`coqa`** (CoQA). A conversational question over a passage; the question includes the preceding turns. Original train and validation splits.
- **`quail`** (QuAIL). A multiple-choice reading comprehension question (choices included in the question) over a passage; the answer is the text of the correct choice. Original train and validation splits.
- **`pwc`** (PwC). An instruction about a text (questions, summaries, extraction) with the text as documents. `train` is the original train split; `validation` is the original test split.
- **`cnn_dailymail`** (CNN/DailyMail). A news article to summarize; the answer is the article's highlights. Original train and validation splits (version 3.0.0).
- **`samsum`** (SAMSum). A messenger-style conversation to summarize. Original train and validation splits.
- **`dialogsum`** (DialogSum). A spoken-style dialogue to summarize. Original train and validation splits.
- **`msmarco`** (MS MARCO). A web search query with its retrieved passages and a human-written answer (the well-formed answer when there is one); queries without an answer are not included. Original train and validation splits (v2.1).
- **`enwiki`** (English Wikipedia). A Wikipedia passage, headed by its article title and section and split into chunks of at most about 128 tokens, with a generic instruction to restate it; the answer is the passage text. Train and validation passages.
## Fields
| field | type | description |
| --- | --- | --- |
| `collection_id` | int64 | Identifies the row's document collection. Rows with the same `collection_id` in a split share the same `documents`. |
| `question` | string | The question or instruction. |
| `answer` | string | The reference answer. |
| `choices` | list[string] | `pv4`, `pmv2` and `factkg` only. Candidate answers for embedding-based scoring; `answer` is one of them. `pv4` and `pmv2` list five candidates in A-E order, with an empty string for a missing one; `factkg` lists `["True", "False"]`. |
| `hard` | bool | `pv4` only. Marks the hard test subset (always `False` in `train` and `validation`). |
| `documents` | list[string] | The document collection, in its original order. |
## Embeddings
```
embeddings/qwen3-embedding-4b/<config>/<split>/
index.safetensors collection_ids int64 [C] (ascending), shard int32 [C], start int64 [C], length int64 [C]
documents-XXXXX.safetensors embeddings float16 [n, 2560]; whole collections, at most 4 GiB per shard
questions.safetensors embeddings float16 [R, 2560], row-aligned with data/<config>/<split>
```
- Collection `index["collection_ids"][i]` occupies rows `start[i]` to `start[i] + length[i]` of
`documents-{shard[i]:05d}.safetensors`, one row per entry of `documents`, in order.
- Each split stores the collections it uses, so a collection shared by two splits appears in both.
- Vectors were computed with [Qwen/Qwen3-Embedding-4B](https://huggingface.co/Qwen/Qwen3-Embedding-4B) in vLLM (bfloat16, default pooling,
unit-normalized) without an instruction prefix and stored as float16. Questions are embedded from
`question.strip()`.
## Licensing
Each config is distributed under the license of its source dataset, listed below. Some sources are restricted to
non-commercial use.
| config | source | license | reference |
| --- | --- | --- | --- |
| `pv4` | [MemoryAsModality/PersonalizationV4](https://huggingface.co/datasets/MemoryAsModality/PersonalizationV4); persona seeds from [Synthetic-Persona-Chat](https://huggingface.co/datasets/google/Synthetic-Persona-Chat) | CC BY 4.0 | Memorilla; seed personas: Jandaghi et al., 2023. Faithful Persona-based Conversational Dataset Generation with Large Language Models. |
| `pmv2` | [bowen-upenn/PersonaMem-v2](https://huggingface.co/datasets/bowen-upenn/PersonaMem-v2) | CC BY 4.0 | Jiang et al., 2025. PersonaMem-v2: Towards Personalized Intelligence via Learning Implicit User Personas and Agentic Memory. |
| `factkg` | [FactKG](https://github.com/jiho283/FactKG); triples from DBpedia | FactKG: no license stated; DBpedia: CC BY-SA 3.0 | Kim et al., 2023. FactKG: Fact Verification via Reasoning on Knowledge Graphs. ACL. |
| `triviaqa` | [mandarjoshi/trivia_qa](https://huggingface.co/datasets/mandarjoshi/trivia_qa) (`rc`) | Apache 2.0 | Joshi et al., 2017. TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension. ACL. |
| `narrativeqa` | [deepmind/narrativeqa](https://huggingface.co/datasets/deepmind/narrativeqa) | Apache 2.0 | Kočiský et al., 2018. The NarrativeQA Reading Comprehension Challenge. TACL. |
| `pubmedqa` | [qiaojin/PubMedQA](https://huggingface.co/datasets/qiaojin/PubMedQA) (`pqa_labeled`) | MIT | Jin et al., 2019. PubMedQA: A Dataset for Biomedical Research Question Answering. EMNLP. |
| `lamp4` | [LaMP](https://lamp-benchmark.github.io) | See the LaMP benchmark | Salemi et al., 2024. LaMP: When Large Language Models Meet Personalization. ACL. |
| `lamp7` | [LaMP](https://lamp-benchmark.github.io) | See the LaMP benchmark | Salemi et al., 2024. LaMP: When Large Language Models Meet Personalization. ACL. |
| `squad_v2` | [rajpurkar/squad_v2](https://huggingface.co/datasets/rajpurkar/squad_v2) | CC BY-SA 4.0 | Rajpurkar et al., 2018. Know What You Don't Know: Unanswerable Questions for SQuAD. ACL. |
| `drop` | [ucinlp/drop](https://huggingface.co/datasets/ucinlp/drop) | CC BY-SA 4.0 | Dua et al., 2019. DROP: A Reading Comprehension Benchmark Requiring Discrete Reasoning Over Paragraphs. NAACL. |
| `coqa` | [stanfordnlp/coqa](https://huggingface.co/datasets/stanfordnlp/coqa) | Per-domain licenses of CoQA (CC BY-SA 4.0, MSR-LA, RACE, Apache 2.0) | Reddy et al., 2019. CoQA: A Conversational Question Answering Challenge. TACL. |
| `quail` | [textmachinelab/quail](https://huggingface.co/datasets/textmachinelab/quail) | CC BY-NC-SA 4.0 | Rogers et al., 2020. Getting Closer to AI Complete Question Answering: A Set of Prerequisite Real Tasks. AAAI. |
| `pwc` | [sggetao/PwC](https://huggingface.co/datasets/sggetao/PwC) | Apache 2.0 | Ge et al., 2024. In-context Autoencoder for Context Compression in a Large Language Model. ICLR. |
| `cnn_dailymail` | [abisee/cnn_dailymail](https://huggingface.co/datasets/abisee/cnn_dailymail) | Apache 2.0 | See et al., 2017. Get To The Point: Summarization with Pointer-Generator Networks. ACL. |
| `samsum` | [knkarthick/samsum](https://huggingface.co/datasets/knkarthick/samsum) | CC BY-NC-ND 4.0 | Gliwa et al., 2019. SAMSum Corpus: A Human-annotated Dialogue Dataset for Abstractive Summarization. |
| `dialogsum` | [knkarthick/dialogsum](https://huggingface.co/datasets/knkarthick/dialogsum) | CC BY-NC-SA 4.0 | Chen et al., 2021. DialogSum: A Real-Life Scenario Dialogue Summarization Dataset. Findings of ACL. |
| `msmarco` | [microsoft/ms_marco](https://huggingface.co/datasets/microsoft/ms_marco) (`v2.1`) | MS MARCO terms (non-commercial research use) | Nguyen et al., 2016. MS MARCO: A Human Generated MAchine Reading COmprehension Dataset. |
| `enwiki` | English Wikipedia (December 2021 dump) | CC BY-SA 4.0 | Wikipedia contributors. |
## Citation
If you use this data, please cite Memorilla (see the [code repository](https://github.com/snap-stanford/memorilla)) and the original dataset of each
config you use (table above).