Datasets:
Initial v1 release: 723,457 paper-level BGE-small mean-pooled embeddings + metadata + DiRe/UMAP layout sweep + provenance
Browse files- CITATION.cff +27 -0
- LICENSE +44 -0
- README.md +172 -0
- build_release.py +322 -0
- embeddings/part-00000-of-00008.parquet +3 -0
- embeddings/part-00001-of-00008.parquet +3 -0
- embeddings/part-00002-of-00008.parquet +3 -0
- embeddings/part-00003-of-00008.parquet +3 -0
- embeddings/part-00004-of-00008.parquet +3 -0
- embeddings/part-00005-of-00008.parquet +3 -0
- embeddings/part-00006-of-00008.parquet +3 -0
- embeddings/part-00007-of-00008.parquet +3 -0
- layouts/layouts_2d.parquet +3 -0
- layouts/layouts_3d.parquet +3 -0
- load_example.py +39 -0
- metadata.parquet +3 -0
- provenance/embedding_config.json +11 -0
- provenance/file_hashes.json +20 -0
- provenance/software_versions.json +9 -0
CITATION.cff
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cff-version: 1.2.0
|
| 2 |
+
message: "If you use this dataset, please cite the accompanying paper and the Zenodo deposit."
|
| 3 |
+
title: "arXiv paper embeddings for DiRe topology-faithful dimensionality reduction"
|
| 4 |
+
authors:
|
| 5 |
+
- family-names: Kolpakov
|
| 6 |
+
given-names: Alexander
|
| 7 |
+
- family-names: Rivin
|
| 8 |
+
given-names: Igor
|
| 9 |
+
date-released: 2026-04-27
|
| 10 |
+
license: CC-BY-4.0
|
| 11 |
+
type: dataset
|
| 12 |
+
version: "1.0.0"
|
| 13 |
+
url: "https://github.com/sashakolpakov/dire-rapids-arxiv"
|
| 14 |
+
identifiers:
|
| 15 |
+
- type: doi
|
| 16 |
+
value: 10.5281/zenodo.XXXXXXX
|
| 17 |
+
description: "Zenodo archival DOI (placeholder; replace on publication)"
|
| 18 |
+
preferred-citation:
|
| 19 |
+
type: article
|
| 20 |
+
title: "DiRe: Topology-Faithful Dimensionality Reduction"
|
| 21 |
+
authors:
|
| 22 |
+
- family-names: Kolpakov
|
| 23 |
+
given-names: Alexander
|
| 24 |
+
- family-names: Rivin
|
| 25 |
+
given-names: Igor
|
| 26 |
+
year: 2026
|
| 27 |
+
journal: "Proceedings of the National Academy of Sciences (submitted)"
|
LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The numerical research artifacts in this release (paper-level mean-pooled
|
| 2 |
+
embeddings, DiRe and UMAP layouts) are licensed under the Creative Commons
|
| 3 |
+
Attribution 4.0 International License (CC BY 4.0).
|
| 4 |
+
|
| 5 |
+
You are free to:
|
| 6 |
+
|
| 7 |
+
Share — copy and redistribute the material in any medium or format
|
| 8 |
+
Adapt — remix, transform, and build upon the material for any purpose,
|
| 9 |
+
even commercially.
|
| 10 |
+
|
| 11 |
+
Under the following terms:
|
| 12 |
+
|
| 13 |
+
Attribution — You must give appropriate credit, provide a link to the
|
| 14 |
+
license, and indicate if changes were made. You may do so in any
|
| 15 |
+
reasonable manner, but not in any way that suggests the licensor
|
| 16 |
+
endorses you or your use.
|
| 17 |
+
|
| 18 |
+
No additional restrictions — You may not apply legal terms or
|
| 19 |
+
technological measures that legally restrict others from doing anything
|
| 20 |
+
the license permits.
|
| 21 |
+
|
| 22 |
+
The full legal text of CC BY 4.0 is available at:
|
| 23 |
+
https://creativecommons.org/licenses/by/4.0/legalcode
|
| 24 |
+
|
| 25 |
+
----------------------------------------------------------------------------
|
| 26 |
+
Note on arXiv-derived metadata
|
| 27 |
+
----------------------------------------------------------------------------
|
| 28 |
+
|
| 29 |
+
The descriptive metadata fields in metadata.parquet (arxiv_id, title,
|
| 30 |
+
primary_category, categories) are derived from arXiv's public descriptive
|
| 31 |
+
metadata, which arXiv makes available under a Creative Commons CC0 1.0
|
| 32 |
+
Universal (Public Domain Dedication). See:
|
| 33 |
+
https://info.arxiv.org/help/api/tou.html
|
| 34 |
+
|
| 35 |
+
This release does not redistribute raw arXiv paper text, PDFs, TeX source,
|
| 36 |
+
or chunk-level text. Users who retrieve original paper content separately
|
| 37 |
+
from arXiv are responsible for complying with the license of each paper.
|
| 38 |
+
|
| 39 |
+
----------------------------------------------------------------------------
|
| 40 |
+
Citation
|
| 41 |
+
----------------------------------------------------------------------------
|
| 42 |
+
|
| 43 |
+
If you use this dataset, please cite the accompanying paper and the
|
| 44 |
+
Zenodo deposit. See README.md for citation entries.
|
README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
size_categories:
|
| 6 |
+
- 100K<n<1M
|
| 7 |
+
task_categories:
|
| 8 |
+
- feature-extraction
|
| 9 |
+
tags:
|
| 10 |
+
- arxiv
|
| 11 |
+
- embeddings
|
| 12 |
+
- bge
|
| 13 |
+
- dimensionality-reduction
|
| 14 |
+
- topology
|
| 15 |
+
- dire
|
| 16 |
+
- umap
|
| 17 |
+
pretty_name: DiRe arXiv BGE-small paper-level embeddings
|
| 18 |
+
configs:
|
| 19 |
+
- config_name: default
|
| 20 |
+
data_files:
|
| 21 |
+
- split: train
|
| 22 |
+
path: embeddings/part-*.parquet
|
| 23 |
+
- config_name: metadata
|
| 24 |
+
data_files:
|
| 25 |
+
- split: train
|
| 26 |
+
path: metadata.parquet
|
| 27 |
+
- config_name: layouts_2d
|
| 28 |
+
data_files:
|
| 29 |
+
- split: train
|
| 30 |
+
path: layouts/layouts_2d.parquet
|
| 31 |
+
- config_name: layouts_3d
|
| 32 |
+
data_files:
|
| 33 |
+
- split: train
|
| 34 |
+
path: layouts/layouts_3d.parquet
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
# DiRe arXiv BGE-small paper-level embeddings
|
| 38 |
+
|
| 39 |
+
Paper-level mean-pooled embeddings for **723,457 arXiv papers**, produced with
|
| 40 |
+
[`BAAI/bge-small-en-v1.5`](https://huggingface.co/BAAI/bge-small-en-v1.5),
|
| 41 |
+
together with arXiv descriptive metadata, 2-d and 3-d DiRe / UMAP layouts of
|
| 42 |
+
the full corpus, and provenance manifests.
|
| 43 |
+
|
| 44 |
+
This is the dataset underlying the arXiv experiment in:
|
| 45 |
+
|
| 46 |
+
> Kolpakov, A. and Rivin, I. *DiRe: Topology-Faithful Dimensionality Reduction.*
|
| 47 |
+
> (PNAS submission, 2026.)
|
| 48 |
+
|
| 49 |
+
The pipeline is: 130 M LaTeX-derived chunks → unit-normalized BGE-small chunk
|
| 50 |
+
embeddings → mean-pool per paper (one 384-d vector per paper) → DiRe / UMAP
|
| 51 |
+
projection. The released embeddings are the **mean-pooled, un-renormalized**
|
| 52 |
+
vectors (norms ~0.83-1.0). Downstream code typically L2-renormalizes them
|
| 53 |
+
before further use.
|
| 54 |
+
|
| 55 |
+
## What's in the release
|
| 56 |
+
|
| 57 |
+
| Config | File(s) | Rows | Schema |
|
| 58 |
+
|---|---|---:|---|
|
| 59 |
+
| `default` | `embeddings/part-*.parquet` (8 shards, ~1.03 GB) | 723,457 | `arxiv_id: string`, `embedding: fixed_size_list<float32, 384>` |
|
| 60 |
+
| `metadata` | `metadata.parquet` | 723,457 | `arxiv_id, title, primary_category, categories: list<string>, n_chunks` |
|
| 61 |
+
| `layouts_2d` | `layouts/layouts_2d.parquet` | 7,234,570 | `arxiv_id, method ∈ {dire, umap}, n_neighbors ∈ {8,16,32,64,128}, x, y` |
|
| 62 |
+
| `layouts_3d` | `layouts/layouts_3d.parquet` | 1,446,914 | `arxiv_id, method, n_neighbors=16, x, y, z` |
|
| 63 |
+
|
| 64 |
+
Provenance lives in `provenance/`:
|
| 65 |
+
|
| 66 |
+
- `embedding_config.json` — model, pooling, normalization, embedding dim
|
| 67 |
+
- `software_versions.json` — Python / library versions used at build time
|
| 68 |
+
- `file_hashes.json` — SHA-256 of every released file
|
| 69 |
+
|
| 70 |
+
## Quick start
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from datasets import load_dataset
|
| 74 |
+
import numpy as np
|
| 75 |
+
|
| 76 |
+
# 384-d paper embeddings (default config)
|
| 77 |
+
ds = load_dataset("igriv/dire-arxiv-bge-small-embeddings", split="train")
|
| 78 |
+
X = np.vstack(ds["embedding"]).astype("float32") # (723457, 384)
|
| 79 |
+
ids = np.asarray(ds["arxiv_id"])
|
| 80 |
+
|
| 81 |
+
# arXiv descriptive metadata
|
| 82 |
+
meta = load_dataset("igriv/dire-arxiv-bge-small-embeddings",
|
| 83 |
+
name="metadata", split="train").to_pandas()
|
| 84 |
+
|
| 85 |
+
# Pre-computed 2-d layouts (filter to the canonical setting used in the paper)
|
| 86 |
+
layouts = load_dataset("igriv/dire-arxiv-bge-small-embeddings",
|
| 87 |
+
name="layouts_2d", split="train").to_pandas()
|
| 88 |
+
canonical = layouts[(layouts.method == "dire") & (layouts.n_neighbors == 16)]
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
A minimal loader is also included as `load_example.py`.
|
| 92 |
+
|
| 93 |
+
## Embedding details
|
| 94 |
+
|
| 95 |
+
| | |
|
| 96 |
+
|---|---|
|
| 97 |
+
| Model | `BAAI/bge-small-en-v1.5` |
|
| 98 |
+
| Embedding dim | 384 |
|
| 99 |
+
| Source text | LaTeX-derived chunks (paper body + abstract) |
|
| 100 |
+
| Number of chunks pooled | 130,028,430 across 723,457 papers (~180/paper avg) |
|
| 101 |
+
| Pooling | mean over chunk vectors (each chunk vector is BGE's L2-unit output) |
|
| 102 |
+
| Released dtype | `float32` |
|
| 103 |
+
| Released normalization | **un-normalized mean-pool** (typical norm 0.83–1.0); re-normalize to L2 unit before use if you want cosine ↔ Euclidean equivalence |
|
| 104 |
+
| Per-paper chunk count | available as `n_chunks` in `metadata` |
|
| 105 |
+
|
| 106 |
+
## Layouts
|
| 107 |
+
|
| 108 |
+
The 2-d layouts are the full corpus projected down to 2-d for both DiRe (force-directed,
|
| 109 |
+
GPU; [dire-rapids](https://github.com/sashakolpakov/dire-rapids)) and cuML UMAP. The
|
| 110 |
+
sweep over `n_neighbors ∈ {8, 16, 32, 64, 128}` is included so readers can reproduce
|
| 111 |
+
every figure in the paper directly. The canonical setting is `n_neighbors=16, method=dire`.
|
| 112 |
+
3-d layouts are provided at `n_neighbors=16` for both methods.
|
| 113 |
+
|
| 114 |
+
Layout coordinates are in raw method output units (arbitrary; not standardized).
|
| 115 |
+
|
| 116 |
+
## Reproducing the embeddings
|
| 117 |
+
|
| 118 |
+
The pooled embeddings here are the only thing required to reproduce the paper's
|
| 119 |
+
arXiv experiments (DiRe / UMAP layouts, kNN-preservation evaluation, Betti-curve
|
| 120 |
+
DTW, island-ness diagnostics). The underlying chunk-level embeddings are
|
| 121 |
+
**not** redistributed — they can be regenerated from arXiv source text using the
|
| 122 |
+
public BGE model and the chunking pipeline at <https://github.com/sashakolpakov/dire-rapids-arxiv>.
|
| 123 |
+
|
| 124 |
+
## Source-text policy
|
| 125 |
+
|
| 126 |
+
This release contains **only**:
|
| 127 |
+
|
| 128 |
+
- arXiv descriptive metadata (titles, identifiers, categories, chunk counts) — arXiv lists this as CC0-licensed descriptive metadata
|
| 129 |
+
- numerical research artifacts (mean-pooled embeddings, layouts) produced by the authors
|
| 130 |
+
|
| 131 |
+
It does **not** contain raw arXiv text, PDFs, TeX source, chunk text, or anything
|
| 132 |
+
otherwise covered by the licenses of the original papers. Users who want the
|
| 133 |
+
full text of any individual paper should retrieve it directly from arXiv,
|
| 134 |
+
subject to that paper's license.
|
| 135 |
+
|
| 136 |
+
## Licensing
|
| 137 |
+
|
| 138 |
+
- The numerical research artifacts in this release (embeddings, layouts) are
|
| 139 |
+
released under [**CC-BY 4.0**](https://creativecommons.org/licenses/by/4.0/).
|
| 140 |
+
- arXiv descriptive metadata fields included here are CC0 per
|
| 141 |
+
[arXiv API terms of use](https://info.arxiv.org/help/api/tou.html).
|
| 142 |
+
- This is not legal advice; users are responsible for compliance with the
|
| 143 |
+
licenses of any arXiv paper they retrieve separately from this release.
|
| 144 |
+
|
| 145 |
+
## Citation
|
| 146 |
+
|
| 147 |
+
If you use this dataset, please cite both the paper and the dataset:
|
| 148 |
+
|
| 149 |
+
```bibtex
|
| 150 |
+
@article{kolpakov2026dire,
|
| 151 |
+
author = {Kolpakov, Alexander and Rivin, Igor},
|
| 152 |
+
title = {DiRe: Topology-Faithful Dimensionality Reduction},
|
| 153 |
+
journal = {Proceedings of the National Academy of Sciences (submitted)},
|
| 154 |
+
year = {2026}
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
@dataset{kolpakov_rivin_dire_arxiv_2026,
|
| 158 |
+
author = {Kolpakov, Alexander and Rivin, Igor},
|
| 159 |
+
title = {{arXiv paper embeddings for DiRe topology-faithful dimensionality reduction}},
|
| 160 |
+
year = {2026},
|
| 161 |
+
publisher = {Zenodo},
|
| 162 |
+
doi = {10.5281/zenodo.XXXXXXX}
|
| 163 |
+
}
|
| 164 |
+
```
|
| 165 |
+
|
| 166 |
+
(The Zenodo DOI is the canonical citation. This Hugging Face copy is a convenience mirror.)
|
| 167 |
+
|
| 168 |
+
## Versioning
|
| 169 |
+
|
| 170 |
+
- **v1** (2026-04): Initial release. Pooled embeddings + minimal arXiv metadata + full layout sweep.
|
| 171 |
+
|
| 172 |
+
Future versions may add: enriched metadata (abstracts, authors, dates, license), chunk-level embeddings, additional reducer baselines.
|
build_release.py
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Build the public release tree from data/ artifacts.
|
| 3 |
+
|
| 4 |
+
Reads:
|
| 5 |
+
../data/embeddings.npy float32 (N, 384)
|
| 6 |
+
../data/arxiv_ids.npy object (N,)
|
| 7 |
+
../data/meta.parquet paper_id, arxiv_id, title, primary_category, categories, n_chunks
|
| 8 |
+
../data/chunk_counts.npy int32 (N,)
|
| 9 |
+
../data/{dire,umap}_layout_n{n}_d{d}.npy float32 (N, d) for d in {2,3}
|
| 10 |
+
|
| 11 |
+
Writes:
|
| 12 |
+
metadata.parquet arxiv_id, title, primary_category, categories, n_chunks
|
| 13 |
+
embeddings/part-NNNNN-of-NNNNN.parquet
|
| 14 |
+
layouts/layouts_2d.parquet arxiv_id, method, n_neighbors, x, y
|
| 15 |
+
layouts/layouts_3d.parquet arxiv_id, method, n_neighbors, x, y, z
|
| 16 |
+
provenance/embedding_config.json
|
| 17 |
+
provenance/software_versions.json
|
| 18 |
+
provenance/file_hashes.json
|
| 19 |
+
|
| 20 |
+
This is the single source of truth for what is in the public release.
|
| 21 |
+
Re-running it on the same inputs is reproducible.
|
| 22 |
+
"""
|
| 23 |
+
|
| 24 |
+
from __future__ import annotations
|
| 25 |
+
|
| 26 |
+
import argparse
|
| 27 |
+
import hashlib
|
| 28 |
+
import json
|
| 29 |
+
import platform
|
| 30 |
+
import sys
|
| 31 |
+
import time
|
| 32 |
+
from datetime import datetime, timezone
|
| 33 |
+
from pathlib import Path
|
| 34 |
+
|
| 35 |
+
import numpy as np
|
| 36 |
+
import pandas as pd
|
| 37 |
+
import pyarrow as pa
|
| 38 |
+
import pyarrow.parquet as pq
|
| 39 |
+
|
| 40 |
+
EMBED_DIM = 384
|
| 41 |
+
EMBED_MODEL = "BAAI/bge-small-en-v1.5"
|
| 42 |
+
EMBED_POOLING = "mean"
|
| 43 |
+
EMBED_NORMALIZATION = "L2 (chunks were unit-norm; pooled vectors re-normalized to unit L2 before downstream use)"
|
| 44 |
+
EMBED_DTYPE_RELEASE = "float32"
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
# ---------------------------------------------------------------------------
|
| 48 |
+
# Helpers
|
| 49 |
+
# ---------------------------------------------------------------------------
|
| 50 |
+
|
| 51 |
+
def parse_categories(raw):
|
| 52 |
+
"""Categories column is JSON-string text from postgres jsonb. Parse to list."""
|
| 53 |
+
if raw is None or raw == "":
|
| 54 |
+
return []
|
| 55 |
+
if isinstance(raw, list):
|
| 56 |
+
return [str(x) for x in raw]
|
| 57 |
+
if isinstance(raw, str):
|
| 58 |
+
try:
|
| 59 |
+
v = json.loads(raw)
|
| 60 |
+
except json.JSONDecodeError:
|
| 61 |
+
return [s for s in raw.split() if s]
|
| 62 |
+
if isinstance(v, list):
|
| 63 |
+
return [str(x) for x in v]
|
| 64 |
+
if isinstance(v, str):
|
| 65 |
+
return [v] if v else []
|
| 66 |
+
return []
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def sha256_file(path: Path, chunk: int = 1024 * 1024) -> str:
|
| 70 |
+
h = hashlib.sha256()
|
| 71 |
+
with open(path, "rb") as f:
|
| 72 |
+
while True:
|
| 73 |
+
buf = f.read(chunk)
|
| 74 |
+
if not buf:
|
| 75 |
+
break
|
| 76 |
+
h.update(buf)
|
| 77 |
+
return h.hexdigest()
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def write_metadata(meta_in: pd.DataFrame, out: Path) -> Path:
|
| 81 |
+
"""Write public metadata.parquet — drops internal paper_id, parses categories list."""
|
| 82 |
+
df = pd.DataFrame({
|
| 83 |
+
"arxiv_id": meta_in["arxiv_id"].astype(str),
|
| 84 |
+
"title": meta_in["title"].astype(str),
|
| 85 |
+
"primary_category": meta_in["primary_category"].astype(str),
|
| 86 |
+
"categories": [parse_categories(c) for c in meta_in["categories"]],
|
| 87 |
+
"n_chunks": meta_in["n_chunks"].astype("int32"),
|
| 88 |
+
})
|
| 89 |
+
schema = pa.schema([
|
| 90 |
+
("arxiv_id", pa.string()),
|
| 91 |
+
("title", pa.string()),
|
| 92 |
+
("primary_category", pa.string()),
|
| 93 |
+
("categories", pa.list_(pa.string())),
|
| 94 |
+
("n_chunks", pa.int32()),
|
| 95 |
+
])
|
| 96 |
+
table = pa.Table.from_pandas(df, schema=schema, preserve_index=False)
|
| 97 |
+
path = out / "metadata.parquet"
|
| 98 |
+
pq.write_table(table, path, compression="zstd")
|
| 99 |
+
return path
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
def write_embeddings(arxiv_ids: np.ndarray,
|
| 103 |
+
emb: np.ndarray,
|
| 104 |
+
out: Path,
|
| 105 |
+
n_shards: int) -> list[Path]:
|
| 106 |
+
"""Write sharded embedding parquets with fixed_size_list<float32, 384>."""
|
| 107 |
+
assert emb.dtype == np.float32, f"expected float32, got {emb.dtype}"
|
| 108 |
+
assert emb.shape[1] == EMBED_DIM
|
| 109 |
+
assert emb.shape[0] == arxiv_ids.shape[0]
|
| 110 |
+
|
| 111 |
+
embed_dir = out / "embeddings"
|
| 112 |
+
embed_dir.mkdir(exist_ok=True)
|
| 113 |
+
|
| 114 |
+
schema = pa.schema([
|
| 115 |
+
("arxiv_id", pa.string()),
|
| 116 |
+
("embedding", pa.list_(pa.float32(), EMBED_DIM)), # fixed_size_list
|
| 117 |
+
])
|
| 118 |
+
|
| 119 |
+
n = emb.shape[0]
|
| 120 |
+
bounds = np.linspace(0, n, n_shards + 1, dtype=int)
|
| 121 |
+
paths: list[Path] = []
|
| 122 |
+
width = max(5, len(str(n_shards)))
|
| 123 |
+
|
| 124 |
+
for i in range(n_shards):
|
| 125 |
+
a, b = int(bounds[i]), int(bounds[i + 1])
|
| 126 |
+
ids_slice = arxiv_ids[a:b].astype(str)
|
| 127 |
+
emb_slice = emb[a:b]
|
| 128 |
+
# Build the fixed-size-list array: backing values are the flat float32 buffer.
|
| 129 |
+
flat = pa.array(emb_slice.reshape(-1), type=pa.float32())
|
| 130 |
+
embed_arr = pa.FixedSizeListArray.from_arrays(flat, EMBED_DIM)
|
| 131 |
+
ids_arr = pa.array(ids_slice, type=pa.string())
|
| 132 |
+
table = pa.Table.from_arrays([ids_arr, embed_arr], schema=schema)
|
| 133 |
+
fname = f"part-{i:0{width}d}-of-{n_shards:0{width}d}.parquet"
|
| 134 |
+
path = embed_dir / fname
|
| 135 |
+
pq.write_table(table, path, compression="zstd",
|
| 136 |
+
use_dictionary=False) # embeddings don't dict-compress
|
| 137 |
+
paths.append(path)
|
| 138 |
+
print(f" wrote {path.name}: rows {a}..{b} ({b - a:,}), "
|
| 139 |
+
f"{path.stat().st_size / 1e6:.1f} MB")
|
| 140 |
+
return paths
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def write_layouts(arxiv_ids: np.ndarray, layout_specs: list[dict],
|
| 144 |
+
out: Path) -> list[Path]:
|
| 145 |
+
"""Long-format layouts: arxiv_id, method, n_neighbors, x, y[, z].
|
| 146 |
+
|
| 147 |
+
layout_specs: list of {"path": Path, "method": str, "n": int, "d": int}.
|
| 148 |
+
"""
|
| 149 |
+
layouts_dir = out / "layouts"
|
| 150 |
+
layouts_dir.mkdir(exist_ok=True)
|
| 151 |
+
n_papers = arxiv_ids.shape[0]
|
| 152 |
+
paths: list[Path] = []
|
| 153 |
+
|
| 154 |
+
for d, fname in [(2, "layouts_2d.parquet"), (3, "layouts_3d.parquet")]:
|
| 155 |
+
rows: list[pa.Table] = []
|
| 156 |
+
for spec in layout_specs:
|
| 157 |
+
if spec["d"] != d:
|
| 158 |
+
continue
|
| 159 |
+
xy = np.load(spec["path"])
|
| 160 |
+
assert xy.shape == (n_papers, d), (
|
| 161 |
+
f"layout {spec['path']} shape {xy.shape} != ({n_papers}, {d})")
|
| 162 |
+
cols: dict[str, pa.Array] = {
|
| 163 |
+
"arxiv_id": pa.array(arxiv_ids.astype(str), type=pa.string()),
|
| 164 |
+
"method": pa.array([spec["method"]] * n_papers, type=pa.string()),
|
| 165 |
+
"n_neighbors": pa.array(np.full(n_papers, spec["n"], dtype=np.int32)),
|
| 166 |
+
"x": pa.array(xy[:, 0].astype(np.float32)),
|
| 167 |
+
"y": pa.array(xy[:, 1].astype(np.float32)),
|
| 168 |
+
}
|
| 169 |
+
if d == 3:
|
| 170 |
+
cols["z"] = pa.array(xy[:, 2].astype(np.float32))
|
| 171 |
+
tbl = pa.table(cols)
|
| 172 |
+
rows.append(tbl)
|
| 173 |
+
print(f" layout: {spec['method']} n={spec['n']} d={d} "
|
| 174 |
+
f"({spec['path'].name})")
|
| 175 |
+
if not rows:
|
| 176 |
+
continue
|
| 177 |
+
big = pa.concat_tables(rows)
|
| 178 |
+
path = layouts_dir / fname
|
| 179 |
+
pq.write_table(big, path, compression="zstd")
|
| 180 |
+
paths.append(path)
|
| 181 |
+
print(f" wrote {path.name}: {big.num_rows:,} rows, "
|
| 182 |
+
f"{path.stat().st_size / 1e6:.1f} MB")
|
| 183 |
+
return paths
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
def write_provenance(out: Path, data_dir: Path) -> list[Path]:
|
| 187 |
+
prov = out / "provenance"
|
| 188 |
+
prov.mkdir(exist_ok=True)
|
| 189 |
+
|
| 190 |
+
embedding_cfg = {
|
| 191 |
+
"model": EMBED_MODEL,
|
| 192 |
+
"model_dim": EMBED_DIM,
|
| 193 |
+
"chunk_embedding_normalization": "L2 unit norm (BGE default)",
|
| 194 |
+
"pooling": EMBED_POOLING,
|
| 195 |
+
"post_pooling_normalization": (
|
| 196 |
+
"L2 unit norm applied at use-time by run_reducer.py; "
|
| 197 |
+
"embeddings stored here are the *un-normalized* mean-pooled vectors "
|
| 198 |
+
"(norms ~0.83-1.0)"
|
| 199 |
+
),
|
| 200 |
+
"released_dtype": EMBED_DTYPE_RELEASE,
|
| 201 |
+
"n_papers": int(np.load(data_dir / "embeddings.npy", mmap_mode="r").shape[0]),
|
| 202 |
+
"embedding_dim": EMBED_DIM,
|
| 203 |
+
"source_text": (
|
| 204 |
+
"LaTeX-derived chunk text from arXiv source files; chunks are author-"
|
| 205 |
+
"level paper text. Raw text/PDF/source files are NOT redistributed in "
|
| 206 |
+
"this release. Only the numerical mean-pooled embedding per paper is "
|
| 207 |
+
"released, alongside arXiv descriptive metadata."
|
| 208 |
+
),
|
| 209 |
+
}
|
| 210 |
+
p1 = prov / "embedding_config.json"
|
| 211 |
+
p1.write_text(json.dumps(embedding_cfg, indent=2) + "\n")
|
| 212 |
+
|
| 213 |
+
versions = {
|
| 214 |
+
"build_timestamp_utc": datetime.now(timezone.utc).isoformat(),
|
| 215 |
+
"python": sys.version,
|
| 216 |
+
"platform": platform.platform(),
|
| 217 |
+
"numpy": np.__version__,
|
| 218 |
+
"pandas": pd.__version__,
|
| 219 |
+
"pyarrow": pa.__version__,
|
| 220 |
+
}
|
| 221 |
+
# Best-effort versions for the analysis stack
|
| 222 |
+
for mod in ("dire", "cuml", "ripser", "fastdtw", "umap"):
|
| 223 |
+
try:
|
| 224 |
+
m = __import__(mod)
|
| 225 |
+
versions[mod] = getattr(m, "__version__", "unknown")
|
| 226 |
+
except ImportError:
|
| 227 |
+
pass
|
| 228 |
+
p2 = prov / "software_versions.json"
|
| 229 |
+
p2.write_text(json.dumps(versions, indent=2) + "\n")
|
| 230 |
+
|
| 231 |
+
return [p1, p2]
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
def write_hashes(out: Path) -> Path:
|
| 235 |
+
"""Walk release tree, write SHA256 of every released file (excl. file_hashes.json itself)."""
|
| 236 |
+
hashes: dict[str, str] = {}
|
| 237 |
+
for f in sorted(out.rglob("*")):
|
| 238 |
+
if not f.is_file():
|
| 239 |
+
continue
|
| 240 |
+
rel = f.relative_to(out).as_posix()
|
| 241 |
+
if rel == "provenance/file_hashes.json":
|
| 242 |
+
continue
|
| 243 |
+
hashes[rel] = sha256_file(f)
|
| 244 |
+
p = out / "provenance" / "file_hashes.json"
|
| 245 |
+
p.write_text(json.dumps(hashes, indent=2, sort_keys=True) + "\n")
|
| 246 |
+
return p
|
| 247 |
+
|
| 248 |
+
|
| 249 |
+
# ---------------------------------------------------------------------------
|
| 250 |
+
# Main
|
| 251 |
+
# ---------------------------------------------------------------------------
|
| 252 |
+
|
| 253 |
+
def main():
|
| 254 |
+
ap = argparse.ArgumentParser()
|
| 255 |
+
here = Path(__file__).resolve().parent
|
| 256 |
+
ap.add_argument("--data", type=Path, default=here.parent / "data",
|
| 257 |
+
help="source data directory")
|
| 258 |
+
ap.add_argument("--out", type=Path, default=here,
|
| 259 |
+
help="release tree destination")
|
| 260 |
+
ap.add_argument("--n-shards", type=int, default=8,
|
| 261 |
+
help="number of embedding parquet shards")
|
| 262 |
+
args = ap.parse_args()
|
| 263 |
+
|
| 264 |
+
t0 = time.time()
|
| 265 |
+
print(f"data: {args.data}")
|
| 266 |
+
print(f"out: {args.out}")
|
| 267 |
+
|
| 268 |
+
# Load source artifacts
|
| 269 |
+
print("\n[1/6] Loading source artifacts...")
|
| 270 |
+
meta = pd.read_parquet(args.data / "meta.parquet")
|
| 271 |
+
arxiv_ids_npy = np.load(args.data / "arxiv_ids.npy", allow_pickle=True)
|
| 272 |
+
emb = np.load(args.data / "embeddings.npy") # full load: ~1.1 GB
|
| 273 |
+
|
| 274 |
+
# Alignment check: meta.parquet rows must correspond 1-1 with embeddings.npy rows
|
| 275 |
+
assert len(meta) == len(arxiv_ids_npy) == emb.shape[0], (
|
| 276 |
+
f"row-count mismatch: meta={len(meta)}, arxiv_ids={len(arxiv_ids_npy)}, "
|
| 277 |
+
f"emb={emb.shape[0]}")
|
| 278 |
+
if not (meta["arxiv_id"].astype(str).values == arxiv_ids_npy.astype(str)).all():
|
| 279 |
+
raise SystemExit("arxiv_id ordering in meta.parquet != arxiv_ids.npy — "
|
| 280 |
+
"release would be misaligned.")
|
| 281 |
+
print(f" N = {len(meta):,} papers, dim = {emb.shape[1]}, dtype = {emb.dtype}")
|
| 282 |
+
|
| 283 |
+
# 1. Metadata
|
| 284 |
+
print("\n[2/6] Writing metadata.parquet...")
|
| 285 |
+
meta_path = write_metadata(meta, args.out)
|
| 286 |
+
print(f" wrote {meta_path.name}: "
|
| 287 |
+
f"{meta_path.stat().st_size / 1e6:.1f} MB")
|
| 288 |
+
|
| 289 |
+
# 2. Embeddings (sharded)
|
| 290 |
+
print(f"\n[3/6] Writing {args.n_shards} embedding shards...")
|
| 291 |
+
write_embeddings(arxiv_ids_npy, emb, args.out, args.n_shards)
|
| 292 |
+
|
| 293 |
+
# 3. Layouts
|
| 294 |
+
print("\n[4/6] Writing layouts...")
|
| 295 |
+
layout_specs = []
|
| 296 |
+
for n in [8, 16, 32, 64, 128]:
|
| 297 |
+
for method in ["dire", "umap"]:
|
| 298 |
+
p = args.data / f"{method}_layout_n{n}_d2.npy"
|
| 299 |
+
if p.exists():
|
| 300 |
+
layout_specs.append({"path": p, "method": method, "n": n, "d": 2})
|
| 301 |
+
# 3-d only at n=16 in current data
|
| 302 |
+
for method in ["dire", "umap"]:
|
| 303 |
+
p3 = args.data / f"{method}_layout_n{n}_d3.npy"
|
| 304 |
+
if p3.exists():
|
| 305 |
+
layout_specs.append({"path": p3, "method": method, "n": n, "d": 3})
|
| 306 |
+
write_layouts(arxiv_ids_npy, layout_specs, args.out)
|
| 307 |
+
|
| 308 |
+
# 4. Provenance
|
| 309 |
+
print("\n[5/6] Writing provenance...")
|
| 310 |
+
write_provenance(args.out, args.data)
|
| 311 |
+
|
| 312 |
+
# 5. Hashes (last — must hash everything written above)
|
| 313 |
+
print("\n[6/6] Computing SHA256 hashes...")
|
| 314 |
+
hp = write_hashes(args.out)
|
| 315 |
+
print(f" wrote {hp.relative_to(args.out)}")
|
| 316 |
+
|
| 317 |
+
print(f"\nDone in {time.time() - t0:.1f}s.")
|
| 318 |
+
print(f"Release tree: {args.out}")
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
if __name__ == "__main__":
|
| 322 |
+
main()
|
embeddings/part-00000-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d1eba2aeee24668a356efcd8aade60775d35194120e541dd00bef52bd5090667
|
| 3 |
+
size 129307434
|
embeddings/part-00001-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a133cd750d11207f187d74990d198bafd8c3d4e0491cdbf1a0b67a4a767c9502
|
| 3 |
+
size 129318849
|
embeddings/part-00002-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4731835500f03d28a14c78b89adb178d7ad8dce2018e5b355c80348df5a92562
|
| 3 |
+
size 129291429
|
embeddings/part-00003-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9a938733337dd1a5c34901cdb3542e38d9cef135b19d3485480509873c17098
|
| 3 |
+
size 129269412
|
embeddings/part-00004-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba458612774f851e94ce5969026338b61c341488a750f99bba85c671f56bfe65
|
| 3 |
+
size 129280704
|
embeddings/part-00005-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:090fb97706902cc0ce35f5e1d68b2615cd54de0e79788257d7402b5d5e4b1a51
|
| 3 |
+
size 129286921
|
embeddings/part-00006-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9a5a52aa9cc2f6e4baba13f7f8dd8b5038b6e774530d5f21157e157948f0b2ba
|
| 3 |
+
size 129294110
|
embeddings/part-00007-of-00008.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c8bfe5b5ed4398026eaadbd70ab8eb4642c4e27c497a4e7c65f44329d4912c8d
|
| 3 |
+
size 128012741
|
layouts/layouts_2d.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44891d50234da8fe3578a22531a598a54cd662c8f67d62b012021d3fbc24b4b2
|
| 3 |
+
size 79140649
|
layouts/layouts_3d.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e9e5a18deca4aeac4fe4961a218f56b1da766a4d434b1ef98e9d66dbc1c9bbe4
|
| 3 |
+
size 23190826
|
load_example.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Minimal loader for the DiRe arXiv BGE-small embeddings dataset.
|
| 3 |
+
|
| 4 |
+
Run after `python3 -m pip install datasets numpy pandas`.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
from datasets import load_dataset
|
| 9 |
+
|
| 10 |
+
REPO = "igriv/dire-arxiv-bge-small-embeddings" # update once HF namespace is finalized
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def load_embeddings():
|
| 14 |
+
"""Returns (arxiv_ids: np.ndarray[str], X: np.ndarray[float32, (N, 384)])."""
|
| 15 |
+
ds = load_dataset(REPO, split="train") # default config = embeddings
|
| 16 |
+
arxiv_ids = np.asarray(ds["arxiv_id"])
|
| 17 |
+
X = np.vstack(ds["embedding"]).astype("float32")
|
| 18 |
+
return arxiv_ids, X
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def load_metadata():
|
| 22 |
+
"""Returns a pandas DataFrame keyed on arxiv_id."""
|
| 23 |
+
return load_dataset(REPO, name="metadata", split="train").to_pandas()
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def load_layout(method: str = "dire", n_neighbors: int = 16, d: int = 2):
|
| 27 |
+
"""Pre-computed full-corpus layout for the requested (method, n, d)."""
|
| 28 |
+
config = "layouts_2d" if d == 2 else "layouts_3d"
|
| 29 |
+
df = load_dataset(REPO, name=config, split="train").to_pandas()
|
| 30 |
+
return df[(df.method == method) & (df.n_neighbors == n_neighbors)].reset_index(drop=True)
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
if __name__ == "__main__":
|
| 34 |
+
ids, X = load_embeddings()
|
| 35 |
+
print(f"Embeddings: {X.shape} {X.dtype}, {len(ids)} arxiv_ids")
|
| 36 |
+
meta = load_metadata()
|
| 37 |
+
print(f"Metadata: {len(meta)} rows; columns = {list(meta.columns)}")
|
| 38 |
+
layout = load_layout("dire", 16, 2)
|
| 39 |
+
print(f"Canonical DiRe (n=16) 2-d layout: {len(layout)} points")
|
metadata.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7683353595cbb5bd728cccfe45ed689ab5ed2266f531794456bb12470c4cd16d
|
| 3 |
+
size 26253900
|
provenance/embedding_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": "BAAI/bge-small-en-v1.5",
|
| 3 |
+
"model_dim": 384,
|
| 4 |
+
"chunk_embedding_normalization": "L2 unit norm (BGE default)",
|
| 5 |
+
"pooling": "mean",
|
| 6 |
+
"post_pooling_normalization": "L2 unit norm applied at use-time by run_reducer.py; embeddings stored here are the *un-normalized* mean-pooled vectors (norms ~0.83-1.0)",
|
| 7 |
+
"released_dtype": "float32",
|
| 8 |
+
"n_papers": 723457,
|
| 9 |
+
"embedding_dim": 384,
|
| 10 |
+
"source_text": "LaTeX-derived chunk text from arXiv source files; chunks are author-level paper text. Raw text/PDF/source files are NOT redistributed in this release. Only the numerical mean-pooled embedding per paper is released, alongside arXiv descriptive metadata."
|
| 11 |
+
}
|
provenance/file_hashes.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"CITATION.cff": "fb47a141da4d37c889d61ce410d79d74f1246248ac49dbe66c6fb512818bfcc8",
|
| 3 |
+
"LICENSE": "389cb89b2e1c72321c12fcc962b908d80747890642dd82c7641357b4ea2bb139",
|
| 4 |
+
"README.md": "d7e3bdb91516548db6967d154408c11db0430525b354ee9a28e43769fe0dbe76",
|
| 5 |
+
"build_release.py": "5c6bcda068eccf9d48309ab082a24760b225bb55499ac4b9a5251578cd69f710",
|
| 6 |
+
"embeddings/part-00000-of-00008.parquet": "d1eba2aeee24668a356efcd8aade60775d35194120e541dd00bef52bd5090667",
|
| 7 |
+
"embeddings/part-00001-of-00008.parquet": "a133cd750d11207f187d74990d198bafd8c3d4e0491cdbf1a0b67a4a767c9502",
|
| 8 |
+
"embeddings/part-00002-of-00008.parquet": "4731835500f03d28a14c78b89adb178d7ad8dce2018e5b355c80348df5a92562",
|
| 9 |
+
"embeddings/part-00003-of-00008.parquet": "c9a938733337dd1a5c34901cdb3542e38d9cef135b19d3485480509873c17098",
|
| 10 |
+
"embeddings/part-00004-of-00008.parquet": "ba458612774f851e94ce5969026338b61c341488a750f99bba85c671f56bfe65",
|
| 11 |
+
"embeddings/part-00005-of-00008.parquet": "090fb97706902cc0ce35f5e1d68b2615cd54de0e79788257d7402b5d5e4b1a51",
|
| 12 |
+
"embeddings/part-00006-of-00008.parquet": "9a5a52aa9cc2f6e4baba13f7f8dd8b5038b6e774530d5f21157e157948f0b2ba",
|
| 13 |
+
"embeddings/part-00007-of-00008.parquet": "c8bfe5b5ed4398026eaadbd70ab8eb4642c4e27c497a4e7c65f44329d4912c8d",
|
| 14 |
+
"layouts/layouts_2d.parquet": "44891d50234da8fe3578a22531a598a54cd662c8f67d62b012021d3fbc24b4b2",
|
| 15 |
+
"layouts/layouts_3d.parquet": "e9e5a18deca4aeac4fe4961a218f56b1da766a4d434b1ef98e9d66dbc1c9bbe4",
|
| 16 |
+
"load_example.py": "605856da42186e82345c93ecb3677e99e18e5cedfa2a745008a9a4603d81742b",
|
| 17 |
+
"metadata.parquet": "7683353595cbb5bd728cccfe45ed689ab5ed2266f531794456bb12470c4cd16d",
|
| 18 |
+
"provenance/embedding_config.json": "718305cbcda01158fb5ad5389640f7bcc601eafd3334a3e833b31f25c90cecb3",
|
| 19 |
+
"provenance/software_versions.json": "aef1206f696f4d5942e0b69ec45dd9ded9bed355852c8fb9ce861d3678c5443a"
|
| 20 |
+
}
|
provenance/software_versions.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"build_timestamp_utc": "2026-04-27T20:36:22.738505+00:00",
|
| 3 |
+
"python": "3.12.11 | packaged by conda-forge | (main, Jun 4 2025, 14:34:08) [GCC 13.3.0]",
|
| 4 |
+
"platform": "Linux-6.8.0-1013-nvidia-64k-aarch64-with-glibc2.35",
|
| 5 |
+
"numpy": "2.1.3",
|
| 6 |
+
"pandas": "2.3.3",
|
| 7 |
+
"pyarrow": "22.0.0",
|
| 8 |
+
"fastdtw": "unknown"
|
| 9 |
+
}
|