Datasets:

Modalities:
Text
Formats:
text
Languages:
English
ArXiv:
Libraries:
Datasets
License:
kiyam commited on
Commit
b32ae35
ยท
verified ยท
1 Parent(s): eddb637

Upload 5 files

Browse files
.gitattributes CHANGED
@@ -57,3 +57,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ pq_msmarco_docids.txt filter=lfs diff=lfs merge=lfs -text
61
+ pq_nq_docids.txt filter=lfs diff=lfs merge=lfs -text
62
+ tu_msmarco_docids.txt filter=lfs diff=lfs merge=lfs -text
63
+ tu_nq_docids.txt filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,94 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ๐Ÿ“„ ddro-docids
2
+
3
+ This repository provides the **generated document IDs (DocIDs)** used for training and evaluating the DDRO (Direct Document Relevance Optimization) models.
4
+
5
+ Two types of DocIDs are included:
6
+ - **PQ (Product Quantization) DocIDs**: Compact semantic representations based on quantized document embeddings.
7
+ - **TU (Title + URL) DocIDs**: Tokenized document identifiers constructed from document titles and/or URLs.
8
+
9
+ ---
10
+
11
+ ### ๐Ÿ“š Contents
12
+ - `pq_msmarco_docids.txt`: PQ DocIDs for MS MARCO (MS300K).
13
+ - `tu_msmarco_docids.txt`: TU DocIDs for MS MARCO (MS300K).
14
+ - `pq_nq_docids.txt`: PQ DocIDs for Natural Questions (NQ320K).
15
+ - `tu_nq_docids.txt`: TU DocIDs for Natural Questions (NQ320K).
16
+
17
+ Each file maps a document ID to its corresponding tokenized docid representation.
18
+
19
+ ---
20
+
21
+ ### ๐Ÿ“Œ Details
22
+ - **Maximum Length**:
23
+ - PQ DocIDs: Up to **24 tokens** (24 subspaces for PQ coding).
24
+ - TU DocIDs: Up to **99 tokens** (after tokenization and truncation).
25
+ - **Tokenizer and Model**:
26
+ - **T5-Base** tokenizer and model are used for tokenization.
27
+ - **DocID Construction**:
28
+ - **PQ DocIDs**: Generated by quantizing dense document embeddings obtained from a **SentenceTransformer (GTR-T5-Base)** model.
29
+ - **TU DocIDs**: Generated by tokenizing reversed URL segments or document titles combined with domains based on semantic richness.
30
+ - **Final Adjustment**:
31
+ - All DocIDs are appended with `[1]` (end-of-sequence) token for consistent decoding.
32
+
33
+ ---
34
+
35
+ ### ๐Ÿ› ๏ธ Code for Embedding and DocID Generation
36
+
37
+ #### Step 1: Generate Document Embeddings
38
+
39
+ Document embeddings are generated using a SentenceTransformer model (`gtr-t5-base` by default).
40
+ The scripts used to generate these embbedings are available [here](https://github.com/kidist-amde/ddro/blob/main/src/data/preprocessing/generate_doc_embeddings.py).
41
+
42
+
43
+ Example:
44
+ ```bash
45
+ python generate_embeddings.py \
46
+ --input_path path/to/input.jsonl \
47
+ --output_path path/to/save/embeddings.txt \
48
+ --model_name sentence-transformers/gtr-t5-base \
49
+ --batch_size 128 \
50
+ --dataset msmarco
51
+ ```
52
+
53
+ - `input_path`: Path to the document corpus.
54
+ - `output_path`: Destination for the generated embeddings.
55
+ - `dataset`: Choose `msmarco` or `nq`.
56
+
57
+ **Note**: For NQ, documents are loaded differently (from gzipped TSV format).
58
+
59
+ ---
60
+ ### ๐Ÿ› ๏ธ Code for DocID Generation
61
+ The scripts used to generate these DocIDs are available [here](https://github.com/kidist-amde/ddro/blob/main/src/data/generate_instances/generate_encoded_docids.py).
62
+
63
+ Key functionality:
64
+ - Loading document embeddings and documents.
65
+ - Encoding document IDs with PQ codes or URL/title-based tokenization.
66
+ - Applying consistent token indexing for training generative retrievers.
67
+
68
+ Example usage:
69
+ ```bash
70
+ python generate_encoded_docids.py \
71
+ --encoding pq \
72
+ --input_doc_path path/to/documents.jsonl \
73
+ --input_embed_path path/to/embeddings.txt \
74
+ --output_path path/to/save/pq_docids.txt \
75
+ --pretrain_model_path transformer_models/t5-base
76
+ ```
77
+
78
+ Supported encoding options: `atomic`, `pq`, `url`, `summary`
79
+
80
+
81
+
82
+ ### ๐Ÿ“– Citation
83
+ If you use these docids, please cite:
84
+
85
+ ```bibtex
86
+ @article{mekonnen2025lightweight,
87
+ title={Lightweight and Direct Document Relevance Optimization for Generative Information Retrieval},
88
+ author={Mekonnen, Kidist Amde and Tang, Yubao and de Rijke, Maarten},
89
+ journal={arXiv preprint arXiv:2504.05181},
90
+ year={2025}
91
+ }
92
+ ```
93
+
94
+ ---
pq_msmarco_docids.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1352fad93beb6a5ec659d6c9270855171e45dc85052098b6611169e195f8282
3
+ size 49454481
pq_nq_docids.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b45d121c0216d4c6905a6447788482af7b099f4cd29bb57efa138a68b690b3b
3
+ size 18258121
tu_msmarco_docids.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:df2d394dd5fe99753a29e1f966cad3cdfe963ec695d9b11f5d30e34460321527
3
+ size 24339419
tu_nq_docids.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec94b4458295027a2ffc5c087257c4a328a461c45c0c4353264d4258c8bdbf44
3
+ size 10517078